This ppt covers following topics,
Process Concept
Process Scheduling
Operations on Processes
Interprocess Communication
Examples of IPC Systems
Communication in Client-Server Systems
Operating system 18 process creation and terminationVaibhav Khanna
Information associated with each process
(also called task control block)
Process state – running, waiting, etc
Program counter – location of instruction to next execute
CPU registers – contents of all process-centric registers
CPU scheduling information- priorities, scheduling queue pointers
Memory-management information – memory allocated to the process
Accounting information – CPU used, clock time elapsed since start, time limits
I/O status information – I/O devices allocated to process, list of open files
This ppt covers following topics,
Process Concept
Process Scheduling
Operations on Processes
Interprocess Communication
Examples of IPC Systems
Communication in Client-Server Systems
Operating system 18 process creation and terminationVaibhav Khanna
Information associated with each process
(also called task control block)
Process state – running, waiting, etc
Program counter – location of instruction to next execute
CPU registers – contents of all process-centric registers
CPU scheduling information- priorities, scheduling queue pointers
Memory-management information – memory allocated to the process
Accounting information – CPU used, clock time elapsed since start, time limits
I/O status information – I/O devices allocated to process, list of open files
What is program and process .
Program execution flow .
Example of process generation .
Description of process .
Types of process .
Ways of run process .
How process is generated using fork() and execution .
Process life cycle .
Process tree .
Process states .
Load Averages .
For monitoring and managing linux process tools .
UNIT II PROCESS MANAGEMENT
Processes – Process Concept, Process Scheduling, Operations on Processes, Inter-process Communication; CPU Scheduling – Scheduling criteria, Scheduling algorithms, Multiple-processor scheduling, Real time scheduling; Threads- Overview, Multithreading models, Threading issues; Process Synchronization – The critical-section problem, Synchronization hardware, Mutex locks, Semaphores, Classic problems of synchronization, Critical regions, Monitors; Deadlock – System model, Deadlock characterization, Methods for handling deadlocks, Deadlock prevention, Deadlock avoidance, Deadlock detection, Recovery from deadlock.
The second part of Linux Internals covers system calls, process subsystem and inter process communication mechanisms. Understanding these services provided by Linux are essential for embedded systems engineer.
UNIT II PROCESS MANAGEMENT
Processes-Process Concept, Process Scheduling, Operations on Processes, Interprocess Communication; Threads- Overview, Multicore Programming, Multithreading Models; Windows 7 - Thread and SMP Management. Process Synchronization - Critical Section Problem, Mutex Locks, Semophores, Monitors; CPU Scheduling and Deadlocks.
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
More Related Content
Similar to operating system module 2 presentation notes
What is program and process .
Program execution flow .
Example of process generation .
Description of process .
Types of process .
Ways of run process .
How process is generated using fork() and execution .
Process life cycle .
Process tree .
Process states .
Load Averages .
For monitoring and managing linux process tools .
UNIT II PROCESS MANAGEMENT
Processes – Process Concept, Process Scheduling, Operations on Processes, Inter-process Communication; CPU Scheduling – Scheduling criteria, Scheduling algorithms, Multiple-processor scheduling, Real time scheduling; Threads- Overview, Multithreading models, Threading issues; Process Synchronization – The critical-section problem, Synchronization hardware, Mutex locks, Semaphores, Classic problems of synchronization, Critical regions, Monitors; Deadlock – System model, Deadlock characterization, Methods for handling deadlocks, Deadlock prevention, Deadlock avoidance, Deadlock detection, Recovery from deadlock.
The second part of Linux Internals covers system calls, process subsystem and inter process communication mechanisms. Understanding these services provided by Linux are essential for embedded systems engineer.
UNIT II PROCESS MANAGEMENT
Processes-Process Concept, Process Scheduling, Operations on Processes, Interprocess Communication; Threads- Overview, Multicore Programming, Multithreading Models; Windows 7 - Thread and SMP Management. Process Synchronization - Critical Section Problem, Mutex Locks, Semophores, Monitors; CPU Scheduling and Deadlocks.
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
Forklift Classes Overview by Intella PartsIntella Parts
Discover the different forklift classes and their specific applications. Learn how to choose the right forklift for your needs to ensure safety, efficiency, and compliance in your operations.
For more technical information, visit our website https://intellaparts.com
Water scarcity is the lack of fresh water resources to meet the standard water demand. There are two type of water scarcity. One is physical. The other is economic water scarcity.
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...Amil Baba Dawood bangali
Contact with Dawood Bhai Just call on +92322-6382012 and we'll help you. We'll solve all your problems within 12 to 24 hours and with 101% guarantee and with astrology systematic. If you want to take any personal or professional advice then also you can call us on +92322-6382012 , ONLINE LOVE PROBLEM & Other all types of Daily Life Problem's.Then CALL or WHATSAPP us on +92322-6382012 and Get all these problems solutions here by Amil Baba DAWOOD BANGALI
#vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore#blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #blackmagicforlove #blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #Amilbabainuk #amilbabainspain #amilbabaindubai #Amilbabainnorway #amilbabainkrachi #amilbabainlahore #amilbabaingujranwalan #amilbabainislamabad
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfKamal Acharya
The College Bus Management system is completely developed by Visual Basic .NET Version. The application is connect with most secured database language MS SQL Server. The application is develop by using best combination of front-end and back-end languages. The application is totally design like flat user interface. This flat user interface is more attractive user interface in 2017. The application is gives more important to the system functionality. The application is to manage the student’s details, driver’s details, bus details, bus route details, bus fees details and more. The application has only one unit for admin. The admin can manage the entire application. The admin can login into the application by using username and password of the admin. The application is develop for big and small colleges. It is more user friendly for non-computer person. Even they can easily learn how to manage the application within hours. The application is more secure by the admin. The system will give an effective output for the VB.Net and SQL Server given as input to the system. The compiled java program given as input to the system, after scanning the program will generate different reports. The application generates the report for users. The admin can view and download the report of the data. The application deliver the excel format reports. Because, excel formatted reports is very easy to understand the income and expense of the college bus. This application is mainly develop for windows operating system users. In 2017, 73% of people enterprises are using windows operating system. So the application will easily install for all the windows operating system users. The application-developed size is very low. The application consumes very low space in disk. Therefore, the user can allocate very minimum local disk space for this application.
Courier management system project report.pdfKamal Acharya
It is now-a-days very important for the people to send or receive articles like imported furniture, electronic items, gifts, business goods and the like. People depend vastly on different transport systems which mostly use the manual way of receiving and delivering the articles. There is no way to track the articles till they are received and there is no way to let the customer know what happened in transit, once he booked some articles. In such a situation, we need a system which completely computerizes the cargo activities including time to time tracking of the articles sent. This need is fulfilled by Courier Management System software which is online software for the cargo management people that enables them to receive the goods from a source and send them to a required destination and track their status from time to time.
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSEDuvanRamosGarzon1
AIRCRAFT GENERAL
The Single Aisle is the most advanced family aircraft in service today, with fly-by-wire flight controls.
The A318, A319, A320 and A321 are twin-engine subsonic medium range aircraft.
The family offers a choice of engines
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
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
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
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.
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.
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
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
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