SlideShare uma empresa Scribd logo
1 de 114
Damian Gordon
 What are good policies to schedule
processes?
 What are good policies to schedule
processes?
1. Maximum Throughput
2. Minimize Response Time
3. Minimize Turnaround Time
4. Minimize Waiting Time
5. Maximise CPU Efficiency
6. Ensure Fairness For All Jobs
 MAXIMUM THROUGHPUT
 Get as many jobs done as quickly as possible.
 There are several ways to achieve this, e.g.
run only short jobs, run jobs without
interruptions.
 MINIMIZE RESPONSE TIME
 Ensure that interactive requests are dealt with
as quickly as possible.
 This could be achieved by scheduling just
with a lot of I/O jobs first, and leave the
computational jobs for later.
 MINIMIZE TURNAROUND TIME
 Ensure that jobs are completed as quickly as
possible.
 This could be achieved by scheduling just
with a lot of computation jobs first, and leave
the I/O jobs for later, so there is no user
delays.
 MINIMIZE WAITING TIME
 Move jobs out of the READY status as soon as
possible.
 This could be achieved by reduce the number
of users allowed on the system, so that the
CPU would be available whenever a job enters
the READY status.
 MAXIMISE CPU EFFICIENCY
 Keep the CPU busy 100% of the time.
 This could be achieved by scheduling just
with a lot of computation jobs, and never run
the I/O jobs.
 ENSURE FAIRNESS FOR ALL JOBS
 Give everyone an equal amount of CPU time
and I/O time.
 This could be achieved by giving all jobs
equal priority, regardless of it’s
characteristics.
 Here are six commonly used process
scheduling algorithms
 Here are six commonly used process
scheduling algorithms
1. First Come, First Served (FCFS)
2. Shortest Job Next (SJN)
3. Priority Scheduling
4. Shortest Remaining Time (SRT)
5. Round Robin
6. Multi-Level Queues
 First Come, First Served (FCFS)
 A very simple algorithm that uses a FIFO
structure.
 Implemented as a non-pre-emptive
scheduling algorithm.
 Works well for Batch Processes, where users
don’t expect any interaction.
 Shortest Job Next (SJN)
 Also called Shortest Job First (SJF).
 A very simple algorithm that schedules
processes based on CPU cycle time.
 Implemented as a non-pre-emptive
scheduling algorithm.
 Works well for Batch Processes, where it is
easy to estimate CPU time.
 Priority Scheduling
 An algorithm that schedules processes based
on priority.
 Implemented as a non-pre-emptive
scheduling algorithm.
 One of the most common algorithms used in
systems that are mainly Batch Processes.
 If two jobs come in of equal priority are
READY, if works on a FIRST COME, FIRST
SERVED basis.
 Shortest Remaining Time (SRT)
 A pre-emptive scheduling version of the
Shortest Job Next (SJN) algorithm.
 An algorithm that schedules processes based
on the one which is nearest to completion.
 It can only be implemented on systems that
are only Batch Processes, since you have to
know the CPU time required to complete each
job.
 Round Robin
 A pre-emptive scheduling algorithm that is
used extensively in interactive systems
 All active processes are given a pre-
determined slice of time (“time quantum”).
 Choosing the time quantum is the key
decision, for interactive systems the quantum
must be small, whereas for batch systems it
can be longer.
 Multi-Level Queues
 This isn’t really a separate scheduling
algorithm, it can be used with others.
 Jobs are grouped together based on common
characteristics.
 For example, CPU-bound jobs based in one
queue, and the I/O-bound jobs in another
queue, and the process scheduler can select
jobs from each queue based on balancing the
load.
 Deadlock can be said to occur when a process
is allocated some non-sharable resources
(such as files, printers or scanners), but is
forced to wait for other non-sharable
resources.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
YES
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
Continue
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
NO
WAIT
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
WAIT
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcB:
BEGIN
Do Stuff;
Open (File2);
Do more stuff;
Open (File1);
Do stuff;
END.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcB:
BEGIN
Do Stuff;
Open (File2);
Do more stuff;
Open (File1);
Do stuff;
END.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcB:
BEGIN
Do Stuff;
Open (File2);
Do more stuff;
Open (File1);
Do stuff;
END.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcB:
BEGIN
Do Stuff;
Open (File2);
Do more stuff;
Open (File1);
Do stuff;
END.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcB:
BEGIN
Do Stuff;
Open (File2);
Do more stuff;
Open (File1);
Do stuff;
END.
PROGRAM ProcA:
BEGIN
Do Stuff;
Open (File1);
Do more stuff;
Open (File2);
Do stuff;
END.
PROGRAM ProcB:
BEGIN
Do Stuff;
Open (File2);
Do more stuff;
Open (File1);
Do stuff;
END.
Process
A
File 1
File 2
Process
A
File 1
File 2
Process
A
File 1
File 2
Process
A
File 1
File 2
Process
A
File 1
File 2
Process
A
Process
B
Process
B
File 1
File 2
Process
B
File 1
File 2
Process
B
File 1
File 2
Process
B
File 1
File 2
Process
B
File 1
File 2
Process
B
File 1
File 2
Process
A
1. Deadlock on file requests
2. Deadlock in databases
3. Deadlock in dedicated device allocation
4. Deadlock in multiple device allocation
5. Deadlock in spooling
6. Deadlock in a network
7. Deadlock in disk sharing
 We just saw it:
 We just saw it:
