0% found this document useful (0 votes)
20 views27 pages

Chapter-3 New

os
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views27 pages

Chapter-3 New

os
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

PROCESSES

Learning Outcomes:
1. To introduce the notion of a process – a
program in execution, which forms the basis of
all computation.
2. To describe the various features of processes,
including scheduling, creation, and termination.
3. To explore interprocess communication using
shared memory and message passing.
4. To describe communication in client-server
systems.
Topics:
• Process Concepts
• Process Scheduling
• The fork() System Call
• CPU Scheduling algorithms
• Scheduling Algorithms
• Round Robin Scheduling Algorithms
CPU Scheduling Algorithms
Basic Concepts
• CPU scheduling is the basis of
multiprogrammed operating systems.
• The objective of multiprogramming is
to have some process running at all
times, to maximize CPU utilization.
CPU Scheduling Algorithms
1. When a process switches from the
running state to the waiting state (for
example, I/O request, or invocation of
wait for the termination of one of the
child processes)
2. When a process switches from the
running state to the ready state (for
example, when an interrupt occurs)
CPU Scheduling Algorithms
3. When a process switches from the
waiting state to the ready state (for
example, completion of I/O)
4. When a process terminates
CPU Scheduling Algorithms
Two main types of CPU Scheduling:
1. Preemptive
2. Non-preemptive
CPU Scheduling Algorithms
Dispatcher
• is the module that gives control of the
CPU to the process selected by the
short-term scheduler.
• Manage actual switching of the CPU
from one process to another.
CPU Scheduling Algorithms
• Switching context
• Switching to user mode
• Jumping to the proper location in
the user program to restart that
program
CPU Scheduling Algorithms
Scheduling Criteria
1. CPU utilization
2. Throughput
3. Turnaround time
4. Waiting time
5. Response time
CPU Scheduling Algorithms
1. CPU Utilization
• Ratio of time the CPU is actively
executing a process to the total time
• May range from 0 – 100 percent
• In real system, it should range 40 – 90
percent.
CPU Scheduling Algorithms
CPU Utilization Formula:

CPU Utilization (%) = (CPU Time Busy /


Total CPU Time) * 100
CPU Scheduling Algorithms
Example :
Suppose you have a CPU that is busy
executing a process 80% of the time in a
given period. What does it indicate? Is it
desirable?
CPU Scheduling Algorithms
2. Throughput
• Number of processes completed within
a given time frame
• Measures how many processes a
scheduling algorithm can execute per
unit of time.
CPU Scheduling Algorithms
Throughput Formula:

Throughput = Total Work Processed /


Time
CPU Scheduling Algorithms
Example:
If a scheduling algorithm can complete
100 processes in an hour, its throughput is
_______ processes per hour. What does it
indicates?
CPU Scheduling Algorithms
3. Turnaround time
• Total time taken to execute a process,
including both waiting time and
execution time
• Measures the time from process arrival
to its completion
• Interval from the time of submission of
a process to the time of completion
CPU Scheduling Algorithms
Turnaround time Formula:
Turnaround Time = Completion Time -
Arrival Time

Turnaround Time = Waiting Time +


Execution Time
CPU Scheduling Algorithms
Example:
If a process arrives at 2:00 p.m. and
completes at 2:30 p.m, its turnaround
time is _______ minutes. What does it
indicates?
CPU Scheduling Algorithms
4. Waiting Time
• is the total time a process spends
waiting in the ready queue before it
gets CPU time for execution
• It does not include the time spent
executing on the CPU
CPU Scheduling Algorithms
Waiting Time Formula:

Waiting Time = Turnaround Time - Burst


Time
*Burst Time is the amount of time it takes a
process to complete execution once it is
scheduled to run on the CPU.
CPU Scheduling Algorithms
Example:
If a process arrives at 2:00 PM, gets CPU
time at 2:15 PM, and completes at 2:30
PM, its waiting time is _____ minutes.
CPU Scheduling Algorithms
5. Response Time
• Measures the time it takes for a system
to respond to an input or request.
• Measures the time from the submission
of a request until the first response is
produced
CPU Scheduling Algorithms
Response Time Formula:

Response Time = Time of First Response -


Time of Request Submission or Initiation
CPU Scheduling Algorithms
Example:
Suppose you are using a web application and you click
on a link to load a webpage. The moment you click
the link is the "Time of Request Submission or
Initiation," and the time when the webpage starts to
appear on your screen is the "Time of First
Response." We want to calculate the response time.
Here are the timestamps for the scenario:
Time of Request Submission or Initiation: 3:00 PM
Time of First Response: 3:02 PM
CPU Scheduling Algorithms
Summary:
It is desirable to maximize the CPU
utilization and throughput, and minimize
turnaround time, waiting time and
response time.

You might also like