English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories
0

Suppose that a scheduler has k ready processes at time 0, and that no new processes are created after time 0. Process i (0 < i <= k) requires i units of computing time. For a preemptive, round-robin scheduler with a scheduling quantum of one time unit, what is the mean response time for these processes? For a non-preemptive, shortest-job-first scheduler, what is the mean response time for these processes? (If you have trouble doing this for arbitrary k, try it for a small fixed value of k, such as k = 3.) If one of these schedulers has a lower mean response time than the other, does that mean that it is a better scheduler? Why or why not?

2006-06-09 21:38:17 · 1 answers · asked by lonely 4 ever 2 in Computers & Internet Programming & Design

1 answers

For this type of question is fairly straight forward....
For a SJF (shortest job first ) You place in your queue the jobs, and to calculate the mrt, you need to count the time intervals for each scheduler. So if K =3 where we have processes coming at times 5 1 7, we do 1 5 7 so our mrt will depend on the arrival time and the actuall execution time. but if they arrive at the same instant then we can just do 1 + 5 + 7 / 3. But most likely they don't arrive once you use them. So you just do basic math.

So how does FCFS (first come first serve) work?
When a process arrives, it is put at the end of the ready queue
The running process runs until its CPU burst is finished. But at the same time it isn't preemptive.

So how does SJF (shortest job frst) work?
Associate with each process the length of its next CPU burst. Use these lengths to schedule the process with the shortest time.

We usually use two schemes:
1 - nonpreemptive – once CPU given to the process it cannot be preempted until completes its CPU burst
2 - preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt.

Round Robin in the other hand...
Each process gets small unit of CPU Time which we can call quantim time. It is like small bursts of 10 -100ms (we can say) After that time has finished... The process in preempted and added to the end of the ready queue.

So lets say we have k processes in the ready queue and the quantum is q then each process gets 1/k of the CPU time in chunks of at most q time units at once.

So if the perfomance of quantium is large then we use FCFS else we use context switching .

It does not necessarily mean its a better scheduler.. Maybe it is a better scheduler for that burst sequence. But typically if you take the average you would know the best case. Usually the best case would be lowere response time for a overall case.

Pheww... Time for my movie :p
Good Luck

2006-06-16 16:52:13 · answer #1 · answered by ? 6 · 0 1

fedest.com, questions and answers