Process
B
File 1
File 2
Process
A
 Only occurs because a process is allowed to
lock a resource for the duration of its
execution.
 Similar
Transaction
B
Record
1
Record
2
Transaction
A
Begin transaction TA:
read balance1 [ 100 ]
balance1 = balance1 - 100
if balance < 0
print “insufficient funds”
abort T1
end
write balance1 [ 0 ]
read balance2 [ 100 ]
Begin transaction TA:
read balance1 [ 100 ]
balance1 = balance1 - 100
if balance < 0
print “insufficient funds”
abort T1
end
write balance1 [ 0 ]
read balance2 [ 100 ]
Begin transaction TB:
read balance2 [ 100 ]
balance2 = balance2 - 100
if balance < 0
print “insufficient funds”
abort T2
end
write balance2 [ 0 ]
read balance1 [ 100 ]
Begin transaction TB:
read balance2 [ 100 ]
balance2 = balance2 - 100
if balance < 0
print “insufficient funds”
abort T2
end
write balance2 [ 0 ]
read balance1 [ 100 ]
Begin transaction TA:
read balance1 [ 100 ]
balance1 = balance1 - 100
if balance < 0
print “insufficient funds”
abort T1
end
write balance1 [ 0 ]
read balance2 [ 100 ]
Begin transaction TB:
read balance2 [ 100 ]
balance2 = balance2 - 100
if balance < 0
print “insufficient funds”
abort T2
end
write balance2 [ 0 ]
read balance1 [ 100 ]
Begin transaction TA:
read balance1 [ 100 ]
balance1 = balance1 - 100
if balance < 0
print “insufficient funds”
abort T1
end
write balance1 [ 0 ]
read balance2 [ 100 ]
 For example DVD Read/Write drives
Process
B
Process
A
DVD-R
1
DVD-R
2
 More than over device, e.g. DVD-R, printer,
scanner.
Process
B
Process
A
DVD-R
1
Scanner
1
Process
B
Process
A
DVD-R
1
Scanner
1
Process
C
Printer
1
 What is Spooling?
 What is Spooling?
 SPOOL is an acronym for Simultaneous
Peripheral Operations On-Line.
 What is Spooling?
 SPOOL is an acronym for Simultaneous
Peripheral Operations On-Line.
 What is Spooling?
 SPOOL is an acronym for Simultaneous
Peripheral Operations On-Line.
 A simple example of a spooling application is
print spooling, which places a print job a
queue for extended or later processing.
 What is Spooling?
 If all 108 of you guys had a 10-page
assignment you had to hand up by 11am and
you all printed your files at the same time at
10:55am, the spool might first accept page 1
from everyone, then page 2, and so on.,, but
if it gets to page 9 and then the spooler is
full, things get stuck. The printer might not
want to print any jobs unless it has a full 10
pages from any one job, so we are
deadlocked.
 For example, a medium-sized word-
processing centre has seven computers on a
network, each on different nodes. C1 receives
messages from nodes C2, C6, and C7 and
sends messages to only one: C2. C2 receives
messages from nodes C1, C3, and C4 and
sends messages to only C1 and C3. The
direction of the arrows in the diagram
indicates the flow of messages.
 Messages received by C1 from C6 and C7 and
destined for C2 are buffered in an output
queue. Messages received by C2 from C3 and
C4 and destined for C1 are buffered in an
output queue. As the traffic increases, the
length of each output queue increases until
all of the available buffer space is filled. At
this point C1 can’t accept any more messages
(from C2 or any other computer) because
there’s no more buffer space available to
store them.
 For the same reason, C2 can’t accept any
messages from C1 or any other computer,
not even a request to send. The
communication path between C1 and C2
becomes deadlocked; and because C1 can’t
send messages to any other computer except
C2 and can only receive messages from C6
and C7, those routes also become
deadlocked. C1 can’t send word to C2 about
the problem and so the deadlock can’t be
resolved without outside intervention.
 For example, at an insurance company the
