What is CPU Scheduling? 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. The aim of CPU scheduling is to make the system efficient, fast and fair. Whenever the CPU becomes idle, the operating system must select one of the processes in the ready queue to be executed. The selection process is carried out by the short-term scheduler (or CPU scheduler). The scheduler selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them.
Types of CPU Scheduling CPU scheduling decisions may take place under the following four circumstances: When a process switches from the running state to the waiting state(for I/O request or invocation of wait for the termination of one of the child processes). When a process switches from the running state to the ready state (for example, when an interrupt occurs). When a process switches from the waiting state to the ready state(for example, completion of I/O). When a process terminates .
Types : Preemptive Scheduling The scheduling in which a Running program can be interrupted if a high priority process enters the queue & is allocated to the CPU is called “ Preemptive Scheduling”. Non- Preemptive Scheduling : The scheduling in which a Running program Cannot be interrupted by any other process is called “Non- Preemptive Scheduling”.
Scheduling Algorithms First Come First Serve(FCFS) Scheduling Shortest-Job-First(SJF) Scheduling Priority Scheduling Round Robin(RR) Scheduling
Process Scheduling solution Process Burst Time P 1 9 P 2 33 P 3 2 P 4 5 P5 14 Suppose that the processes arrive in the order: P 1 , P 2 , P 3, P 4 .P 5.
1. FCFS
2. SJF
3. Priority Scheduling
3. RR (Round Robin ) Quantum = 8 :
Multiple processor scheduling. Multiprocessor scheduling can be used when processes are related to one another. Scheduling two or more than two threads at the same time across multiple central processing units is called as space sharing.
Real-time-scheduling A real Time scheduling intented to serve real-time-application requests.it must be able to process data as it comes in, typically without buffering delays.Processing time requirements ( including any os delay ) are measured in shorter. Determines the order of real time task executions. Highest priority process runs first. Real time scheduling is one of the most active areas of research in computer Science.