13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

46 Time Management Chapter 2Process Arrival Service Finish T M Pname time required time A 0 3 4 4 1 1.3 B 1 5 10 9 4 1.8 C 3 2 9 6 4 3.0 D 9 5 15 6 1 1.2 E 12 5 20 8 3 1.6Mean 6.6 2.6 1.792.8 Hybrid methodsAll sorts of methods can be invented by combining ones that we have mentioned. Hereare some examples.(1) Use FB up to a fixed number z of quanta; then use FCFS for the last queue. Thismethod reduces the number of process switches for very long processes.(2) Use RR up to some number of quanta. A process that needs more time is put in asecond run queue that is treated with SRR scheduling. Very long processes areeventually placed in a third queue that uses FCFS. RR could have absolutepredence over SRR, which has precedence over FCFS, or each could have a fixedpercentage of total time.2.9 State-dependent priority methodsThese three methods adjust parameters based on the current state.(1) Use RR. However, instead of keeping the quantum constant, adjust it periodically,perhaps after every process switch, so that the quantum becomes q/n,where n is the size of the ready list. If there are very few ready processes, eachgets a long quantum, which avoids process switches. If there are very many, thealgorithm becomes more fair for all, but at the expense of process switching.Processes that need only a small amount of time get a quantum, albeit a smallone, fairly soon, so they may be able to finish soon. The quantum should not beallowed to drop below some given minimal value so that process switching doesnot start to consume undue amounts of time.(2) Give the current process an extra quantum whenever a new process arrives. Theeffect of this gift is to reduce process switching in proportion to the level ofsaturation.(3) Some versions of Unix use the following scheduling algorithm. Every second aninternal priority is calculated for each process. This priority depends on theexternal priority (set by the user) and the amount of recent time consumed. This

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!