system performs many daily transactions.
One day the following series of events ties up
the system:
 1. Customer Service (P1) wishes to show a
payment so it issues a command to read the
balance, which is stored on track 20 of a disk.
 2. While the control unit is moving the arm to
track 20, P1 is put on hold and the I/O
channel is free to process the next I/O
request.
 3. While the arm is moving into position,
Accounts Payable (P2) gains control of the I/O
channel and issues a command to write
someone else’s payment to a record stored
on track 310. If the command is not “locked
out,” P2 will be put on hold while the control
unit moves the arm to track 310.
 4. Because P2 is “on hold” while the arm is
moving, the channel can be captured again by
P1, which reconfirms its command to “read
from track 20.”
 5. Because the last command from P2 had
forced the arm mechanism to track 310, the
disk control unit begins to reposition the arm
to track 20 to satisfy P1. The I/O channel
would be released because P1 is once again
put on hold, so it could be captured by P2,
which issues a WRITE command only to
discover that the arm mechanism needs to be
repositioned.
 This is LIVELOCK.
Process
B
File 1
Process
A
File 2 File 3
Process
c
Process
B
File 1
Process
A
File 2 File 3
Process
c
Process
B
File 1
Process
A
File 2 File 3
Process
c
Process
B
File 1
Process
A
File 2 File 3
Process
c
 Born May 11, 1930
 Died August 6, 2002
 Born in Rotterdam,
Netherlands
 A Dutch computer
scientist, who received
the 1972 Turing
Award for fundamental
contributions to
developing
programming
languages.
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling
Operating Systems: Process Scheduling

Mais conteúdo relacionado

Mais procurados

DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-SystemsVenkata Sreeram
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentationusmankiyani1
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OSvampugani
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process SchedulingShipra Swati
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9myrajendra
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating SystemsRitu Ranjan Shrivastwa
 
Memory management ppt
Memory management pptMemory management ppt
Memory management pptManishaJha43
 
Methods for handling deadlock
Methods for handling deadlockMethods for handling deadlock
Methods for handling deadlocksangrampatil81
 
Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)ritu98
 
Methods for handling deadlocks
Methods for handling deadlocksMethods for handling deadlocks
Methods for handling deadlocksA. S. M. Shafi
 

Mais procurados (20)

Deadlock ppt
Deadlock ppt Deadlock ppt
Deadlock ppt
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
 
CPU Scheduling in OS Presentation
CPU Scheduling in OS  PresentationCPU Scheduling in OS  Presentation
CPU Scheduling in OS Presentation
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Os Threads
Os ThreadsOs Threads
Os Threads
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process Scheduling
 
deadlock
deadlockdeadlock
deadlock
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9
 
Chapter 3: Processes
Chapter 3: ProcessesChapter 3: Processes
Chapter 3: Processes
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
 
Memory management ppt
Memory management pptMemory management ppt
Memory management ppt
 
Methods for handling deadlock
Methods for handling deadlockMethods for handling deadlock
Methods for handling deadlock
 
Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)Shortest job first Scheduling (SJF)
Shortest job first Scheduling (SJF)
 
Methods for handling deadlocks
Methods for handling deadlocksMethods for handling deadlocks
Methods for handling deadlocks
 
Deadlock Prevention
Deadlock PreventionDeadlock Prevention
Deadlock Prevention
 
System calls
System callsSystem calls
System calls
 
Demand paging
Demand pagingDemand paging
Demand paging
 

Destaque

Operating Systems: Processor Management
Operating Systems: Processor ManagementOperating Systems: Processor Management
Operating Systems: Processor ManagementDamian T. Gordon
 
Operating Systems: Data Structures
Operating Systems: Data StructuresOperating Systems: Data Structures
Operating Systems: Data StructuresDamian T. Gordon
 
Operating Systems: Virtual Memory
Operating Systems: Virtual MemoryOperating Systems: Virtual Memory
Operating Systems: Virtual MemoryDamian T. Gordon
 
Operating Systems: History of Windows
Operating Systems: History of WindowsOperating Systems: History of Windows
Operating Systems: History of WindowsDamian T. Gordon
 
Operating Systems: File Management
Operating Systems: File ManagementOperating Systems: File Management
Operating Systems: File ManagementDamian T. Gordon
 
Operating Systems: Computer Security
Operating Systems: Computer SecurityOperating Systems: Computer Security
Operating Systems: Computer SecurityDamian T. Gordon
 
Operating Systems: Memory Management
Operating Systems: Memory ManagementOperating Systems: Memory Management
Operating Systems: Memory ManagementDamian T. Gordon
 
Operating Systems: The Little-Man Computer
Operating Systems: The Little-Man ComputerOperating Systems: The Little-Man Computer
Operating Systems: The Little-Man ComputerDamian T. Gordon
 
