SlideShare a Scribd company logo
1 of 18
Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Chapter 3: Processes
3.2 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th 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 explore interprocess communication using shared memory
and message passing
 To describe communication in client-server systems
3.3 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Process Concept
 An operating system executes a variety of
programs that run as processes.
 Process: a program in execution.
 Process consists of multiple parts:
• Text section: contains program code
• Current activity including program counter,
processor registers
• Stack containing temporary data such as
local variables
• Data section containing global variables
• Heap containing memory dynamically
allocated during run time
3.4 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Process Concept (Cont.)
 Program is passive entity stored on hard disk (executable
file); process is active entity
• Program becomes process when an executable file is
loaded into memory
 Execution of program starts via mouse clicks, command line
entry of its name, etc.
 One program can result in several processes
• Consider multiple users executing the same program
3.5 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Process State
 As a process executes, it changes state
• New: The process is being created
• Ready: The process is waiting to be assigned to a processor
• Running: Instructions are being executed
• Waiting: The process is waiting for some event to occur
• Terminated: The process has finished execution
3.6 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Process Scheduling
 Process scheduler selects among available processes for next
execution on CPU
 Goal -- Maximize CPU use, quickly switch processes onto CPU
 Maintains scheduling queues of processes
• Ready queue: set of all processes residing in main memory,
ready and waiting to execute
• Wait queues: set of processes waiting for an event (I/O operation
such as reading data from hard disk)
• Processes migrate among the various queues
3.7 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Schedulers
 Long-term scheduler (or job scheduler): selects which processes
should be brought into the ready queue from the job queue.
 The long-term scheduler controls the degree of multiprogramming,
(how many processes could be brought into the ready queue)
 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
 Long-term scheduler strives for a good combination of I/O bound and
CPU bound processes.
 Short-term scheduler (or CPU scheduler): selects which process
should be executed next and allocated to CPU
3.8 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Medium-Term Scheduling
 Medium-term scheduler: performs swapping. It can be added
to reduce the degree of multiple programming.
 Swap out: medium-term scheduler removes a process from
memory, and then stores it on hard disk, as suspended process
in virtual memory.
 Swap in: when the process is brought back into memory from
hard disk (Virtual Memory).
3.9 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
CPU Switch From Process to Process
A context switch occurs when the CPU switches from one process
to another.
 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.
 Context of a process is represented in
the Process Control Block (PCB)
 Context-switch time is pure overhead;
the system does no useful work while
switching.
3.10 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th 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 options
• Parent and children share all resources
• Children share subset of parent’s resources
• Parent and child share no resources
 Execution options
o Parent and children execute
concurrently
o Parent waits until children terminate
3.11 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Process Creation (Cont.)
 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
• Parent process calls wait()waiting for the child to terminate
3.12 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
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 termination:
• Child has exceeded allocated resources
• Task assigned to child is no longer required
3.13 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Process Termination (Cont.)
 For some operating systems, if a process terminates, then all its
children must also be terminated.
 The parent process may wait for termination of a child process
by using the wait()system call.
 If no parent is waiting, process is a zombie
 If parent is terminated, process is an orphan
3.14 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Interprocess Communication
 Processes within a system may be independent or cooperating
 Reasons for cooperating processes:
• Information sharing
• Computation speedup
• Modularity
 Cooperating processes need
interprocess communication (IPC)
 Two models of IPC
• Shared memory
• Message passing
(a) Shared memory. (b) Message passing.
3.15 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Examples of IPC Systems – Windows
 It follows message-passing model via local procedure call:
• Only works between processes on the same system
• Uses ports (like mailboxes) to establish and maintain communication
channels
• Communication works as follows:
 The client opens a handle (reference) to the subsystem’s connection
port object.
 The client sends a connection request.
 The server creates two private communication ports and returns the
handle to one of them to the client.
 The client and server then exchange messages.
3.16 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Sockets
 A socket is a concatenation of IP address and port number.
 It is included at start of message packet to differentiate network
services on a host
 The socket 161.25.19.8:1625 refers to port 1625 on host 161.25.19.8
 Communication occurs between a pair of sockets
 Special IP address 127.0.0.1 (loopback) to refer to system on which
process is running
3.17 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Remote Procedure Calls
 Remote procedure call (RPC)
abstracts procedure calls between
processes on networked systems
 Stubs – client-side proxy for the
actual procedure on the server
 The client-side stub locates the
server, and pass the parameters to
the remote procedure
 The server-side stub receives this
parameters, and performs the
procedure on the server.
 After server executes the
requested procedure, the output is
sent back to client.
 The client receives the output, and
continue the rest of the program.
3.18 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition
Pipes
 Acts as a conduit (channel) allowing two processes to communicate
 Ordinary pipes –a parent process creates a pipe and uses it to communicate
with its child process.
 Producer writes to one end of pipe
 Consumer reads from the other end of pipe
 Ordinary pipes are unidirectional
 Require parent-child relationship between communicating processes
 Named pipes – can be accessed without a parent-child relationship.
 more powerful than ordinary pipes
 Communication is bidirectional
 Several processes can use the named pipe for communication

More Related Content

Similar to Week03-Ch3-Process Concept.pptx.gfhgvjhg

Similar to Week03-Ch3-Process Concept.pptx.gfhgvjhg (20)

3 processes
3 processes3 processes
3 processes
 
2.ch3 Process (1).ppt
2.ch3 Process (1).ppt2.ch3 Process (1).ppt
2.ch3 Process (1).ppt
 
ch3_smu.ppt
ch3_smu.pptch3_smu.ppt
ch3_smu.ppt
 
Ch3OperSys
Ch3OperSysCh3OperSys
Ch3OperSys
 
