Process Scheduling and Synchronization are two core concepts in operating systems that ensure efficient CPU usage and safe execution of multiple processes.
Process
scheduling is a crucial function of the operating
system that manages the execution of processes by the CPU. It involves
selecting which process will run at any given time, ensuring efficient use of
CPU resources and maintaining system responsiveness.
Process synchronization ensures that
multiple processes accessing shared resources do so in a controlled manner,
preventing race conditions, data inconsistency, and deadlocks.
Synchronization is especially critical in multi-processing
environments where processes may be cooperative or competitive.
Process Scheduling
Process scheduling decides which
process gets the CPU and for how long.
Goals
- Maximize CPU utilization
- Minimize waiting time
- Ensure fairness (impartial)
- Improve response time
Types of Scheduling
1. Long-Term Scheduling
- Decides which processes are admitted to the
system
- Controls degree of multiprogramming
2. Short-Term Scheduling
(CPU Scheduler)
- Selects process from ready queue
- Runs very frequently
3. Medium-Term Scheduling
- Suspends/resumes processes (swapping)
CPU Scheduling:
CPU scheduling is the method
an operating system uses to decide which process in the ready
queue gets CPU time. Since a CPU can execute only one process at a time,
efficient scheduling is crucial to maximize CPU utilization, minimize
waiting time, and improve throughput.
Scheduling Criteria

The scheduling criteria in CPU scheduling include:
CPU Utilization: The goal is to keep the CPU as busy as possible.
Throughput: The number of processes that complete their execution per time unit.
Turnaround Time: The total time taken from submission to completion of a process.
Waiting Time: The total time a process has been in the ready queue.
Response Time: The time from submission of a request until the first response is produced.
These criteria help in analyzing and prioritizing tasks for efficient CPU scheduling.
(Throughput, Turnaround Time,
Waiting Time)
1. CPU utilization: The main objective of any CPU scheduling algorithm is to
keep the CPU as busy as possible. Theoretically, CPU utilization can range from
0 to 100 but in a real-time system, it varies from 40 to 90 percent
depending on the load upon the system.
2. Throughput: A measure of the work done by the CPU is the number of
processes being executed and completed per unit of time. This is called
throughput. The throughput may vary depending on the length or duration of the
processes.
3. Turnaround Time: For a particular process, an important criterion is how
long it takes to execute that process. The time elapsed from the time of
submission of a process to the time of completion is known as the turnaround
time. Turn-around time is the sum of times spent waiting to get into memory,
waiting in the ready queue, executing in CPU and waiting for I/O.
Turn Around
Time = Completion Time - Arrival Time. (The arrival time refers to the moment in
time when a process enters the ready queue and is
awaiting execution by the CPU.)
4. Waiting Time: A scheduling algorithm does not affect the time required
to complete the process once it starts execution. It only affects the waiting
time of a process i.e. time spent by a process waiting in the ready
queue.
Waiting Time
= Turnaround Time - Burst Time. (Burst time, also referred to as “execution
time”. It is the amount of CPU time the process requires to complete its
execution. It is the amount of processing time required by a process to execute
a specific task or unit of a job.)
5. Response Time: In an interactive system, turn-around time is not the
best criterion. A process may produce some output fairly early and continue
computing new results while previous results are being output to the user. Thus,
another criterion is the time taken from submission of the process of the
request until the first response is produced. This measure is called response
time.
Response Time
= CPU Allocation Time (when the CPU was allocated for the first) - Arrival Time
6. Completion Time: The completion time is the time when the process stops
executing, which means that the process has completed its burst time and is
completely executed.
7. Priority: If the operating system assigns priorities to processes,
the scheduling mechanism should favour the higher-priority processes.
8. Predictability: A given process always should run in about the same
amount of time under a similar system load.
No comments:
Post a Comment