Operating Systems: A History of MacOS
Operating Systems: A History of MacOSOperating Systems: A History of MacOS
Operating Systems: A History of MacOSDamian T. Gordon
 
Operating Systems: Network Management
Operating Systems: Network ManagementOperating Systems: Network Management
Operating Systems: Network ManagementDamian T. Gordon
 
Operating Systems: What happen in 2016?
Operating Systems: What happen in 2016?Operating Systems: What happen in 2016?
Operating Systems: What happen in 2016?Damian T. Gordon
 
Operating Systems 1: Introduction
Operating Systems 1: IntroductionOperating Systems 1: Introduction
Operating Systems 1: IntroductionDamian T. Gordon
 
Operating Systems 1: Syllabus
Operating Systems 1: SyllabusOperating Systems 1: Syllabus
Operating Systems 1: SyllabusDamian T. Gordon
 
Operating Systems: A History of Linux
Operating Systems: A History of LinuxOperating Systems: A History of Linux
Operating Systems: A History of LinuxDamian T. Gordon
 
Operating Systems: What happen in 2015?
Operating Systems: What happen in 2015?Operating Systems: What happen in 2015?
Operating Systems: What happen in 2015?Damian T. Gordon
 
James Bond and the OSI Model
James Bond and the OSI ModelJames Bond and the OSI Model
James Bond and the OSI ModelDamian T. Gordon
 
Operating Systems: Device Management
Operating Systems: Device ManagementOperating Systems: Device Management
Operating Systems: Device ManagementDamian T. Gordon
 
Operating Systems: Computer Security
Operating Systems: Computer SecurityOperating Systems: Computer Security
Operating Systems: Computer SecurityDamian T. Gordon
 

Destaque (20)

Operating Systems: Processor Management
Operating Systems: Processor ManagementOperating Systems: Processor Management
Operating Systems: Processor Management
 
Operating Systems: Data Structures
Operating Systems: Data StructuresOperating Systems: Data Structures
Operating Systems: Data Structures
 
Operating Systems: Virtual Memory
Operating Systems: Virtual MemoryOperating Systems: Virtual Memory
Operating Systems: Virtual Memory
 
Operating Systems: History of Windows
Operating Systems: History of WindowsOperating Systems: History of Windows
Operating Systems: History of Windows
 
Operating Systems: File Management
Operating Systems: File ManagementOperating Systems: File Management
Operating Systems: File Management
 
Operating Systems: Computer Security
Operating Systems: Computer SecurityOperating Systems: Computer Security
Operating Systems: Computer Security
 
Operating Systems: Memory Management
Operating Systems: Memory ManagementOperating Systems: Memory Management
Operating Systems: Memory Management
 
Operating Systems: The Little-Man Computer
Operating Systems: The Little-Man ComputerOperating Systems: The Little-Man Computer
Operating Systems: The Little-Man Computer
 
Operating Systems: A History of MacOS
Operating Systems: A History of MacOSOperating Systems: A History of MacOS
Operating Systems: A History of MacOS
 
Operating Systems: Network Management
Operating Systems: Network ManagementOperating Systems: Network Management
Operating Systems: Network Management
 
Operating Systems: What happen in 2016?
Operating Systems: What happen in 2016?Operating Systems: What happen in 2016?
Operating Systems: What happen in 2016?
 
Operating Systems 1: Introduction
Operating Systems 1: IntroductionOperating Systems 1: Introduction
Operating Systems 1: Introduction
 
Operating Systems 1: Syllabus
Operating Systems 1: SyllabusOperating Systems 1: Syllabus
Operating Systems 1: Syllabus
 
Simple Data Compression
Simple Data CompressionSimple Data Compression
Simple Data Compression
 
Operating Systems: A History of Linux
Operating Systems: A History of LinuxOperating Systems: A History of Linux
Operating Systems: A History of Linux
 
Operating Systems: What happen in 2015?
Operating Systems: What happen in 2015?Operating Systems: What happen in 2015?
Operating Systems: What happen in 2015?
 
James Bond and the OSI Model
James Bond and the OSI ModelJames Bond and the OSI Model
James Bond and the OSI Model
 
Operating Systems: Device Management
Operating Systems: Device ManagementOperating Systems: Device Management
Operating Systems: Device Management
 
Operating Systems: Computer Security
Operating Systems: Computer SecurityOperating Systems: Computer Security
Operating Systems: Computer Security
 
Ch4
Ch4Ch4
Ch4
 

Semelhante a Operating Systems: Process Scheduling

Operating Systems - Process Scheduling
Operating Systems - Process SchedulingOperating Systems - Process Scheduling
Operating Systems - Process SchedulingDamian T. Gordon
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)Harshit Jain
 
