SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition,
Chapter 3: Processes
3.2 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Chapter 3: Processes
 Process Concept
 Process Scheduling
 Operations on Processes
 Interprocess Communication
 Threads
 Multithreading
3.3 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Objectives
 To introduce the notion of a process -- a program in execution,
which forms the basis of all computation
 To describe the various features of processes, including
scheduling, creation and termination, and communication
 To describe communication in client-server systems
3.4 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Process Concept
 An operating system executes a variety of programs:
 Batch system – jobs
 Time-shared systems – user programs or tasks
 Textbook uses the terms job and process almost interchangeably
 Process – a program in execution; process execution must
progress in sequential fashion
 A process includes:
 program counter
 stack
 data section
3.5 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Process in Memory
3.6 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
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
3.7 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Diagram of Process State
3.8 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Process Control Block (PCB)
Information associated with each process
 Process state
 Program counter
 CPU registers
 CPU scheduling information
 Memory-management information
 Accounting information
 I/O status information
3.9 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Process Control Block (PCB)
3.10 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
CPU Switch From Process to Process
3.11 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Scheduling
The objective of multiprogramming is to have
some process running at all times, so as to
maximize CPU utilization. The objective of time-
sharing is to switch the CPU among processes so
frequently that users can interact with each
program while it is running. A uniprocessor
system can have only one running process.If
more processes exist, the rest must wait until the
CPU is free and can be rescheduled.
3.12 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Process Scheduling Queues
 Job queue – set of all processes in the system
 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
 Processes migrate among the various queues
3.13 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Ready Queue And Various I/O Device Queues
3.14 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Representation of Process Scheduling
3.15 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
1)The process could issue an I/O request, and
then be placed in an I/O queue.
2)The process could create a new subprocess
and wait for its termination.
3)The process could be removed forcibly from
the CPU, as a result of an interrupt, and be put
back in the ready queue.
Several events during execution
3.16 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Schedulers
 Long-term scheduler (or job scheduler) – selects which
processes should be brought into the ready queue
 Short-term scheduler (or CPU scheduler) – selects which
process should be executed next and allocates CPU
3.17 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Addition of Medium Term Scheduling
3.18 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Schedulers (Cont)
 Short-term scheduler is invoked very frequently (milliseconds) 
(must be fast)
 Long-term scheduler is invoked very infrequently (seconds,
minutes)  (may be slow)
 The long-term scheduler controls the degree of multiprogramming
 Processes can be described as either:
 I/O-bound process – spends more time doing I/O than
computations, many short CPU bursts
 CPU-bound process – spends more time doing computations;
few very long CPU bursts
3.19 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Context Switch
 When CPU switches to another process, the system must save the state of
the old process and load the saved state for the new process via a context
switch
 Context of a process represented in the PCB
 Context-switch time is overhead; the system does no useful work while
switching
 Time dependent on hardware support
3.20 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Process Creation
 Parent process create children processes, which, in turn create other
processes, forming a tree of processes
 Generally, process identified and managed via a process identifier (pid)
 Resource sharing
 Parent and children share all resources
 Children share subset of parent’s resources
 Parent and child share no resources
 Execution
 Parent and children execute concurrently
 Parent waits until children terminate
3.21 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Process Creation (Cont)
 Address space
 Child duplicate of parent
 Child has a program loaded into it
 UNIX examples
 fork system call creates new process
 exec system call used after a fork to replace the process’ memory
space with a new program
3.22 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
3.23 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Process Termination
 Process executes last statement and asks the operating system to
delete it (exit)
 Output data from child to parent (via wait)
 Process’ resources are deallocated by operating system
 Parent may terminate execution of children processes (abort)
 Child has exceeded allocated resources
 Task assigned to child is no longer required
 If parent is exiting
 Some operating system do not allow child to continue if its
parent terminates
– All children terminated - cascading termination
3.25 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Interprocess Communication
 Processes within a system may be independent or cooperating
 Cooperating process can affect or be affected by other processes,
