Browse Source

实验6 第二版

x86-32
423A35C7 3 months ago
parent
commit
f3c2d8b154
2 changed files with 1 additions and 3 deletions
  1. +0
    -1
      labcodes_answer/lab6_result/kern/process/proc.h
  2. +1
    -2
      labcodes_answer/lab6_result/kern/schedule/default_sched.c

+ 0
- 1
labcodes_answer/lab6_result/kern/process/proc.h View File

@ -64,7 +64,6 @@ struct proc_struct {
skew_heap_entry_t lab6_run_pool; // FOR LAB6 ONLY: the entry in the run pool skew_heap_entry_t lab6_run_pool; // FOR LAB6 ONLY: the entry in the run pool
uint32_t lab6_stride; // FOR LAB6 ONLY: the current stride of the process uint32_t lab6_stride; // FOR LAB6 ONLY: the current stride of the process
uint32_t lab6_priority; // FOR LAB6 ONLY: the priority of process, set by lab6_set_priority(uint32_t) uint32_t lab6_priority; // FOR LAB6 ONLY: the priority of process, set by lab6_set_priority(uint32_t)
uint32_t lab6_ticket_start;
}; };
#define PF_EXITING 0x00000001 // getting shutdown #define PF_EXITING 0x00000001 // getting shutdown

+ 1
- 2
labcodes_answer/lab6_result/kern/schedule/default_sched.c View File

@ -174,7 +174,6 @@ ticket_enqueue(struct run_queue *rq, struct proc_struct *proc) {
proc->time_slice = rq->max_time_slice; proc->time_slice = rq->max_time_slice;
} }
proc->rq = rq; proc->rq = rq;
proc->lab6_ticket_start = rq->lab6_total_num + 1;
rq->proc_num ++; rq->proc_num ++;
rq->lab6_total_num += proc->lab6_priority + 1; rq->lab6_total_num += proc->lab6_priority + 1;
@ -218,7 +217,7 @@ ticket_dequeue(struct run_queue *rq, struct proc_struct *proc) {
list_del_init(&(proc->run_link)); list_del_init(&(proc->run_link));
#endif #endif
rq->proc_num --; rq->proc_num --;
rq->lab6_total_num -= proc->lab6_priority;
rq->lab6_total_num -= proc->lab6_priority + 1;
} }
static void static void

Loading…
Cancel
Save