Cpu scheduling algorithm on windows
Cpu scheduling algorithm on windowsCpu scheduling algorithm on windows
Cpu scheduling algorithm on windowssiddhartha pande
 
Process Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdfProcess Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdfRakibul Rakib
 
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round RobinComparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round RobinUniversitas Pembangunan Panca Budi
 
Processor / CPU Scheduling
Processor / CPU SchedulingProcessor / CPU Scheduling
Processor / CPU SchedulingIzaz Roghani
 
Scheduling 155 © David Lippman Creative Commons BY-SA.docx
Scheduling   155 © David Lippman  Creative Commons BY-SA.docxScheduling   155 © David Lippman  Creative Commons BY-SA.docx
Scheduling 155 © David Lippman Creative Commons BY-SA.docxdurantheseldine
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithmsShanu Kumar
 
Clock driven scheduling
Clock driven schedulingClock driven scheduling
Clock driven schedulingKamal Acharya
 
Operating Systems: Revision
Operating Systems: RevisionOperating Systems: Revision
Operating Systems: RevisionDamian T. Gordon
 

Semelhante a Operating Systems: Process Scheduling (20)

Operating Systems - Process Scheduling
Operating Systems - Process SchedulingOperating Systems - Process Scheduling
Operating Systems - Process Scheduling
 
Fcfs and sjf
Fcfs and sjfFcfs and sjf
Fcfs and sjf
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
 
Cp usched 2
Cp usched  2Cp usched  2
Cp usched 2
 
Cpu scheduling algorithm on windows
Cpu scheduling algorithm on windowsCpu scheduling algorithm on windows
Cpu scheduling algorithm on windows
 
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
 
Unit 2 notes
Unit 2 notesUnit 2 notes
Unit 2 notes
 
Scheduling
SchedulingScheduling
Scheduling
 
Process Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdfProcess Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdf
 
exp 3.docx
exp 3.docxexp 3.docx
exp 3.docx
 
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round RobinComparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
 
Processor / CPU Scheduling
Processor / CPU SchedulingProcessor / CPU Scheduling
Processor / CPU Scheduling
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
operating system 1
operating system 1operating system 1
operating system 1
 
Scheduling 155 © David Lippman Creative Commons BY-SA.docx
Scheduling   155 © David Lippman  Creative Commons BY-SA.docxScheduling   155 © David Lippman  Creative Commons BY-SA.docx
Scheduling 155 © David Lippman Creative Commons BY-SA.docx
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithms
 
Lab3F22.pdf
Lab3F22.pdfLab3F22.pdf
Lab3F22.pdf
 
Clock driven scheduling
Clock driven schedulingClock driven scheduling
Clock driven scheduling
 
Operating Systems: Revision
Operating Systems: RevisionOperating Systems: Revision
Operating Systems: Revision
 

Mais de Damian T. Gordon

Universal Design for Learning, Co-Designing with Students.
Universal Design for Learning, Co-Designing with Students.Universal Design for Learning, Co-Designing with Students.
Universal Design for Learning, Co-Designing with Students.Damian T. Gordon
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to MicroservicesDamian T. Gordon
 
Introduction to Cloud Computing
Introduction to Cloud ComputingIntroduction to Cloud Computing
Introduction to Cloud ComputingDamian T. Gordon
 
Evaluating Teaching: SECTIONS
Evaluating Teaching: SECTIONSEvaluating Teaching: SECTIONS
Evaluating Teaching: SECTIONSDamian T. Gordon
 
Evaluating Teaching: MERLOT
Evaluating Teaching: MERLOTEvaluating Teaching: MERLOT
Evaluating Teaching: MERLOTDamian T. Gordon
 
Evaluating Teaching: Anstey and Watson Rubric
Evaluating Teaching: Anstey and Watson RubricEvaluating Teaching: Anstey and Watson Rubric
Evaluating Teaching: Anstey and Watson RubricDamian T. Gordon
 
Designing Teaching: Pause Procedure
Designing Teaching: Pause ProcedureDesigning Teaching: Pause Procedure
Designing Teaching: Pause ProcedureDamian T. Gordon
 
Designing Teaching: ASSURE
Designing Teaching: ASSUREDesigning Teaching: ASSURE
Designing Teaching: ASSUREDamian T. Gordon
 
Designing Teaching: Laurilliard's Learning Types
Designing Teaching: Laurilliard's Learning TypesDesigning Teaching: Laurilliard's Learning Types
Designing Teaching: Laurilliard's Learning TypesDamian T. Gordon
 