including sharing data
 Reasons for cooperating processes:
 Information sharing
 Computation speedup
 Modularity
 Convenience
 Cooperating processes need interprocess communication (IPC)
 Two models of IPC
 Shared memory
 Message passing
3.26 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Communications Models
3.27 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Interprocess Communication – Message Passing
 Mechanism for processes to communicate and to synchronize their actions
 Message system – processes communicate with each other without
resorting to shared variables
 IPC facility provides two operations:
 send(message) – message size fixed or variable
 receive(message)
 If P and Q wish to communicate, they need to:
 establish a communication link between them
 exchange messages via send/receive
 Implementation of communication link
 physical (e.g., shared memory, hardware bus)
 logical (e.g., logical properties)
3.28 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Direct Communication
 Processes must name each other explicitly:
 send (P, message) – send a message to process P
 receive(Q, message) – receive a message from process Q
 Properties of communication link
 Links are established automatically
 A link is associated with exactly one pair of communicating processes
 Between each pair there exists exactly one link
 The link may be unidirectional, but is usually bi-directional
3.29 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Indirect Communication
 Messages are directed and received from mailboxes (also referred to as
ports)
 Each mailbox has a unique id
 Processes can communicate only if they share a mailbox
 send(A,message)
 receive(A,message)
 Properties of communication link
 Link established only if processes share a common mailbox
 A link may be associated with many processes
 Each pair of processes may share several communication links
 Link may be unidirectional or bi-directional
3.30 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Synchronization
 Message passing may be either blocking or non-blocking
 Blocking is considered synchronous
 Blocking send has the sender block until the message is
received
 Blocking receive has the receiver block until a message is
available
 Non-blocking is considered asynchronous
 Non-blocking send has the sender send the message and
continue
 Non-blocking receive has the receiver receive a valid message
or null
3.31 Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition
Buffering
 Queue of messages attached to the link; implemented in one of three
ways
1. Zero capacity – 0 messages
Sender must wait for receiver (rendezvous)
2. Bounded capacity – finite length of n messages
Sender must wait if link full
3. Unbounded capacity – infinite length
Sender never waits
Silberschatz, Galvin and Gagne ©2009
Operating System Concepts – 8th Edition,
End of Chapter 3

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (19)

Ch3
Ch3Ch3
Ch3
 
Template 1 ch3
Template 1 ch3Template 1 ch3
Template 1 ch3
 
Chapter 14 Computer Architecture
Chapter 14 Computer ArchitectureChapter 14 Computer Architecture
Chapter 14 Computer Architecture
 
Deadlocks
DeadlocksDeadlocks
Deadlocks
 
Slides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And GagneSlides For Operating System Concepts By Silberschatz Galvin And Gagne
Slides For Operating System Concepts By Silberschatz Galvin And Gagne
 
Ch03
Ch03Ch03
Ch03
 
Operating systems chapter 5 silberschatz
Operating systems chapter 5 silberschatzOperating systems chapter 5 silberschatz
Operating systems chapter 5 silberschatz
 
Unit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process SynchronizationUnit II - 3 - Operating System - Process Synchronization
Unit II - 3 - Operating System - Process Synchronization
 
Main memory-2 (ch8,os)
Main memory-2 (ch8,os)Main memory-2 (ch8,os)
Main memory-2 (ch8,os)
 
Ch2
Ch2Ch2
Ch2
 
Chapter 18 - Distributed Coordination
Chapter 18 - Distributed CoordinationChapter 18 - Distributed Coordination
Chapter 18 - Distributed Coordination
 
OS_Ch4
OS_Ch4OS_Ch4
OS_Ch4
 
Ch4 OS
Ch4 OSCh4 OS
Ch4 OS
 
Process
ProcessProcess
Process
 
Ch4 threads
Ch4 threadsCh4 threads
Ch4 threads
 
cs8493 - operating systems unit 2
cs8493 - operating systems unit 2cs8493 - operating systems unit 2
cs8493 - operating systems unit 2
 
OSCh17
OSCh17OSCh17
OSCh17
 
