hi
i have a question regarding problem 45:
modify the scheduler to keep track of how much cpu time each user
process has had recently. when no task or server wants to run, pick the
user process that has had the smallest cpu share
i dont really understand whats mean with "how much time each user
process has had RECENTLY"
i did the following: i introduced the following variables in proc.c:
clock_t recent_time[NR_TASKS + NR_PROCS], stopwatch;
all elements are zeroed out in main()
then, every time pick_proc() is called, this is done (right at the
start):
realtime = get_uptime();
recent_time[proc_ptr->p_nr + NR_TASKS] = realtime - stopwatch;
stopwatch = realtime;
then, the next task (if ready) is picked round-robin-wise
if no task is ready, that process is picked which has the lowest corresponding value in recent_time[]
i'm not sure that's what is mean with the exercise
ill be happy to read what you think
thanx,
martin
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 294 |
Nodes: | 16 (2 / 14) |
Uptime: | 243:36:48 |
Calls: | 6,626 |
Calls today: | 2 |
Files: | 12,175 |
Messages: | 5,320,257 |