Scheduling: Types of scheduling: Preemptive, Non preemptive, Scheduling algorithms: FCFS, SJF, RR.

Process Scheduling

Edit

Q.  Explain process scheduling. What are different performance criteria for process scheduling .    -------   - 6 mark

Process scheduling is a fundamental function of operating system. A scheduler is an operating system program that selects the next job to be admitted for execution. There are performance criteria that are frequently used by scheduler to maximize system performance.

1) Throughput :- Maximum number of processes served per unit time. It must be high.
2) CPU Utilization :- CPU must be busy for maximum time.
3) Turnaround Time :- Turnaround time is time start from process submission to completion of process.

 Turnaround Time = Finish Time – Arrival Time

 4) Waiting Time :- It should be minimum.           

            Waiting Time = Turnaround Time – CPU Time

5) Response Time :- It is the time from the submission of a request until the first response is produced.
6) Priority :- The scheduler should favor higher priority process.

Process Scheduling Algorithms

Edit

Q.        Explain different types of scheduling algorithms in brief.  --------  4 mark

Ans :- The Scheduling policy determines when it is time for process to be removed from the CPU and which ready process should be allocated the CPU next. CPU scheduling is divided into two types.

  1. Preemptive Scheduling
  2. Non Preemptive Scheduling

a) Preemptive Scheduling :- Cooperative scheduling .

    A scheduling method that interrupts the processing of a process and transfers the CPU to another process is called a preemptive CPU scheduling. The running process will switch to ready state and new process will come from ready to running state. A process can be temporarily suspended due to:

1) Request for I/O.                  2) Time slab is over.

b) Non Preemptive Scheduling :- Non cooperative scheduling.

Non- Preemptive operation usually proceeds towards completion uninterrupted. Once the system has assigned a processor to a process, the system cannot remove that processor from the process.

Q.        Differentiate Preemptive and non preemptive scheduling.

Sr. No.Preemptive Scheduling  Non Preemptive Scheduling
i)It is cooperative scheduling It is non cooperative scheduling
ii)It is process gives control to other process completion.One process complete itself and then give    before its controls to other process.
iii)It increases the cost and it has higher overhead.It does not increases cost and it has less overhead.
iv)It is more complex.It is simple.
v)EfficientNon efficient
vi)Ex. Round Robin scheduling methodEx. First Come First Serve (FCFS), SJF ( Shortest Job First )     

Q.  Explain following CPU scheduling techniques with examples : FCFS, SJF and Round Robin Algorithm. ----------- 6 marks

Ans:- FCFS (First Come First Serve ) – It is non preemptive scheduling. It is one of the simplest scheduling algorithm

 FCFS (First Come First Serve )

In FCFS jobs are executed in order of their arrival. As from figure it is clear that P1, P2 and P3 are executed in sequence first P1 is completed, then P2 and lastly P3 will be completed. Average turn around time and waiting time are very high.

SJF ( Shortest Job First ) :- In shortest job first (Non Preemptive Scheduling ) selected for execution. If two processes have the same CPU time, FCFS is used. Consider the following example of three process : Using SJF we will get

SJF ( Shortest Job First )

Initially P3 will be completed for 2, then P2 for – 4 and lastly P1 = 6.

SJF will be optimal scheduling algorithm in terms of minimizing. i) Average turnaround time. ii) Average waiting time.

Round Robin Scheduling :- It is used in time sharing system. It provides good response time. In RRS the CPU time is divided in slices of time ( Quantum ) Each process is given one time slice for which CPU is allocated to process for execution. Consider following example with time slice = 2

Using RRS we will get

Round Robin Scheduling

Round Robin scheduling utilize the system resources in an equitable manner. Small processes may be executed in a single time slice giving good response time where as long processes may require several time slices. It is preempitative scheduling.

References

Edit
  • WikiNote Foundation

Last modified: Friday, 20 September 2019, 1:23 AM