Ch1
Ch1Ch1
Ch1
 
Operating System : Ch18 distributed coordination
Operating System : Ch18 distributed coordinationOperating System : Ch18 distributed coordination
Operating System : Ch18 distributed coordination
 

Ähnlich wie Ch3 processes

Ähnlich wie Ch3 processes (20)

Ch3OperSys
Ch3OperSysCh3OperSys
Ch3OperSys
 
ch3_smu.ppt
ch3_smu.pptch3_smu.ppt
ch3_smu.ppt
 
OS UNIT2.ppt
OS UNIT2.pptOS UNIT2.ppt
OS UNIT2.ppt
 
Chapter 3: Processes
Chapter 3: ProcessesChapter 3: Processes
Chapter 3: Processes
 
Unit II - 1 - Operating System Process
Unit II - 1 - Operating System ProcessUnit II - 1 - Operating System Process
Unit II - 1 - Operating System Process
 
ch3-lect7.pptx
ch3-lect7.pptxch3-lect7.pptx
ch3-lect7.pptx
 
2.ch3 Process (1).ppt
2.ch3 Process (1).ppt2.ch3 Process (1).ppt
2.ch3 Process (1).ppt
 
ch3 (1).ppt
ch3 (1).pptch3 (1).ppt
ch3 (1).ppt
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
Lecture_Process.ppt
Lecture_Process.pptLecture_Process.ppt
Lecture_Process.ppt
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
ch3 s ppt
ch3 s                                  pptch3 s                                  ppt
ch3 s ppt
 
Processes
ProcessesProcesses
Processes
 
Operating System
Operating SystemOperating System
Operating System
 
process management.ppt
process management.pptprocess management.ppt
process management.ppt
 
ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 c...
ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 c...ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 c...
ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 ch3 c...
 
Week03-Ch3-Process Concept.pptx.gfhgvjhg
Week03-Ch3-Process Concept.pptx.gfhgvjhgWeek03-Ch3-Process Concept.pptx.gfhgvjhg
Week03-Ch3-Process Concept.pptx.gfhgvjhg
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
14712-l4.pptx
14712-l4.pptx14712-l4.pptx
14712-l4.pptx
 

Mehr von Ankit Dubey

Unit 1 android and it's tools quiz {mad cwipedia}
Unit 1 android and it's tools quiz {mad cwipedia}Unit 1 android and it's tools quiz {mad cwipedia}
Unit 1 android and it's tools quiz {mad cwipedia}Ankit Dubey
 
Ch5 cpu-scheduling
Ch5 cpu-schedulingCh5 cpu-scheduling
Ch5 cpu-schedulingAnkit Dubey
 
Ch2 system structure
Ch2 system structureCh2 system structure
Ch2 system structureAnkit Dubey
 
Ch1 introduction-to-os
Ch1 introduction-to-osCh1 introduction-to-os
Ch1 introduction-to-osAnkit Dubey
 
Mongodb mock test_ii
Mongodb mock test_iiMongodb mock test_ii
Mongodb mock test_iiAnkit Dubey
 
Android mock test_iii
Android mock test_iiiAndroid mock test_iii
Android mock test_iiiAnkit Dubey
 
Android mock test_ii
Android mock test_iiAndroid mock test_ii
Android mock test_iiAnkit Dubey
 
Ajp notes-chapter-06
Ajp notes-chapter-06Ajp notes-chapter-06
Ajp notes-chapter-06Ankit Dubey
 
Ajp notes-chapter-05
Ajp notes-chapter-05Ajp notes-chapter-05
Ajp notes-chapter-05Ankit Dubey
 
Ajp notes-chapter-04
Ajp notes-chapter-04Ajp notes-chapter-04
Ajp notes-chapter-04Ankit Dubey
 
Ajp notes-chapter-03
Ajp notes-chapter-03Ajp notes-chapter-03
Ajp notes-chapter-03Ankit Dubey
 
