Two-level scheduling: Difference between revisions

Content deleted Content added
Cleanup and tagged as a stub.
the former version implied in the second paragraph, that round-robin would choose randomly which is plain non-sense. as a consequence the probability given was wrong.
Line 3:
Consider this problem: A system contains 50 running processes all with equal priority. However, the system's [[computer storage|memory]] can only hold 10 processes in memory simultaneously. Therefore, there will always be 40 processes swapped out written on [[virtual memory]] on the [[hard disk]]. The time taken to swap out and swap in a process is 50 ms respectively.
 
With straightforward [[Round-robin scheduling]], every time a [[context switch]] occurs, therea process would beneed anto 80%be probabilityswapped in (40/50,because ifonly itthe chooses10 randomlyleast amongrecently theused processes are swapped in). thatChoosing arandomly processamong the processes would needdiminish tothe beprobability swappedto in80% (40/50). If that occurs, then obviously a process also need to be swapped out. Swapping in and out of memory is costly, and the scheduler would waste much of its time doing unneeded swaps.
 
That is where two-level scheduling enters the picture. It uses two different schedulers, one '''lower-level scheduler''' which can only select among those processes in memory to run. That scheduler could be a Round-robin scheduler. The other scheduler is the '''higher-level scheduler''' whose only concern is to swap in and swap out processes from memory. It does its scheduling much less often than the lower-level scheduler since swapping takes so much time.