SlideShare a Scribd company logo
MODULE 2
PROCESSES
Module 2
● Processes
● Process states, Process control block, Threads, Scheduling
● Operations on processes
● Process creation and termination
● Inter-process communication
● Shared memory systems
● Message passing systems
● Process Scheduling
● Basic concepts, Scheduling criteria
● Scheduling Algorithms
● First come First Served
● Shortest Job First
● Priority scheduling
● Round robin scheduling
Objectives
● To introduce the notion of a process -- a program in execution, which forms the
basis of all computation
● To describe the various operations on process
● To explore inter-process communication using shared memory and message
passing
● To introduce CPU scheduling, which is the basis for multi-programmed
operating systems
● To describe various CPU-scheduling algorithms
PROCESS BASICS
Process
● Process – a program in execution
Process
● Process – a program in execution
● Process execution must progress in sequential fashion
● Program is passive entity stored on disk (executable file), process
is active entity.
● Program becomes process when executable file loaded into
memory
● Execution of program started via GUI mouse clicks, command
line entry of its name, etc
Process Concept(cont.)
● Process in main memory consist of multiple parts
● Text section containing the program code
● Data section containing global and static
variables
● Stack containing temporary data
Function parameters, return addresses, local
variables
● Heap containing memory dynamically allocated
during run time (managed via calls to new, delete,
malloc, free, etc.)
● Note that the stack and the heap start at opposite ends of the process's free space and grow towards
each other. If they should ever meet, then either a stack overflow error will occur, or else a call to
new or malloc will fail due to insufficient memory available.
Process State
● As a process executes, it changes state
● new: The process is being created
● running: Instructions are being executed
● waiting: The process is waiting for some event to occur
● ready: The process is waiting to be assigned to a processor
● terminated: The process has finished execution
Process Control Block (PCB)
❖ Each process is represented in the operating system by a PCB
❖ PCB holds the information associated with each process
❖ Also called task control block
❖ The process control block is kept in a memory area that is protected
from the normal user access.
❖ This is done because it contains important process information
Process Control Block (PCB)
PCB includes:
●Process state
●Process number – process id
●Program counter – address of next instruction to execute
●CPU registers – contents of all process-centric registers
●Memory management information – memory allocated to the
process
●List of open files
●CPU scheduling information- priorities, scheduling queue
pointers
●Accounting information – CPU used, clock time elapsed since
start, time limits
●I/O status information – I/O devices allocated to process
Process Scheduling
● The process scheduling is the activity of the OS that handles the
removal of the running process from the CPU and the selection of
another process on the basis of a particular strategy.
● Process scheduling is an essential part of a Multiprogramming
operating systems.
● Such operating systems allow more than one process to be
loaded into the executable memory at a time and the loaded
process shares the CPU using time multiplexing.
● Maximize CPU use, quickly switch processes onto CPU for time
sharing
● Process scheduler selects among available processes for next
execution on CPU
Scheduling Queues
● OS maintains scheduling queues of processes
● OS maintains a separate queue for different process states and
PCBs of all processes in the same execution state are placed in
the same queue.
● When the state of a process is changed, its PCB is unlinked from
its current queue and moved to its new state queue.
● Different scheduling queues are:
● Job queue – set of all processes in the system. When a process
is created it is entered into job queue.
● Ready queue – set of all processes residing in main memory,
ready and waiting to execute
● Device queues – set of processes waiting for an I/O device
● Process migrate among various queues.
Queuing Diagram - Representation of Process
Scheduling
● Queueing diagram represents queues, resources, flows
Schedulers
● Schedulers are special system software which handle process
scheduling.
● Types of process schedulers:
● Short- term scheduler
● Long- term scheduler
● Medium- term scheduler
● Short-term scheduler (or CPU scheduler)
● Selects which process should be executed next and allocates CPU
● Short-term scheduler is invoked frequently (milliseconds) ⇒ (must
be fast)
Schedulers
● Long-term scheduler (or job scheduler)
● Selects which processes should be brought into the ready queue
● Long-term scheduler is invoked infrequently (seconds, minutes) ⇒ (may be
slow)
● The long-term scheduler controls the degree of multiprogramming (number
of processes in memory).
● Medium – term scheduler
● A running process may become suspended if it makes an I/O request. A
suspended processes cannot make any progress towards completion.
● In this condition, to remove the process from memory and make space for other
processes, the suspended process is moved to the secondary storage.
● Remove process from memory, store on disk, bring back in from disk to
continue execution: swapping
● Medium-term scheduler takes care of process swapping.
● Medium-term scheduler reduces the degree of multiprogramming.
Context Switch
● The process of storing the state of the old process and load the saved
state for the new process, when CPU switches to another process, is
called context switching
● This allows multiple processes to share a single CPU
● Essential feature of a multitasking operating system.
● Context of a process represented in the PCB
CPU Switch From Process to Process
●Context-switch time is overhead; the system does no useful work while
switching
● The more complex the OS and the PCB 🡺 the longer the context switch
Tutorial - 3
● Threads in Operating System
● Process vs Thread
OPERATIONS ON
PROCESSES
Operations on Processes
● Operations on processes are:
● process creation
● process termination
Process Creation
● Process creation means the construction of a new process for the
execution. This might be performed by system, user or old process
itself.
● Parent process create children processes, which, in turn create other
processes, forming a tree of processes
● Generally, process are identified and managed via a process identifier
(pid)
A Tree of Processes in Linux
Reading Activity – Page 114, para 3
Process Creation(Cont.)
● Resource (CPU time, memory, files, I/O devices) sharing options
● Parent and children share all resources
● Children share subset of parent’s resources
● Parent and child share no resources
● Execution options
● Parent and children execute concurrently
● Parent waits until children terminate
● Address space
● Child is a duplicate of parent(child has same program and data as
parent)
● Child process has a new program loaded into it
Process Creation (Cont.)
● UNIX examples
● fork()
● exec()
Fork () system call
● Creates new process
● Created process is called child process, which runs concurrently
with the process that makes the fork() call (parent process).
● After a new child process is created, both processes will execute the
next instruction following the fork() system call.
● Process IDs are different.
● A child process uses the same pc(program counter), same CPU
registers, same open files which use in the parent process.
Total Number of Processes created=
2n, where n is number of fork system
calls
Fork () system call
● It takes no parameters
● Returns an integer value.
● Negative Value - creation of a child process was unsuccessful.
● Zero: Returned to the newly created child process.
● Positive value: Returned to parent or caller. The value contains
process ID of newly created child process.
exec () system call
● exec() system call used after a fork() to replace the process
memory space with a new program
#include<string.h>
#include<sys/types.h>
#include<sys/wait.h>
int main()
{
int status;
int childpid;
int pid_child;
if((childpid =fork())==-1)
{
printf("nCant forkn");
}
else if(childpid==0)
{
execl("/bin/ls","ls",NULL);
printf("n I am the child with
pid=%d",getpid());
exit(0);
}
else
{
pid_child=wait(&status);
printf(“I am the parent with pid=%d",getpid());
printf("child with processid=%d compltely
successfullly ",pid_child);
}
return(0);
}
Process Termination
● Process executes last statement and then asks the operating
system to delete it using the exit() system call.
● Returns status data from child to parent (via wait())
● Process resources are deallocated by operating system
● Parent may terminate the execution of children processes using
the abort() system call. Some reasons for doing so:
● Child has exceeded allocated resources
● Task assigned to child is no longer required
● The parent is exiting and the operating systems does not
allow a child to continue if its parent terminates
Process Termination (cont.)
● The parent process may wait for termination of a child process by
using the wait()system call. The call returns status information
and the pid of the terminated process
pid = wait(&status);
● Some operating systems do not allow child to exists if its parent has
terminated. If a process terminates, then all its children must also
be terminated.
● cascading termination - All children, grandchildren, etc. are
terminated.
● The termination is initiated by the operating system.
Process Termination (cont.)
● Zombie process
● A zombie process is a process whose execution is completed but it still
has an entry in the process table.
● Once the parent process reads the child’s exit status, the zombie
process is eliminated from the process table.
● This is known as reaping the zombie process.
● Orphan process
● An orphan process is a process that is still executing, but whose
parent has died.
Other operations on process
● Process Blocking
● When a process invokes an input-output system call, OS blocks that
process
● Process Preemption
● When a timeout occurs (that means the 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.
Multiprocess Architecture – Chrome Browser
● Many web browsers ran as single process (some still do)
● If one web site causes trouble, entire browser can hang or crash
● Google Chrome Browser is multiprocess with 3 different types of
processes:
● Browser process manages user interface, disk and network I/O
● Renderer process renders web pages, deals with HTML,
Javascript. A new renderer created for each website opened
Runs in sandbox restricting disk and network I/O, minimizing
effect of security exploits
● Plug-in process for each type of plug-in
Reading Activity
INTERPROCESS
COMMUNICATION
Interprocess Communication
● Processes executing concurrently in the OS may be
● independent process
● cooperating process
● Independent process
● They cannot affect or be affected by other processes executing in
the system.
● Cooperating process
● The can affect or be affected by other processes, executing in the
system
● Any process that share data with other process is a cooperating
process
Interprocess Communication
● Interprocess communication(IPC) is the mechanism provided by
the operating system that allows processes to communicate with each
other
● Two models of IPC
● Shared memory
● In shared memory-memory model, a region of memory that is
shared by the cooperating process is established.
● Processes can then exchange information by reading and writing
data to the shared region.
● Message passing
● In message passing model, communication takes place by means
of exchanged messages between cooperating processes.
IPC Models
IPC using shared memory system
Producer-Consumer Problem
● To illustrate the concept of cooperating process, we can consider producer –
consumer problem, which is a common paradigm for cooperating processes
● Producer process produces information that is consumed by a consumer
process
● Compiler produces assembly code that is consumed by an assembler
● Assembler produces object modules that are consumed by the loader
● Web server provides HTML files and images that are consumed by web
browser.
● Assignment 2
IPC using message passing
Chapter 6: CPU Scheduling
Basic Concepts
Scheduling Criteria
Scheduling Algorithms
Thread Scheduling
Multiple-Processor Scheduling
Real-Time CPU Scheduling
Operating Systems Examples
Algorithm Evaluation
Objectives
To introduce CPU scheduling, which is the basis for multiprogrammed
operating systems
To describe various CPU-scheduling algorithms
To discuss evaluation criteria for selecting a CPU-scheduling
algorithm for a particular system
To examine the scheduling algorithms of several operating systems
Basic Concepts
Maximum CPU utilization obtained
with multiprogramming
CPU–I/O Burst Cycle – Process
execution consists of a cycle of CPU
execution and I/O wait
CPU burst followed by I/O burst
CPU burst distribution is of main
concern
Histogram of CPU-burst Times
CPU Scheduler
● Short-term scheduler selects from among the processes in
ready queue, and allocates the CPU to one of them
● Queue may be ordered in various ways
● CPU scheduling decisions may take place when a process:
1. Switches from running to waiting state
2. Switches from running to ready state
3. Switches from waiting to ready
4. Terminates
● Scheduling under 1 and 4 is nonpreemptive
● All other scheduling is preemptive
● Consider access to shared data
● Consider preemption while in kernel mode
● Consider interrupts occurring during crucial OS activities
Dispatcher
Dispatcher module gives control of the CPU to the process
selected by the short-term scheduler; this involves:
switching context
switching to user mode
jumping to the proper location in the user program to restart that
program
Dispatch latency – time it takes for the dispatcher to stop one
process and start another running
Scheduling Criteria
CPU utilization – keep the CPU as busy as possible
Throughput – # of processes that complete their execution per time
unit
Turnaround time – amount of time to execute a particular process
Waiting time – amount of time a process has been waiting in the
ready queue
Response time – amount of time it takes from when a request was
submitted until the first response is produced, not output (for time-
sharing environment)
Scheduling Algorithm Optimization Criteria
Max CPU utilization
Max throughput
Min turnaround time
Min waiting time
Min response time
First- Come, First-Served (FCFS) Scheduling
Process Burst Time
P1 24
P2 3
P3 3
Suppose that the processes arrive in the order: P1 , P2 , P3
The Gantt Chart for the schedule is:
Waiting time for P1 = 0; P2 = 24; P3 = 27
Average waiting time: (0 + 24 + 27)/3 = 17
FCFS Scheduling (Cont.)
Suppose that the processes arrive in the order:
P2 , P3 , P1
The Gantt chart for the schedule is:
Waiting time for P1 = 6; P2 = 0; P3 = 3
Average waiting time: (6 + 0 + 3)/3 = 3
Much better than previous case
Convoy effect - short process behind long process
Consider one CPU-bound and many I/O-bound processes
Shortest-Job-First (SJF) Scheduling
Associate with each process the length of its next CPU burst
Use these lengths to schedule the process with the shortest time
SJF is optimal – gives minimum average waiting time for a given set
of processes
The difficulty is knowing the length of the next CPU request
Could ask the user
Example of SJF
ProcessArriva l Time Burst Time
P1 0.0 6
P2 2.0 8
P3 4.0 7
P4 5.0 3
SJF scheduling chart
Average waiting time = (3 + 16 + 9 + 0) / 4 = 7
Determining Length of Next CPU Burst
Can only estimate the length – should be similar to the previous one
Then pick process with shortest predicted next CPU burst
Can be done by using the length of previous CPU bursts, using
exponential averaging
Commonly, α set to ½
Preemptive version called shortest-remaining-time-first
Prediction of the Length of the Next CPU Burst
Examples of Exponential Averaging
α =0
τn+1 = τn
Recent history does not count
α =1
τn+1 = α tn
Only the actual last CPU burst counts
If we expand the formula, we get:
τn+1 = α tn+(1 - α)α tn -1 + …
+(1 - α )j α tn -j + …
+(1 - α )n +1 τ0
Since both α and (1 - α) are less than or equal to 1, each successive
term has less weight than its predecessor
Example of Shortest-remaining-time-first
Now we add the concepts of varying arrival times and preemption to the
analysis
ProcessA arri Arrival TimeT Burst Time
P1 0 8
P2 1 4
P3 2 9
P4 3 5
Preemptive SJF Gantt Chart
Average waiting time = [(10-1)+(1-1)+(17-2)+5-3)]/4 = 26/4 = 6.5 msec
Priority Scheduling
A priority number (integer) is associated with each process
The CPU is allocated to the process with the highest priority (smallest
integer ≡ highest priority)
Preemptive
Nonpreemptive
SJF is priority scheduling where priority is the inverse of predicted next
CPU burst time
Problem ≡ Starvation – low priority processes may never execute
Solution ≡ Aging – as time progresses increase the priority of the
process
Example of Priority Scheduling
ProcessA arri Burst TimeT Priority
P1 10 3
P2 1 1
P3 2 4
P4 1 5
P5 5 2
Priority scheduling Gantt Chart
Average waiting time = 8.2 msec
Round Robin (RR)
Each process gets a small unit of CPU time (time quantum q),
usually 10-100 milliseconds. After this time has elapsed, the
process is preempted and added to the end of the ready queue.
If there are n processes in the ready queue and the time quantum is
q, then each process gets 1/n of the CPU time in chunks of at most q
time units at once. No process waits more than (n-1)q time units.
Timer interrupts every quantum to schedule next process
Performance
q large ⇒ FIFO
q small ⇒ q must be large with respect to context switch, otherwise
overhead is too high
Example of RR with Time Quantum = 4
Process Burst Time
P1 24
P2 3
P3 3
The Gantt chart is:
Typically, higher average turnaround than SJF, but better response
q should be large compared to context switch time
q usually 10ms to 100ms, context switch < 10 usec
Time Quantum and Context Switch Time
Turnaround Time Varies With The Time Quantum
80% of CPU bursts
should be shorter than q
Multilevel Queue
Ready queue is partitioned into separate queues, eg:
foreground (interactive)
background (batch)
Process permanently in a given queue
Each queue has its own scheduling algorithm:
foreground – RR
background – FCFS
Scheduling must be done between the queues:
Fixed priority scheduling; (i.e., serve all from foreground then from
background). Possibility of starvation.
Time slice – each queue gets a certain amount of CPU time which it can
schedule amongst its processes; i.e., 80% to foreground in RR
20% to background in FCFS
Multilevel Queue Scheduling
Multilevel Feedback Queue
A process can move between the various queues; aging can be
implemented this way
Multilevel-feedback-queue scheduler defined by the following
parameters:
number of queues
scheduling algorithms for each queue
method used to determine when to upgrade a process
method used to determine when to demote a process
method used to determine which queue a process will enter when that
process needs service
Example of Multilevel Feedback Queue
Three queues:
Q0 – RR with time quantum 8 milliseconds
Q1 – RR time quantum 16 milliseconds
Q2 – FCFS
Scheduling
A new job enters queue Q0 which is served
FCFS
• When it gains CPU, job receives 8
milliseconds
• If it does not finish in 8
milliseconds, job is moved to
queue Q1
At Q1 job is again served FCFS and receives 16
additional milliseconds
• If it still does not complete, it is
preempted and moved to queue
Q2
Module 2
● Roll No – 11 to 15
● Competitive Exam Questions
● Roll No – 16 to 20
● Previous and Possible university exam questions

More Related Content

Similar to operating system module 2 presentation notes

OS (1).pptx
OS (1).pptxOS (1).pptx
OS (1).pptx
KumarMit2
 
3 process management
3 process management3 process management
3 process management
Dr. Loganathan R
 
OS-Process.pdf
OS-Process.pdfOS-Process.pdf
OS-Process.pdf
Rakibul Rakib
 
Process management
Process managementProcess management
Process management
Akshay Ithape
 
Ch3 processes
Ch3   processesCh3   processes
Ch3 processes
Welly Dian Astika
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
Arnav Chowdhury
 
Cs8493 unit 2
Cs8493 unit 2Cs8493 unit 2
Cs8493 unit 2
Kathirvel Ayyaswamy
 
Lecture_Slide_4.pptx
Lecture_Slide_4.pptxLecture_Slide_4.pptx
Lecture_Slide_4.pptx
DiptoRoy21
 
Ch03- PROCESSES.ppt
Ch03- PROCESSES.pptCh03- PROCESSES.ppt
Ch03- PROCESSES.ppt
MeghaSharma474761
 
UNIT I-Processes.pptx
UNIT I-Processes.pptxUNIT I-Processes.pptx
UNIT I-Processes.pptx
GaneshKumar537286
 
Operating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringOperating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - Engineering
Yogesh Santhan
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
Emertxe Information Technologies Pvt Ltd
 
UNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdfUNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdf
aakritii765
 
Lecture 2 process
Lecture 2   processLecture 2   process
Lecture 2 process
Kumbirai Junior Muzavazi
 
Ch2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.pptCh2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.ppt
Mohammad Almuiet
 
Operating System-2 by Adi.pdf
Operating System-2 by Adi.pdfOperating System-2 by Adi.pdf
Operating System-2 by Adi.pdf
Prof. Dr. K. Adisesha
 
CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2
Kathirvel Ayyaswamy
 
Operating System 3
Operating System 3Operating System 3
Operating System 3tech2click
 
Operating Systems chap 2_updated2 (1).pptx
Operating Systems chap 2_updated2 (1).pptxOperating Systems chap 2_updated2 (1).pptx
Operating Systems chap 2_updated2 (1).pptx
Amanuelmergia
 

Similar to operating system module 2 presentation notes (20)

OS (1).pptx
OS (1).pptxOS (1).pptx
OS (1).pptx
 
3 process management
3 process management3 process management
3 process management
 
OS-Process.pdf
OS-Process.pdfOS-Process.pdf
OS-Process.pdf
 
Process management
Process managementProcess management
Process management
 
Ch3 processes
Ch3   processesCh3   processes
Ch3 processes
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
 
Lecture 5 process concept
Lecture 5   process conceptLecture 5   process concept
Lecture 5 process concept
 
Cs8493 unit 2
Cs8493 unit 2Cs8493 unit 2
Cs8493 unit 2
 
Lecture_Slide_4.pptx
Lecture_Slide_4.pptxLecture_Slide_4.pptx
Lecture_Slide_4.pptx
 
Ch03- PROCESSES.ppt
Ch03- PROCESSES.pptCh03- PROCESSES.ppt
Ch03- PROCESSES.ppt
 
UNIT I-Processes.pptx
UNIT I-Processes.pptxUNIT I-Processes.pptx
UNIT I-Processes.pptx
 
Operating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - EngineeringOperating Systems Unit Two - Fourth Semester - Engineering
Operating Systems Unit Two - Fourth Semester - Engineering
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
 
UNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdfUNIT-2-Process-Management.pdf
UNIT-2-Process-Management.pdf
 
Lecture 2 process
Lecture 2   processLecture 2   process
Lecture 2 process
 
Ch2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.pptCh2_Processes_and_process_management_1.ppt
Ch2_Processes_and_process_management_1.ppt
 
Operating System-2 by Adi.pdf
Operating System-2 by Adi.pdfOperating System-2 by Adi.pdf
Operating System-2 by Adi.pdf
 
CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2
 
Operating System 3
Operating System 3Operating System 3
Operating System 3
 
Operating Systems chap 2_updated2 (1).pptx
Operating Systems chap 2_updated2 (1).pptxOperating Systems chap 2_updated2 (1).pptx
Operating Systems chap 2_updated2 (1).pptx
 

Recently uploaded

HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
DuvanRamosGarzon1
 

Recently uploaded (20)

HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
 

operating system module 2 presentation notes

  • 2. Module 2 ● Processes ● Process states, Process control block, Threads, Scheduling ● Operations on processes ● Process creation and termination ● Inter-process communication ● Shared memory systems ● Message passing systems ● Process Scheduling ● Basic concepts, Scheduling criteria ● Scheduling Algorithms ● First come First Served ● Shortest Job First ● Priority scheduling ● Round robin scheduling
  • 3. Objectives ● To introduce the notion of a process -- a program in execution, which forms the basis of all computation ● To describe the various operations on process ● To explore inter-process communication using shared memory and message passing ● To introduce CPU scheduling, which is the basis for multi-programmed operating systems ● To describe various CPU-scheduling algorithms
  • 5. Process ● Process – a program in execution
  • 6. Process ● Process – a program in execution ● Process execution must progress in sequential fashion ● Program is passive entity stored on disk (executable file), process is active entity. ● Program becomes process when executable file loaded into memory ● Execution of program started via GUI mouse clicks, command line entry of its name, etc
  • 7.
  • 8. Process Concept(cont.) ● Process in main memory consist of multiple parts ● Text section containing the program code ● Data section containing global and static variables ● Stack containing temporary data Function parameters, return addresses, local variables ● Heap containing memory dynamically allocated during run time (managed via calls to new, delete, malloc, free, etc.) ● Note that the stack and the heap start at opposite ends of the process's free space and grow towards each other. If they should ever meet, then either a stack overflow error will occur, or else a call to new or malloc will fail due to insufficient memory available.
  • 9. Process State ● As a process executes, it changes state ● new: The process is being created ● running: Instructions are being executed ● waiting: The process is waiting for some event to occur ● ready: The process is waiting to be assigned to a processor ● terminated: The process has finished execution
  • 10. Process Control Block (PCB) ❖ Each process is represented in the operating system by a PCB ❖ PCB holds the information associated with each process ❖ Also called task control block ❖ The process control block is kept in a memory area that is protected from the normal user access. ❖ This is done because it contains important process information
  • 11. Process Control Block (PCB) PCB includes: ●Process state ●Process number – process id ●Program counter – address of next instruction to execute ●CPU registers – contents of all process-centric registers ●Memory management information – memory allocated to the process ●List of open files ●CPU scheduling information- priorities, scheduling queue pointers ●Accounting information – CPU used, clock time elapsed since start, time limits ●I/O status information – I/O devices allocated to process
  • 12. Process Scheduling ● The process scheduling is the activity of the OS that handles the removal of the running process from the CPU and the selection of another process on the basis of a particular strategy. ● Process scheduling is an essential part of a Multiprogramming operating systems. ● Such operating systems allow more than one process to be loaded into the executable memory at a time and the loaded process shares the CPU using time multiplexing. ● Maximize CPU use, quickly switch processes onto CPU for time sharing ● Process scheduler selects among available processes for next execution on CPU
  • 13. Scheduling Queues ● OS maintains scheduling queues of processes ● OS maintains a separate queue for different process states and PCBs of all processes in the same execution state are placed in the same queue. ● When the state of a process is changed, its PCB is unlinked from its current queue and moved to its new state queue. ● Different scheduling queues are: ● Job queue – set of all processes in the system. When a process is created it is entered into job queue. ● Ready queue – set of all processes residing in main memory, ready and waiting to execute ● Device queues – set of processes waiting for an I/O device ● Process migrate among various queues.
  • 14. Queuing Diagram - Representation of Process Scheduling ● Queueing diagram represents queues, resources, flows
  • 15. Schedulers ● Schedulers are special system software which handle process scheduling. ● Types of process schedulers: ● Short- term scheduler ● Long- term scheduler ● Medium- term scheduler ● Short-term scheduler (or CPU scheduler) ● Selects which process should be executed next and allocates CPU ● Short-term scheduler is invoked frequently (milliseconds) ⇒ (must be fast)
  • 16. Schedulers ● Long-term scheduler (or job scheduler) ● Selects which processes should be brought into the ready queue ● Long-term scheduler is invoked infrequently (seconds, minutes) ⇒ (may be slow) ● The long-term scheduler controls the degree of multiprogramming (number of processes in memory). ● Medium – term scheduler ● A running process may become suspended if it makes an I/O request. A suspended processes cannot make any progress towards completion. ● In this condition, to remove the process from memory and make space for other processes, the suspended process is moved to the secondary storage. ● Remove process from memory, store on disk, bring back in from disk to continue execution: swapping ● Medium-term scheduler takes care of process swapping. ● Medium-term scheduler reduces the degree of multiprogramming.
  • 17.
  • 18. Context Switch ● The process of storing the state of the old process and load the saved state for the new process, when CPU switches to another process, is called context switching ● This allows multiple processes to share a single CPU ● Essential feature of a multitasking operating system. ● Context of a process represented in the PCB
  • 19. CPU Switch From Process to Process ●Context-switch time is overhead; the system does no useful work while switching ● The more complex the OS and the PCB 🡺 the longer the context switch
  • 20. Tutorial - 3 ● Threads in Operating System ● Process vs Thread
  • 22. Operations on Processes ● Operations on processes are: ● process creation ● process termination
  • 23. Process Creation ● Process creation means the construction of a new process for the execution. This might be performed by system, user or old process itself. ● Parent process create children processes, which, in turn create other processes, forming a tree of processes ● Generally, process are identified and managed via a process identifier (pid)
  • 24. A Tree of Processes in Linux Reading Activity – Page 114, para 3
  • 25. Process Creation(Cont.) ● Resource (CPU time, memory, files, I/O devices) sharing options ● Parent and children share all resources ● Children share subset of parent’s resources ● Parent and child share no resources ● Execution options ● Parent and children execute concurrently ● Parent waits until children terminate ● Address space ● Child is a duplicate of parent(child has same program and data as parent) ● Child process has a new program loaded into it
  • 26. Process Creation (Cont.) ● UNIX examples ● fork() ● exec()
  • 27. Fork () system call ● Creates new process ● Created process is called child process, which runs concurrently with the process that makes the fork() call (parent process). ● After a new child process is created, both processes will execute the next instruction following the fork() system call. ● Process IDs are different. ● A child process uses the same pc(program counter), same CPU registers, same open files which use in the parent process.
  • 28. Total Number of Processes created= 2n, where n is number of fork system calls
  • 29. Fork () system call ● It takes no parameters ● Returns an integer value. ● Negative Value - creation of a child process was unsuccessful. ● Zero: Returned to the newly created child process. ● Positive value: Returned to parent or caller. The value contains process ID of newly created child process.
  • 30. exec () system call ● exec() system call used after a fork() to replace the process memory space with a new program
  • 31. #include<string.h> #include<sys/types.h> #include<sys/wait.h> int main() { int status; int childpid; int pid_child; if((childpid =fork())==-1) { printf("nCant forkn"); } else if(childpid==0) { execl("/bin/ls","ls",NULL); printf("n I am the child with pid=%d",getpid()); exit(0); } else { pid_child=wait(&status); printf(“I am the parent with pid=%d",getpid()); printf("child with processid=%d compltely successfullly ",pid_child); } return(0); }
  • 32. Process Termination ● Process executes last statement and then asks the operating system to delete it using the exit() system call. ● Returns status data from child to parent (via wait()) ● Process resources are deallocated by operating system ● Parent may terminate the execution of children processes using the abort() system call. Some reasons for doing so: ● Child has exceeded allocated resources ● Task assigned to child is no longer required ● The parent is exiting and the operating systems does not allow a child to continue if its parent terminates
  • 33. Process Termination (cont.) ● The parent process may wait for termination of a child process by using the wait()system call. The call returns status information and the pid of the terminated process pid = wait(&status); ● Some operating systems do not allow child to exists if its parent has terminated. If a process terminates, then all its children must also be terminated. ● cascading termination - All children, grandchildren, etc. are terminated. ● The termination is initiated by the operating system.
  • 34. Process Termination (cont.) ● Zombie process ● A zombie process is a process whose execution is completed but it still has an entry in the process table. ● Once the parent process reads the child’s exit status, the zombie process is eliminated from the process table. ● This is known as reaping the zombie process. ● Orphan process ● An orphan process is a process that is still executing, but whose parent has died.
  • 35. Other operations on process ● Process Blocking ● When a process invokes an input-output system call, OS blocks that process ● Process Preemption ● When a timeout occurs (that means the 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.
  • 36. Multiprocess Architecture – Chrome Browser ● Many web browsers ran as single process (some still do) ● If one web site causes trouble, entire browser can hang or crash ● Google Chrome Browser is multiprocess with 3 different types of processes: ● Browser process manages user interface, disk and network I/O ● Renderer process renders web pages, deals with HTML, Javascript. A new renderer created for each website opened Runs in sandbox restricting disk and network I/O, minimizing effect of security exploits ● Plug-in process for each type of plug-in Reading Activity
  • 38. Interprocess Communication ● Processes executing concurrently in the OS may be ● independent process ● cooperating process ● Independent process ● They cannot affect or be affected by other processes executing in the system. ● Cooperating process ● The can affect or be affected by other processes, executing in the system ● Any process that share data with other process is a cooperating process
  • 39. Interprocess Communication ● Interprocess communication(IPC) is the mechanism provided by the operating system that allows processes to communicate with each other ● Two models of IPC ● Shared memory ● In shared memory-memory model, a region of memory that is shared by the cooperating process is established. ● Processes can then exchange information by reading and writing data to the shared region. ● Message passing ● In message passing model, communication takes place by means of exchanged messages between cooperating processes.
  • 41. IPC using shared memory system
  • 42. Producer-Consumer Problem ● To illustrate the concept of cooperating process, we can consider producer – consumer problem, which is a common paradigm for cooperating processes ● Producer process produces information that is consumed by a consumer process ● Compiler produces assembly code that is consumed by an assembler ● Assembler produces object modules that are consumed by the loader ● Web server provides HTML files and images that are consumed by web browser.
  • 43.
  • 44.
  • 45. ● Assignment 2 IPC using message passing
  • 46. Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Real-Time CPU Scheduling Operating Systems Examples Algorithm Evaluation
  • 47. Objectives To introduce CPU scheduling, which is the basis for multiprogrammed operating systems To describe various CPU-scheduling algorithms To discuss evaluation criteria for selecting a CPU-scheduling algorithm for a particular system To examine the scheduling algorithms of several operating systems
  • 48. Basic Concepts Maximum CPU utilization obtained with multiprogramming CPU–I/O Burst Cycle – Process execution consists of a cycle of CPU execution and I/O wait CPU burst followed by I/O burst CPU burst distribution is of main concern
  • 50. CPU Scheduler ● Short-term scheduler selects from among the processes in ready queue, and allocates the CPU to one of them ● Queue may be ordered in various ways ● CPU scheduling decisions may take place when a process: 1. Switches from running to waiting state 2. Switches from running to ready state 3. Switches from waiting to ready 4. Terminates ● Scheduling under 1 and 4 is nonpreemptive ● All other scheduling is preemptive ● Consider access to shared data ● Consider preemption while in kernel mode ● Consider interrupts occurring during crucial OS activities
  • 51. Dispatcher Dispatcher module gives control of the CPU to the process selected by the short-term scheduler; this involves: switching context switching to user mode jumping to the proper location in the user program to restart that program Dispatch latency – time it takes for the dispatcher to stop one process and start another running
  • 52. Scheduling Criteria CPU utilization – keep the CPU as busy as possible Throughput – # of processes that complete their execution per time unit Turnaround time – amount of time to execute a particular process Waiting time – amount of time a process has been waiting in the ready queue Response time – amount of time it takes from when a request was submitted until the first response is produced, not output (for time- sharing environment)
  • 53. Scheduling Algorithm Optimization Criteria Max CPU utilization Max throughput Min turnaround time Min waiting time Min response time
  • 54. First- Come, First-Served (FCFS) Scheduling Process Burst Time P1 24 P2 3 P3 3 Suppose that the processes arrive in the order: P1 , P2 , P3 The Gantt Chart for the schedule is: Waiting time for P1 = 0; P2 = 24; P3 = 27 Average waiting time: (0 + 24 + 27)/3 = 17
  • 55. FCFS Scheduling (Cont.) Suppose that the processes arrive in the order: P2 , P3 , P1 The Gantt chart for the schedule is: Waiting time for P1 = 6; P2 = 0; P3 = 3 Average waiting time: (6 + 0 + 3)/3 = 3 Much better than previous case Convoy effect - short process behind long process Consider one CPU-bound and many I/O-bound processes
  • 56. Shortest-Job-First (SJF) Scheduling Associate with each process the length of its next CPU burst Use these lengths to schedule the process with the shortest time SJF is optimal – gives minimum average waiting time for a given set of processes The difficulty is knowing the length of the next CPU request Could ask the user
  • 57. Example of SJF ProcessArriva l Time Burst Time P1 0.0 6 P2 2.0 8 P3 4.0 7 P4 5.0 3 SJF scheduling chart Average waiting time = (3 + 16 + 9 + 0) / 4 = 7
  • 58. Determining Length of Next CPU Burst Can only estimate the length – should be similar to the previous one Then pick process with shortest predicted next CPU burst Can be done by using the length of previous CPU bursts, using exponential averaging Commonly, α set to ½ Preemptive version called shortest-remaining-time-first
  • 59. Prediction of the Length of the Next CPU Burst
  • 60. Examples of Exponential Averaging α =0 τn+1 = τn Recent history does not count α =1 τn+1 = α tn Only the actual last CPU burst counts If we expand the formula, we get: τn+1 = α tn+(1 - α)α tn -1 + … +(1 - α )j α tn -j + … +(1 - α )n +1 τ0 Since both α and (1 - α) are less than or equal to 1, each successive term has less weight than its predecessor
  • 61. Example of Shortest-remaining-time-first Now we add the concepts of varying arrival times and preemption to the analysis ProcessA arri Arrival TimeT Burst Time P1 0 8 P2 1 4 P3 2 9 P4 3 5 Preemptive SJF Gantt Chart Average waiting time = [(10-1)+(1-1)+(17-2)+5-3)]/4 = 26/4 = 6.5 msec
  • 62. Priority Scheduling A priority number (integer) is associated with each process The CPU is allocated to the process with the highest priority (smallest integer ≡ highest priority) Preemptive Nonpreemptive SJF is priority scheduling where priority is the inverse of predicted next CPU burst time Problem ≡ Starvation – low priority processes may never execute Solution ≡ Aging – as time progresses increase the priority of the process
  • 63. Example of Priority Scheduling ProcessA arri Burst TimeT Priority P1 10 3 P2 1 1 P3 2 4 P4 1 5 P5 5 2 Priority scheduling Gantt Chart Average waiting time = 8.2 msec
  • 64. Round Robin (RR) Each process gets a small unit of CPU time (time quantum q), usually 10-100 milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue. If there are n processes in the ready queue and the time quantum is q, then each process gets 1/n of the CPU time in chunks of at most q time units at once. No process waits more than (n-1)q time units. Timer interrupts every quantum to schedule next process Performance q large ⇒ FIFO q small ⇒ q must be large with respect to context switch, otherwise overhead is too high
  • 65. Example of RR with Time Quantum = 4 Process Burst Time P1 24 P2 3 P3 3 The Gantt chart is: Typically, higher average turnaround than SJF, but better response q should be large compared to context switch time q usually 10ms to 100ms, context switch < 10 usec
  • 66. Time Quantum and Context Switch Time
  • 67. Turnaround Time Varies With The Time Quantum 80% of CPU bursts should be shorter than q
  • 68. Multilevel Queue Ready queue is partitioned into separate queues, eg: foreground (interactive) background (batch) Process permanently in a given queue Each queue has its own scheduling algorithm: foreground – RR background – FCFS Scheduling must be done between the queues: Fixed priority scheduling; (i.e., serve all from foreground then from background). Possibility of starvation. Time slice – each queue gets a certain amount of CPU time which it can schedule amongst its processes; i.e., 80% to foreground in RR 20% to background in FCFS
  • 70. Multilevel Feedback Queue A process can move between the various queues; aging can be implemented this way Multilevel-feedback-queue scheduler defined by the following parameters: number of queues scheduling algorithms for each queue method used to determine when to upgrade a process method used to determine when to demote a process method used to determine which queue a process will enter when that process needs service
  • 71. Example of Multilevel Feedback Queue Three queues: Q0 – RR with time quantum 8 milliseconds Q1 – RR time quantum 16 milliseconds Q2 – FCFS Scheduling A new job enters queue Q0 which is served FCFS • When it gains CPU, job receives 8 milliseconds • If it does not finish in 8 milliseconds, job is moved to queue Q1 At Q1 job is again served FCFS and receives 16 additional milliseconds • If it still does not complete, it is preempted and moved to queue Q2
  • 72. Module 2 ● Roll No – 11 to 15 ● Competitive Exam Questions ● Roll No – 16 to 20 ● Previous and Possible university exam questions