CPU Scheduling - STUDY NOTES

Post Top Ad

CPU Scheduling




The scheduling done by CPU on the basis of multi programmed operating system.

Types of schedulers

     1.     Long term scheduler: -     When the program is not in its running mode it is usually stored in secondary storage device, when a request is made to execute a program it is long term scheduler which picks the program from secondary storage and send it to the ready queue mentioned in primary memory.

     2.     Short term scheduler:-      The short term scheduler pick a program from a ready queue and send it to its execution mode by allocating the processor to it.

     3.     Medium term scheduler: -     When a process is blocked or suspended it is recommended to free the memory space occupied by the blocked process. This task is performed by the medium term scheduler which swaps the process out of the primary memory and send it back to the secondary storage device. When the suspended condition of the process is over it is medium term scheduler which reallocate the memory space to that program and send it to the ready queue.

Types of scheduling

The scheduling algorithms use in operating system can be categorized in the following two types: -

     1.    Non preemptive scheduling: -     In such scheduling the processor is not de-allocated from process until it gets terminated, when a process in such scheduling algorithm started its execution it will not be suspended or even suspended the processor will not be allocated to some other process.

     2.    Preemptive scheduling: -     In such scheduling when a process is blocked/suspended for any reason the processor will be allocated to other process.  When the suspended condition is over then the processor is reallocated to that process, if the CPU is busy then this process need to wait for its next term.


Types of scheduling algorithm

     1.     First come first serve (FCFS) scheduling algorithm: -     FCFS scheduling algorithm is non preemptive. Once the CPU has been given to a process, that process keeps the CPU until it release it by terminating or by requesting input/output devices. This algorithm is suitable for batch processing but not suitable for time sharing system. The average waiting time under policy is often long.

     2.     Shortest job first (SJF) scheduling algorithm: -     This algorithm arranges the process according to the length of the CPU burst. When CPU is available it is assigned to the process that has the smallest CPU burst. If the length of CPU burst is same for two process then FCFS scheduling algorithm is followed.      This algorithm is considered to be an optimal algorithm as it gives the minimum average waiting time.
      This algorithm may be either preemptive or non preemptive. The choice arises when a new process arrives in the ready queue while a previous process is executing.

     3.     Round-Robin scheduling algorithm: -     The RR scheduling algorithm is designed especially for time sharing system. It is similar to FCFS scheduling algorithm but preemption is added to switch between processes.

     4.     Shortest remaining time first (SRTF) scheduling algorithm: -     This scheduling algorithm works similar to that of shortest job first, as preference will be given to the process having least CPU time. But the difference here is that SRTF is preemptive version of SJF, that means on arrival of a new process with less CPU time, currently executing process may be suspended whereas in SJF the new process will be executed after completion of currently executing process.

     5.     Priority based scheduling (PBS): -     1.     In this scheduling algorithm each of the processes in ready queue has a certain priority value, the process with the highest priority value will be executed first and the one with the least priority value will be executed at last. In case two or more processes having equal priority value then they will be processed on the basis of FCFS scheduling algorithm.



     For detailed information download PDF

     Downloading link are below

No comments:

Post a Comment

Post Bottom Ad