Ajp notes-chapter-02
Ajp notes-chapter-02Ajp notes-chapter-02
Ajp notes-chapter-02Ankit Dubey
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01Ankit Dubey
 

Mehr von Ankit Dubey (20)

Unit 1 android and it's tools quiz {mad cwipedia}
Unit 1 android and it's tools quiz {mad cwipedia}Unit 1 android and it's tools quiz {mad cwipedia}
Unit 1 android and it's tools quiz {mad cwipedia}
 
Scheduling
Scheduling Scheduling
Scheduling
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Ch5 cpu-scheduling
Ch5 cpu-schedulingCh5 cpu-scheduling
Ch5 cpu-scheduling
 
Ch2 system structure
Ch2 system structureCh2 system structure
Ch2 system structure
 
Ch1 introduction-to-os
Ch1 introduction-to-osCh1 introduction-to-os
Ch1 introduction-to-os
 
Android i
Android iAndroid i
Android i
 
Mongodb mock test_ii
Mongodb mock test_iiMongodb mock test_ii
Mongodb mock test_ii
 
Android mock test_iii
Android mock test_iiiAndroid mock test_iii
Android mock test_iii
 
Android mock test_ii
Android mock test_iiAndroid mock test_ii
Android mock test_ii
 
Ajp notes-chapter-06
Ajp notes-chapter-06Ajp notes-chapter-06
Ajp notes-chapter-06
 
Ajp notes-chapter-05
Ajp notes-chapter-05Ajp notes-chapter-05
Ajp notes-chapter-05
 
Ajp notes-chapter-04
Ajp notes-chapter-04Ajp notes-chapter-04
Ajp notes-chapter-04
 
Ajp notes-chapter-03
Ajp notes-chapter-03Ajp notes-chapter-03
Ajp notes-chapter-03
 
Ajp notes-chapter-02
Ajp notes-chapter-02Ajp notes-chapter-02
Ajp notes-chapter-02
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01
 

Kürzlich hochgeladen

Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadhamedmustafa094
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxchumtiyababu
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 

Kürzlich hochgeladen (20)

Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 