OperatingSystemChp3
OperatingSystemChp3OperatingSystemChp3
OperatingSystemChp3
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
Chapter 3: Processes
Chapter 3: ProcessesChapter 3: Processes
Chapter 3: Processes
 
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
 
cs8493 - operating systems unit 2
cs8493 - operating systems unit 2cs8493 - operating systems unit 2
cs8493 - operating systems unit 2
 
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...
 
OS UNIT2.ppt
OS UNIT2.pptOS UNIT2.ppt
OS UNIT2.ppt
 
ch3-lect7.pptx
ch3-lect7.pptxch3-lect7.pptx
ch3-lect7.pptx
 

Recently uploaded

Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutionsmonugehlot87
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 

Recently uploaded (20)

Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutions
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 

Week03-Ch3-Process Concept.pptx.gfhgvjhg

  • 1. Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Chapter 3: Processes
  • 2. 3.2 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th 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 explore interprocess communication using shared memory and message passing  To describe communication in client-server systems
  • 3. 3.3 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Process Concept  An operating system executes a variety of programs that run as processes.  Process: a program in execution.  Process consists of multiple parts: • Text section: contains program code • Current activity including program counter, processor registers • Stack containing temporary data such as local variables • Data section containing global variables • Heap containing memory dynamically allocated during run time
  • 4. 3.4 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Process Concept (Cont.)  Program is passive entity stored on hard disk (executable file); process is active entity • Program becomes process when an executable file is loaded into memory  Execution of program starts via mouse clicks, command line entry of its name, etc.  One program can result in several processes • Consider multiple users executing the same program
  • 5. 3.5 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Process State  As a process executes, it changes state • New: The process is being created • Ready: The process is waiting to be assigned to a processor • Running: Instructions are being executed • Waiting: The process is waiting for some event to occur • Terminated: The process has finished execution
  • 6. 3.6 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Process Scheduling  Process scheduler selects among available processes for next execution on CPU  Goal -- Maximize CPU use, quickly switch processes onto CPU  Maintains scheduling queues of processes • Ready queue: set of all processes residing in main memory, ready and waiting to execute • Wait queues: set of processes waiting for an event (I/O operation such as reading data from hard disk) • Processes migrate among the various queues
  • 7. 3.7 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Schedulers  Long-term scheduler (or job scheduler): selects which processes should be brought into the ready queue from the job queue.  The long-term scheduler controls the degree of multiprogramming, (how many processes could be brought into the ready queue)  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  Long-term scheduler strives for a good combination of I/O bound and CPU bound processes.  Short-term scheduler (or CPU scheduler): selects which process should be executed next and allocated to CPU
  • 8. 3.8 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Medium-Term Scheduling  Medium-term scheduler: performs swapping. It can be added to reduce the degree of multiple programming.  Swap out: medium-term scheduler removes a process from memory, and then stores it on hard disk, as suspended process in virtual memory.  Swap in: when the process is brought back into memory from hard disk (Virtual Memory).
  • 9. 3.9 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition CPU Switch From Process to Process A context switch occurs when the CPU switches from one process to another.  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.  Context of a process is represented in the Process Control Block (PCB)  Context-switch time is pure overhead; the system does no useful work while switching.
  • 10. 3.10 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th 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 options • Parent and children share all resources • Children share subset of parent’s resources • Parent and child share no resources  Execution options o Parent and children execute concurrently o Parent waits until children terminate
  • 11. 3.11 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Process Creation (Cont.)  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 • Parent process calls wait()waiting for the child to terminate
  • 12. 3.12 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 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 termination: • Child has exceeded allocated resources • Task assigned to child is no longer required
  • 13. 3.13 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Process Termination (Cont.)  For some operating systems, if a process terminates, then all its children must also be terminated.  The parent process may wait for termination of a child process by using the wait()system call.  If no parent is waiting, process is a zombie  If parent is terminated, process is an orphan
  • 14. 3.14 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Interprocess Communication  Processes within a system may be independent or cooperating  Reasons for cooperating processes: • Information sharing • Computation speedup • Modularity  Cooperating processes need interprocess communication (IPC)  Two models of IPC • Shared memory • Message passing (a) Shared memory. (b) Message passing.
  • 15. 3.15 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Examples of IPC Systems – Windows  It follows message-passing model via local procedure call: • Only works between processes on the same system • Uses ports (like mailboxes) to establish and maintain communication channels • Communication works as follows:  The client opens a handle (reference) to the subsystem’s connection port object.  The client sends a connection request.  The server creates two private communication ports and returns the handle to one of them to the client.  The client and server then exchange messages.
  • 16. 3.16 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Sockets  A socket is a concatenation of IP address and port number.  It is included at start of message packet to differentiate network services on a host  The socket 161.25.19.8:1625 refers to port 1625 on host 161.25.19.8  Communication occurs between a pair of sockets  Special IP address 127.0.0.1 (loopback) to refer to system on which process is running
  • 17. 3.17 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Remote Procedure Calls  Remote procedure call (RPC) abstracts procedure calls between processes on networked systems  Stubs – client-side proxy for the actual procedure on the server  The client-side stub locates the server, and pass the parameters to the remote procedure  The server-side stub receives this parameters, and performs the procedure on the server.  After server executes the requested procedure, the output is sent back to client.  The client receives the output, and continue the rest of the program.
  • 18. 3.18 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition Pipes  Acts as a conduit (channel) allowing two processes to communicate  Ordinary pipes –a parent process creates a pipe and uses it to communicate with its child process.  Producer writes to one end of pipe  Consumer reads from the other end of pipe  Ordinary pipes are unidirectional  Require parent-child relationship between communicating processes  Named pipes – can be accessed without a parent-child relationship.  more powerful than ordinary pipes  Communication is bidirectional  Several processes can use the named pipe for communication