0% found this document useful (0 votes)
2 views80 pages

Process Scheduling and Threads Overview

The document covers the concepts of processes and process scheduling in operating systems, detailing process states, scheduling algorithms (both preemptive and non-preemptive), and the operations performed on processes. It also discusses threads, their definitions, types, and the advantages of multithreading, emphasizing the relationship between user and kernel threads. Key scheduling criteria such as throughput, turnaround time, waiting time, response time, and CPU utilization are outlined, along with various scheduling algorithms like FCFS, SJF, and Round Robin.

Uploaded by

uncoiledjam
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)
2 views80 pages

Process Scheduling and Threads Overview

The document covers the concepts of processes and process scheduling in operating systems, detailing process states, scheduling algorithms (both preemptive and non-preemptive), and the operations performed on processes. It also discusses threads, their definitions, types, and the advantages of multithreading, emphasizing the relationship between user and kernel threads. Key scheduling criteria such as throughput, turnaround time, waiting time, response time, and CPU utilization are outlined, along with various scheduling algorithms like FCFS, SJF, and Round Robin.

Uploaded by

uncoiledjam
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

OPERATING SYSTEM (CSC404)

Dr. Arundhati Das


Module-II: Process and Process Scheduling

2.1 Concept of a Process, Process States, Process Description, Process Control Block
2.2 Uniprocessor Scheduling-Types: Preemptive and Non-preemptive scheduling
algorithms (FCFS, SJF, SRTN, Priority, RR)
2.3 Threads: Definition and Types, Concept of Multithreading
→ New state: processes in Sec. Mem.; Ready, Wait states: process in Main Mem.; Running
state: Process is in CPU.
Module-II: Process and Process Scheduling

2.2 Uniprocessor Scheduling-Types: Preemptive and Non-preemptive scheduling


algorithms (FCFS, SJF, SRTN, Priority, RR)
SCHEDULING CRITERIA:
[Link]: how many jobs are completed by the cpu
with in a time period.
2. Turn around time : The time interval between the
submission of the process and time of the completion is
turn around time.
TAT = Waiting time in ready queue + executing time +
waiting time in waiting queue for I/O.
3. Waiting time: The time spent by the process to wait for
cpu to be allocated.
4. Response time: Time duration between the submission
and first response.
5. Cpu Utilization: CPU is costly device, it must be kept as
busy as possible. Eg: CPU efficiency is 90% means it is busy
for 90 units, 10 units idle.
CPU Scheduling algorithms: categorization
CPU SCHEDULING

Pre Emptive Non Preemptive

First Come First Shortest Job Priority


Round Robin Served First Scheduling
Priority
Scheduling Scheduling
Shortest
Remaining Time
First
Example: Priority scheduling
When Arrival time (AT)
is not given, assume all
arrived at the same
time 0
Operation on a Process
• The execution of a process is a complex activity. It
involves various operations. Following are the
operations that are performed while execution of a
process:
The following are the operations on processes:
1. Creation
2. Scheduling/Dispatching
3. Blocking
4. Preemption
5. Termination
Creation
• This is the initial step of process execution activity.
• Process creation means the construction of a new
process for the execution. This might be performed by
system, user or old process itself.
• There are several events that leads to the process
creation.
• Some of the such events are following:
➢ When we start the computer, system creates
several background processes.
➢ A user may request to create a new process.
➢ A process can create a new process itself while
executing.
Scheduling/Dispatching
• The event or activity in which the state of the process
is changed from ready to running.
• It means the operating system puts the process from
ready state into the running state.
• Dispatching is done by operating system when the
resources are free or the process has higher priority
than the ongoing process.
• There are various other cases in which the process in
running state is preempted and process in ready state
is dispatched by the operating system
Blocking
• When a process invokes an input-output system call
that blocks the process, operating system will put it in
block mode.
• Block mode is basically a mode where process waits
for input-output.
• Hence on the demand of process itself, operating
system blocks the process and dispatches another
process to the processor.
• Hence, in process blocking operation, the operating
system puts the process in ‘waiting’ state
• Preemption: When a timeout occurs that means the
current running process hadn’t been terminated in
the allotted time interval and next process is ready to
execute, then the operating system preempts the
process.
• This operation is only valid where CPU scheduling
supports preemption.
• Basically this happens in priority scheduling, SRTF and
round robin where the ongoing process is pre-
empted.
• Hence, in process preemption operation, the
operating system puts the process in ‘ready’ state
Termination
• Process termination is the activity of ending the process.
• In other words, process termination is the relaxation of
computer resources taken by the process for the
execution.
• Like creation, in termination also there may be several
events that may lead to the process termination. Some of
them are:
➢Process completes its execution fully and it indicates to
the OS that it has finished.
➢Operating system itself terminates the process due to
service errors.
➢There may be problem in hardware that terminates the
process.
➢One process can be terminated by another process.
Module-II: Process and Process Scheduling

2.3 Threads: Definition and Types, Concept of Multithreading


Threads
and
Multithreading models.
• A thread is called a lightweight process.

• A thread of execution is the smallest sequence of programmed instructions that can be


managed independently by a scheduler.

• Threads provide a way to improve application performance through parallelism.

• Threads represent a software approach to improving performance of operating system by


reducing the overhead.

• Each thread belongs to exactly one process and no thread can exist outside a process. Each
thread represents a separate flow of control.
Advantages:

Threads
Why multithreaded process?
There must be a relationship between user threads and kernel threads
as so that both the types of threads can function together whenever an
application runs which needs both user interactions and system
resources of OS. Multithreading models establish this relationship.
Many-to-many model overcomes all the
limitations of the prior models and
considered best among the multithreading
models.
Numericals/examples done on Board
• All cpu scheduling and other examples done on board are import.

• END

You might also like