Designing Teaching: Gagne's Nine Events of Instruction
Designing Teaching: Gagne's Nine Events of InstructionDesigning Teaching: Gagne's Nine Events of Instruction
Designing Teaching: Gagne's Nine Events of InstructionDamian T. Gordon
 
Designing Teaching: Elaboration Theory
Designing Teaching: Elaboration TheoryDesigning Teaching: Elaboration Theory
Designing Teaching: Elaboration TheoryDamian T. Gordon
 
Universally Designed Learning Spaces: Some Considerations
Universally Designed Learning Spaces: Some ConsiderationsUniversally Designed Learning Spaces: Some Considerations
Universally Designed Learning Spaces: Some ConsiderationsDamian T. Gordon
 

Mais de Damian T. Gordon (20)

Universal Design for Learning, Co-Designing with Students.
Universal Design for Learning, Co-Designing with Students.Universal Design for Learning, Co-Designing with Students.
Universal Design for Learning, Co-Designing with Students.
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
REST and RESTful Services
REST and RESTful ServicesREST and RESTful Services
REST and RESTful Services
 
Serverless Computing
Serverless ComputingServerless Computing
Serverless Computing
 
Cloud Identity Management
Cloud Identity ManagementCloud Identity Management
Cloud Identity Management
 
Containers and Docker
Containers and DockerContainers and Docker
Containers and Docker
 
Introduction to Cloud Computing
Introduction to Cloud ComputingIntroduction to Cloud Computing
Introduction to Cloud Computing
 
Introduction to ChatGPT
Introduction to ChatGPTIntroduction to ChatGPT
Introduction to ChatGPT
 
How to Argue Logically
How to Argue LogicallyHow to Argue Logically
How to Argue Logically
 
Evaluating Teaching: SECTIONS
Evaluating Teaching: SECTIONSEvaluating Teaching: SECTIONS
Evaluating Teaching: SECTIONS
 
Evaluating Teaching: MERLOT
Evaluating Teaching: MERLOTEvaluating Teaching: MERLOT
Evaluating Teaching: MERLOT
 
Evaluating Teaching: Anstey and Watson Rubric
Evaluating Teaching: Anstey and Watson RubricEvaluating Teaching: Anstey and Watson Rubric
Evaluating Teaching: Anstey and Watson Rubric
 
Evaluating Teaching: LORI
Evaluating Teaching: LORIEvaluating Teaching: LORI
Evaluating Teaching: LORI
 
Designing Teaching: Pause Procedure
Designing Teaching: Pause ProcedureDesigning Teaching: Pause Procedure
Designing Teaching: Pause Procedure
 
Designing Teaching: ADDIE
Designing Teaching: ADDIEDesigning Teaching: ADDIE
Designing Teaching: ADDIE
 
Designing Teaching: ASSURE
Designing Teaching: ASSUREDesigning Teaching: ASSURE
Designing Teaching: ASSURE
 
Designing Teaching: Laurilliard's Learning Types
Designing Teaching: Laurilliard's Learning TypesDesigning Teaching: Laurilliard's Learning Types
Designing Teaching: Laurilliard's Learning Types
 
Designing Teaching: Gagne's Nine Events of Instruction
Designing Teaching: Gagne's Nine Events of InstructionDesigning Teaching: Gagne's Nine Events of Instruction
Designing Teaching: Gagne's Nine Events of Instruction
 
Designing Teaching: Elaboration Theory
Designing Teaching: Elaboration TheoryDesigning Teaching: Elaboration Theory
Designing Teaching: Elaboration Theory
 
Universally Designed Learning Spaces: Some Considerations
Universally Designed Learning Spaces: Some ConsiderationsUniversally Designed Learning Spaces: Some Considerations
Universally Designed Learning Spaces: Some Considerations
 

Último

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 

Último (20)

Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

