CPU scheduling is a process which allows one process to use the CPU while the execution of another process is on hold(in waiting state) due to unavailability of any resource like I/O etc, thereby making full use of CPU. The aim of CPU scheduling is to make the system efficient, fast and fair.


Scheduling Criteria

There are many different criterias to check when considering the "best" scheduling algorithm :
  • CPU utilizationTo make out the best use of CPU and not to waste any CPU cycle, CPU would be working most of the time(Ideally 100% of the time). Considering a real system, CPU usage should range from 40% (lightly loaded) to 90% (heavily loaded.)
  • ThroughputIt is the total number of processes completed per unit time or rather say total amount of work done in a unit of time. This may range from 10/second to 1/hour depending on the specific processes.
  • Turnaround timeIt is the amount of time taken to execute a particular process, i.e. The interval from time of submission of the process to the time of completion of the process(Wall clock time).
  • Waiting timeThe sum of the periods spent waiting in the ready queue amount of time a process has been waiting in the ready queue to acquire get control on the CPU.
  • Load averageIt is the average number of processes residing in the ready queue waiting for their turn to get into the CPU.
  • Response timeAmount of time it takes from when a request was submitted until the first response is produced. Remember, it is the time till the first response and not the completion of process execution(final response).
In general CPU utilization and Throughput are maximized and other factors are reduced for proper optimization.

Scheduling Algorithms

We'll discuss four major scheduling algorithms here which are following :
  1. First Come First Serve(FCFS) Scheduling
  2. Shortest-Job-First(SJF) Scheduling
  3. Priority Scheduling
  4. Round Robin(RR) Scheduling
  5. Multilevel Queue Scheduling

First Come First Serve(FCFS) Scheduling

  • Jobs are executed on first come, first serve basis.
  • Easy to understand and implement.
  • Poor in performance as average wait time is high. 

Shortest-Job-First(SJF) Scheduling

  • Best approach to minimize waiting time.
  • Actual time taken by the process is already known to processor.
  • Impossible to implement.

In Preemptive Shortest Job First Scheduling, jobs are put into ready queue as they arrive, but as a process with short burst time arrives, the existing process is preempted.

Priority Scheduling

  • Priority is assigned for each process.
  • Process with highest priority is executed first and so on.
  • Processes with same priority are executed in FCFS manner.
  • Priority can be decided based on memory requirements, time requirements or any other resource requirement.

Round Robin(RR) Scheduling

  • A fixed time is allotted to each process, called quantum, for execution.
  • Once a process is executed for given time period that process is preemptied and other process executes for given time period.
  • Context switching is used to save states of preemptied processes.

Multilevel Queue Scheduling

  • Multiple queues are maintained for processes.
  • Each queue can have its own scheduling algorithms.
  • Priorities are assigned to each queue.

1 comment:

  1. Solved: Why Solved In The Casino - Jordan15
    Solved. When where to buy air jordan 18 retro men you try air jordan 18 retro men red for sale a gambling game, the dealer does not have a chance of how can i find air jordan 18 retro men winning and you cannot win or lose. You need to make how to get air jordan 18 stockx a bet to win 토토사이트 넷마블

    ReplyDelete