Ch3 processes

  • 1. Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition, Chapter 3: Processes
  • 2. 3.2 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Chapter 3: Processes  Process Concept  Process Scheduling  Operations on Processes  Interprocess Communication  Threads  Multithreading
  • 3. 3.3 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Objectives  To introduce the notion of a process -- a program in execution, which forms the basis of all computation  To describe the various features of processes, including scheduling, creation and termination, and communication  To describe communication in client-server systems
  • 4. 3.4 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Process Concept  An operating system executes a variety of programs:  Batch system – jobs  Time-shared systems – user programs or tasks  Textbook uses the terms job and process almost interchangeably  Process – a program in execution; process execution must progress in sequential fashion  A process includes:  program counter  stack  data section
  • 5. 3.5 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Process in Memory
  • 6. 3.6 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition 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
  • 7. 3.7 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Diagram of Process State
  • 8. 3.8 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Process Control Block (PCB) Information associated with each process  Process state  Program counter  CPU registers  CPU scheduling information  Memory-management information  Accounting information  I/O status information
  • 9. 3.9 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Process Control Block (PCB)
  • 10. 3.10 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition CPU Switch From Process to Process
  • 11. 3.11 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Scheduling The objective of multiprogramming is to have some process running at all times, so as to maximize CPU utilization. The objective of time- sharing is to switch the CPU among processes so frequently that users can interact with each program while it is running. A uniprocessor system can have only one running process.If more processes exist, the rest must wait until the CPU is free and can be rescheduled.
  • 12. 3.12 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Process Scheduling Queues  Job queue – set of all processes in the system  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  Processes migrate among the various queues
  • 13. 3.13 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Ready Queue And Various I/O Device Queues
  • 14. 3.14 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Representation of Process Scheduling
  • 15. 3.15 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition 1)The process could issue an I/O request, and then be placed in an I/O queue. 2)The process could create a new subprocess and wait for its termination. 3)The process could be removed forcibly from the CPU, as a result of an interrupt, and be put back in the ready queue. Several events during execution
  • 16. 3.16 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Schedulers  Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue  Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU
  • 17. 3.17 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Addition of Medium Term Scheduling
  • 18. 3.18 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Schedulers (Cont)  Short-term scheduler is invoked very frequently (milliseconds)  (must be fast)  Long-term scheduler is invoked very infrequently (seconds, minutes)  (may be slow)  The long-term scheduler controls the degree of multiprogramming  Processes can be described as either:  I/O-bound process – spends more time doing I/O than computations, many short CPU bursts  CPU-bound process – spends more time doing computations; few very long CPU bursts
  • 19. 3.19 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Context Switch  When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process via a context switch  Context of a process represented in the PCB  Context-switch time is overhead; the system does no useful work while switching  Time dependent on hardware support
  • 20. 3.20 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Process Creation  Parent process create children processes, which, in turn create other processes, forming a tree of processes  Generally, process identified and managed via a process identifier (pid)  Resource sharing  Parent and children share all resources  Children share subset of parent’s resources  Parent and child share no resources  Execution  Parent and children execute concurrently  Parent waits until children terminate
  • 21. 3.21 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Process Creation (Cont)  Address space  Child duplicate of parent  Child has a program loaded into it  UNIX examples  fork system call creates new process  exec system call used after a fork to replace the process’ memory space with a new program
  • 22. 3.22 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition
  • 23. 3.23 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Process Termination  Process executes last statement and asks the operating system to delete it (exit)  Output data from child to parent (via wait)  Process’ resources are deallocated by operating system  Parent may terminate execution of children processes (abort)  Child has exceeded allocated resources  Task assigned to child is no longer required  If parent is exiting  Some operating system do not allow child to continue if its parent terminates – All children terminated - cascading termination
  • 24. 3.25 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Interprocess Communication  Processes within a system may be independent or cooperating  Cooperating process can affect or be affected by other processes, including sharing data  Reasons for cooperating processes:  Information sharing  Computation speedup  Modularity  Convenience  Cooperating processes need interprocess communication (IPC)  Two models of IPC  Shared memory  Message passing
  • 25. 3.26 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Communications Models
  • 26. 3.27 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Interprocess Communication – Message Passing  Mechanism for processes to communicate and to synchronize their actions  Message system – processes communicate with each other without resorting to shared variables  IPC facility provides two operations:  send(message) – message size fixed or variable  receive(message)  If P and Q wish to communicate, they need to:  establish a communication link between them  exchange messages via send/receive  Implementation of communication link  physical (e.g., shared memory, hardware bus)  logical (e.g., logical properties)
  • 27. 3.28 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Direct Communication  Processes must name each other explicitly:  send (P, message) – send a message to process P  receive(Q, message) – receive a message from process Q  Properties of communication link  Links are established automatically  A link is associated with exactly one pair of communicating processes  Between each pair there exists exactly one link  The link may be unidirectional, but is usually bi-directional
  • 28. 3.29 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Indirect Communication  Messages are directed and received from mailboxes (also referred to as ports)  Each mailbox has a unique id  Processes can communicate only if they share a mailbox  send(A,message)  receive(A,message)  Properties of communication link  Link established only if processes share a common mailbox  A link may be associated with many processes  Each pair of processes may share several communication links  Link may be unidirectional or bi-directional
  • 29. 3.30 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Synchronization  Message passing may be either blocking or non-blocking  Blocking is considered synchronous  Blocking send has the sender block until the message is received  Blocking receive has the receiver block until a message is available  Non-blocking is considered asynchronous  Non-blocking send has the sender send the message and continue  Non-blocking receive has the receiver receive a valid message or null
  • 30. 3.31 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition Buffering  Queue of messages attached to the link; implemented in one of three ways 1. Zero capacity – 0 messages Sender must wait for receiver (rendezvous) 2. Bounded capacity – finite length of n messages Sender must wait if link full 3. Unbounded capacity – infinite length Sender never waits
  • 31. Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8th Edition, End of Chapter 3