Cpu Scheduling
Cpu Scheduling
SCXVCVSS
2024 SE
SUBJECT: COMPUTER
SCIENCE
CPU SCHEDULING
SUBMITTED BY
Scheduling of processes/work is done to finish the work on time.
CPU Scheduling is a process that allows one process to use the CPU while another process
is delayed (in standby) due to unavailability of any resources such as I / O etc, thus making
full use of the CPU. LAB:8
The purpose of CPU Scheduling is to make the system more efficient,
faster, and fairer.
SUBMISSION DATE: 25th nov
CPU scheduling is a key part of how an operating system works.
COURSE:OPERATING
It decides which task SYSTEM
(or process) the CPU should work on at any given time.
This is important because a CPU can only handle one task at a time, but there are usually
many tasks that need to be processed. In this article, we are going to discuss CPU
scheduling in detail.
Whenever the CPU becomes idle, the operating system must select one of the processes in
the line ready for launch. The selection process is done by a temporary (CPU) scheduler.
The Scheduler selects between memory processes ready to launch and assigns the CPU to
one of them.
from running state to ready state or from the waiting state to the ready state.
process terminates , or when a process switches from running state to waiting state.
SCHEDULING ALGORITHMS
There is a lot of popularity for this Round Robin CPU Scheduling is because
Round Robin works only in Pre Emptive state. This makes it very reliable.
IMPORTANT ABBREVIATIONS
1. CPU - - - > Central Processing Unit
2. AT - - - > Arrival Time
3. BT - - - > Burst Time
4. WT - - - > Waiting Time
5. TAT - - - > Turn Around Time
6. CT - - - > Completion Time
7. FIFO - - - > First In First Out
8. TQ - - - > Time Quantum
Round Robin CPU Scheduling uses Time Quantum (TQ). The Time Quantum is something
which is removed from the Burst Time and lets the chunk of process to be completed.
Each step of this algorithm is carried out cyclically. The system defines a specific time slice,
known as a time quantum.
working
First, the processes which are eligible to enter the ready queue enter the ready queue.
After entering the first process in Ready Queue is executed for a Time Quantum chunk of
time. After execution is complete, the process is removed from the ready queue.
Even now the process requires some time to complete its execution, then the process is added
to Ready Queue.
The Ready Queue does not hold processes which already present in the Ready Queue. The
Ready Queue is designed in such a manner that it does not hold non unique processes.
After, the process execution is complete, the Ready Queue does not take the completed
process for holding.
ADVANTAGES
The Advantages of Round Robin CPU Scheduling are:
1. Low Operating System slicing times will result in decreased CPU output.
2. Round Robin CPU Scheduling approach takes longer to swap contexts.
3. Time quantum has a significant impact on its performance.
4. The procedures cannot have priorities established.
EXAMPLE:
1 P1 0 7
2 P2 1 4
3 P3 2 15
4 P4 3 11
5 P5 4 20
6 P6 4 9
Ready Queue:
1. P1, P2, P3, P4, P5, P6, P1, P3, P4, P5, P6, P3, P4, P5
Gantt chart:
AVERAGE COMPLETION TIME
CODE
import java.util.*;
// Start scheduling
rr.schedule();