Operating Systems: Process Scheduling

  • 2.
  • 3.  What are good policies to schedule processes?
  • 4.  What are good policies to schedule processes? 1. Maximum Throughput 2. Minimize Response Time 3. Minimize Turnaround Time 4. Minimize Waiting Time 5. Maximise CPU Efficiency 6. Ensure Fairness For All Jobs
  • 5.  MAXIMUM THROUGHPUT  Get as many jobs done as quickly as possible.  There are several ways to achieve this, e.g. run only short jobs, run jobs without interruptions.
  • 6.  MINIMIZE RESPONSE TIME  Ensure that interactive requests are dealt with as quickly as possible.  This could be achieved by scheduling just with a lot of I/O jobs first, and leave the computational jobs for later.
  • 7.  MINIMIZE TURNAROUND TIME  Ensure that jobs are completed as quickly as possible.  This could be achieved by scheduling just with a lot of computation jobs first, and leave the I/O jobs for later, so there is no user delays.
  • 8.  MINIMIZE WAITING TIME  Move jobs out of the READY status as soon as possible.  This could be achieved by reduce the number of users allowed on the system, so that the CPU would be available whenever a job enters the READY status.
  • 9.  MAXIMISE CPU EFFICIENCY  Keep the CPU busy 100% of the time.  This could be achieved by scheduling just with a lot of computation jobs, and never run the I/O jobs.
  • 10.  ENSURE FAIRNESS FOR ALL JOBS  Give everyone an equal amount of CPU time and I/O time.  This could be achieved by giving all jobs equal priority, regardless of it’s characteristics.
  • 11.
  • 12.  Here are six commonly used process scheduling algorithms
  • 13.  Here are six commonly used process scheduling algorithms 1. First Come, First Served (FCFS) 2. Shortest Job Next (SJN) 3. Priority Scheduling 4. Shortest Remaining Time (SRT) 5. Round Robin 6. Multi-Level Queues
  • 14.  First Come, First Served (FCFS)  A very simple algorithm that uses a FIFO structure.  Implemented as a non-pre-emptive scheduling algorithm.  Works well for Batch Processes, where users don’t expect any interaction.
  • 15.  Shortest Job Next (SJN)  Also called Shortest Job First (SJF).  A very simple algorithm that schedules processes based on CPU cycle time.  Implemented as a non-pre-emptive scheduling algorithm.  Works well for Batch Processes, where it is easy to estimate CPU time.
  • 16.  Priority Scheduling  An algorithm that schedules processes based on priority.  Implemented as a non-pre-emptive scheduling algorithm.  One of the most common algorithms used in systems that are mainly Batch Processes.  If two jobs come in of equal priority are READY, if works on a FIRST COME, FIRST SERVED basis.
  • 17.  Shortest Remaining Time (SRT)  A pre-emptive scheduling version of the Shortest Job Next (SJN) algorithm.  An algorithm that schedules processes based on the one which is nearest to completion.  It can only be implemented on systems that are only Batch Processes, since you have to know the CPU time required to complete each job.
  • 18.  Round Robin  A pre-emptive scheduling algorithm that is used extensively in interactive systems  All active processes are given a pre- determined slice of time (“time quantum”).  Choosing the time quantum is the key decision, for interactive systems the quantum must be small, whereas for batch systems it can be longer.
  • 19.  Multi-Level Queues  This isn’t really a separate scheduling algorithm, it can be used with others.  Jobs are grouped together based on common characteristics.  For example, CPU-bound jobs based in one queue, and the I/O-bound jobs in another queue, and the process scheduler can select jobs from each queue based on balancing the load.
  • 20.
  • 21.  Deadlock can be said to occur when a process is allocated some non-sharable resources (such as files, printers or scanners), but is forced to wait for other non-sharable resources.
  • 22. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END.
  • 23. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END.
  • 24. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END.
  • 25. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END.
  • 26. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END. YES
  • 27. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END. Continue
  • 28. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END.
  • 29. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END.
  • 30. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END. NO
  • 31. WAIT PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END.
  • 32. WAIT PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END.
  • 33. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END.
  • 34. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END. PROGRAM ProcB: BEGIN Do Stuff; Open (File2); Do more stuff; Open (File1); Do stuff; END.
  • 35. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END. PROGRAM ProcB: BEGIN Do Stuff; Open (File2); Do more stuff; Open (File1); Do stuff; END.
  • 36. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END. PROGRAM ProcB: BEGIN Do Stuff; Open (File2); Do more stuff; Open (File1); Do stuff; END.
  • 37. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END. PROGRAM ProcB: BEGIN Do Stuff; Open (File2); Do more stuff; Open (File1); Do stuff; END.
  • 38. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END. PROGRAM ProcB: BEGIN Do Stuff; Open (File2); Do more stuff; Open (File1); Do stuff; END.
  • 39. PROGRAM ProcA: BEGIN Do Stuff; Open (File1); Do more stuff; Open (File2); Do stuff; END. PROGRAM ProcB: BEGIN Do Stuff; Open (File2); Do more stuff; Open (File1); Do stuff; END.
  • 53. 1. Deadlock on file requests 2. Deadlock in databases 3. Deadlock in dedicated device allocation 4. Deadlock in multiple device allocation 5. Deadlock in spooling 6. Deadlock in a network 7. Deadlock in disk sharing
  • 54.  We just saw it:
  • 55.  We just saw it: Process B File 1 File 2 Process A
  • 56.  Only occurs because a process is allowed to lock a resource for the duration of its execution.
  • 58. Begin transaction TA: read balance1 [ 100 ] balance1 = balance1 - 100 if balance < 0 print “insufficient funds” abort T1 end write balance1 [ 0 ] read balance2 [ 100 ]
  • 59. Begin transaction TA: read balance1 [ 100 ] balance1 = balance1 - 100 if balance < 0 print “insufficient funds” abort T1 end write balance1 [ 0 ] read balance2 [ 100 ] Begin transaction TB: read balance2 [ 100 ] balance2 = balance2 - 100 if balance < 0 print “insufficient funds” abort T2 end write balance2 [ 0 ] read balance1 [ 100 ]
  • 60. Begin transaction TB: read balance2 [ 100 ] balance2 = balance2 - 100 if balance < 0 print “insufficient funds” abort T2 end write balance2 [ 0 ] read balance1 [ 100 ] Begin transaction TA: read balance1 [ 100 ] balance1 = balance1 - 100 if balance < 0 print “insufficient funds” abort T1 end write balance1 [ 0 ] read balance2 [ 100 ]
  • 61. Begin transaction TB: read balance2 [ 100 ] balance2 = balance2 - 100 if balance < 0 print “insufficient funds” abort T2 end write balance2 [ 0 ] read balance1 [ 100 ] Begin transaction TA: read balance1 [ 100 ] balance1 = balance1 - 100 if balance < 0 print “insufficient funds” abort T1 end write balance1 [ 0 ] read balance2 [ 100 ]
  • 62.  For example DVD Read/Write drives
  • 64.  More than over device, e.g. DVD-R, printer, scanner.
  • 67.  What is Spooling?
  • 68.  What is Spooling?  SPOOL is an acronym for Simultaneous Peripheral Operations On-Line.
  • 69.  What is Spooling?  SPOOL is an acronym for Simultaneous Peripheral Operations On-Line.
  • 70.  What is Spooling?  SPOOL is an acronym for Simultaneous Peripheral Operations On-Line.  A simple example of a spooling application is print spooling, which places a print job a queue for extended or later processing.
  • 71.  What is Spooling?
  • 72.  If all 108 of you guys had a 10-page assignment you had to hand up by 11am and you all printed your files at the same time at 10:55am, the spool might first accept page 1 from everyone, then page 2, and so on.,, but if it gets to page 9 and then the spooler is full, things get stuck. The printer might not want to print any jobs unless it has a full 10 pages from any one job, so we are deadlocked.
  • 73.
  • 74.  For example, a medium-sized word- processing centre has seven computers on a network, each on different nodes. C1 receives messages from nodes C2, C6, and C7 and sends messages to only one: C2. C2 receives messages from nodes C1, C3, and C4 and sends messages to only C1 and C3. The direction of the arrows in the diagram indicates the flow of messages.
  • 75.  Messages received by C1 from C6 and C7 and destined for C2 are buffered in an output queue. Messages received by C2 from C3 and C4 and destined for C1 are buffered in an output queue. As the traffic increases, the length of each output queue increases until all of the available buffer space is filled. At this point C1 can’t accept any more messages (from C2 or any other computer) because there’s no more buffer space available to store them.
  • 76.  For the same reason, C2 can’t accept any messages from C1 or any other computer, not even a request to send. The communication path between C1 and C2 becomes deadlocked; and because C1 can’t send messages to any other computer except C2 and can only receive messages from C6 and C7, those routes also become deadlocked. C1 can’t send word to C2 about the problem and so the deadlock can’t be resolved without outside intervention.
  • 77.
  • 78.  For example, at an insurance company the system performs many daily transactions. One day the following series of events ties up the system:
  • 79.  1. Customer Service (P1) wishes to show a payment so it issues a command to read the balance, which is stored on track 20 of a disk.
  • 80.  2. While the control unit is moving the arm to track 20, P1 is put on hold and the I/O channel is free to process the next I/O request.
  • 81.  3. While the arm is moving into position, Accounts Payable (P2) gains control of the I/O channel and issues a command to write someone else’s payment to a record stored on track 310. If the command is not “locked out,” P2 will be put on hold while the control unit moves the arm to track 310.
  • 82.  4. Because P2 is “on hold” while the arm is moving, the channel can be captured again by P1, which reconfirms its command to “read from track 20.”
  • 83.  5. Because the last command from P2 had forced the arm mechanism to track 310, the disk control unit begins to reposition the arm to track 20 to satisfy P1. The I/O channel would be released because P1 is once again put on hold, so it could be captured by P2, which issues a WRITE command only to discover that the arm mechanism needs to be repositioned.
  • 84.  This is LIVELOCK.
  • 85.
  • 90.
  • 91.  Born May 11, 1930  Died August 6, 2002  Born in Rotterdam, Netherlands  A Dutch computer scientist, who received the 1972 Turing Award for fundamental contributions to developing programming languages.