SlideShare a Scribd company logo
1 of 6
Download to read offline
Slides for Operating System Concepts,
                                                                                                                                    By Silberschatz, Galvin, and Gagne
                                                                                                                             http://www.wiley.com/college/silberschatz



                                Chapter 4: Processes                                                                               Process Concept

                                                                                                                 n An operating system executes a variety of programs:
                        n Process Concept                                                                           F Batch system – jobs
                        n Process Scheduling                                                                        F Time-shared systems – user programs or tasks
                        n Operations on Processes                                                                n Textbook uses the terms job and process almost
                        n Cooperating Processes                                                                       interchangeably.
                        n Interprocess Communication                                                             n Process – a program in execution; process execution
                        n Communication in Client-Server Systems                                                      must progress in sequential fashion.
                                                                                                                 n A process includes:
                                                                                                                    F program counter
                                                                                                                    F stack
                                                                                                                    F data section




Operating System Concepts                      4.1        Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                     4.2           Silberschatz, Galvin and Gagne ”2002




                                    Process State                                                                               Diagram of Process State


               n As a process executes, it changes state
                  F new: The process is being created.
                  F running: Instructions are being executed.
                  F waiting: The process is waiting for some event to occur.
                  F ready: The process is waiting to be assigned to a process.
                  F terminated: The process has finished execution.




Operating System Concepts                      4.3        Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                     4.4           Silberschatz, Galvin and Gagne ”2002




                            Process Control Block (PCB)                                                                       Process Control Block (PCB)

                       Information associated with each process.
                       n Process state
                       n Program counter
                       n CPU registers
                       n CPU scheduling information
                       n Memory-management information
                       n Accounting information
                       n I/O status information




Operating System Concepts                      4.5        Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                     4.6           Silberschatz, Galvin and Gagne ”2002
Slides for Operating System Concepts,
                                                                                                                                         By Silberschatz, Galvin, and Gagne
                                                                                                                                  http://www.wiley.com/college/silberschatz



                    CPU Switch From Process to Process                                                                                Process Scheduling Queues

                                                                                                                      n Job queue – set of all processes in the system.
                                                                                                                      n Ready queue – set of all processes residing in main
                                                                                                                            memory, ready and waiting to execute.
                                                                                                                      n Device queues – set of processes waiting for an I/O
                                                                                                                            device.
                                                                                                                      n Process migration between the various queues.




Operating System Concepts                          4.7         Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                     4.8        Silberschatz, Galvin and Gagne ”2002




                 Ready Queue And Various I/O Device Queues                                                                                      Schedulers


                                                                                                                      n Long-term scheduler (or job scheduler) – selects which
                                                                                                                           processes should be brought into the ready queue.
                                                                                                                      n Short-term scheduler (or CPU scheduler) – selects which
                                                                                                                           process should be executed next and allocates CPU.




Operating System Concepts                          4.9         Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                    4.10        Silberschatz, Galvin and Gagne ”2002




                                        Schedulers (Cont.)                                                                                   Context Switch

                n Short-term scheduler is invoked very frequently                                                     n When CPU switches to another process, the system must
                  (milliseconds) fi (must be fast).                                                                      save the state of the old process and load the saved state
                n Long-term scheduler is invoked very infrequently                                                      for the new process.
                  (seconds, minutes) fi (may be slow).                                                                 n Context-switch time is overhead; the system does no
                n The long-term scheduler controls the degree of                                                        useful work while switching.
                  multiprogramming.                                                                                   n Time dependent on hardware support.
                n Processes can be described as either:
                        F I/O-bound process – spends more time doing I/O than
                            computations, many short CPU bursts.
                        F CPU-bound process – spends more time doing
                            computations; few very long CPU bursts.




Operating System Concepts                         4.11         Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                    4.12        Silberschatz, Galvin and Gagne ”2002
Slides for Operating System Concepts,
                                                                                                                                           By Silberschatz, Galvin, and Gagne
                                                                                                                                    http://www.wiley.com/college/silberschatz



                                         Process Creation                                                                                     Process Creation (Cont.)

                n Parent process create children processes, which, in turn                                              n Address space
                  create other processes, forming a tree of processes.                                                     F Child duplicate of parent.
                n Resource sharing                                                                                         F Child has a program loaded into it.
                        F Parent and children share all resources.                                                      n UNIX examples
                        F Children share subset of parent’s resources.                                                     F fork system call creates new process
                        F Parent and child share no resources.                                                             F exec system call used after a fork to replace the process’
                n Execution                                                                                                  memory space with a new program.
                   F Parent and children execute concurrently.
                   F Parent waits until children terminate.




Operating System Concepts                         4.13           Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                            4.14        Silberschatz, Galvin and Gagne ”2002




                    Processes Tree on a UNIX System                                                                                            Process Termination

                                                                                                                        n Process executes last statement and asks the operating
                                                                                                                              system to decide it (exit).
                                                                                                                                F Output data from child to parent (via wait).
                                                                                                                                F Process’ resources are deallocated by operating system.
                                                                                                                        n Parent may terminate execution of children processes
                                                                                                                              (abort).
                                                                                                                                F Child has exceeded allocated resources.
                                                                                                                                F Task assigned to child is no longer required.
                                                                                                                                F Parent is exiting.
                                                                                                                                     4 Operating system does not allow child to continue if its
                                                                                                                                        parent terminates.
                                                                                                                                     4 Cascading termination.




Operating System Concepts                         4.15           Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                            4.16        Silberschatz, Galvin and Gagne ”2002




                                   Cooperating Processes                                                                               Producer-Consumer Problem

                n Independent process cannot affect or be affected by the                                               n Paradigm for cooperating processes, producer process
                  execution of another process.                                                                               produces information that is consumed by a consumer
                n Cooperating process can affect or be affected by the                                                        process.
                  execution of another process                                                                                  F unbounded-buffer places no practical limit on the size of the
                                                                                                                                    buffer.
                n Advantages of process cooperation
                                                                                                                                F bounded-buffer assumes that there is a fixed buffer size.
                        F Information sharing
                        F Computation speed-up
                        F Modularity
                        F Convenience




Operating System Concepts                         4.17           Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                            4.18        Silberschatz, Galvin and Gagne ”2002
Slides for Operating System Concepts,
                                                                                                                                       By Silberschatz, Galvin, and Gagne
                                                                                                                                http://www.wiley.com/college/silberschatz



                     Bounded-Buffer – Shared-Memory Solution                                                              Bounded-Buffer – Producer Process
                     n Shared data
                                 #define BUFFER_SIZE 10
                                 Typedef struct {                                                                        item nextProduced;
                                    ...
                                 } item;                                                                                 while (1) {
                                 item buffer[BUFFER_SIZE];                                                                    while (((in + 1) % BUFFER_SIZE) == out)
                                 int in = 0;                                                                                            ; /* do nothing */
                                 int out = 0;                                                                                 buffer[in] = nextProduced;
                     n Solution is correct, but can only use BUFFER_SIZE-1                                                    in = (in + 1) % BUFFER_SIZE;
                       elements                                                                                          }




Operating System Concepts                     4.19          Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                      4.20          Silberschatz, Galvin and Gagne ”2002




                     Bounded-Buffer – Consumer Process                                                                         Interprocess Communication (IPC)

                                                                                                                   n Mechanism for processes to communicate and to
                      item nextConsumed;                                                                                 synchronize their actions.
                                                                                                                   n Message system – processes communicate with each
                      while (1) {                                                                                        other without resorting to shared variables.
                           while (in == out)                                                                       n IPC facility provides two operations:
                                    ; /* do nothing */                                                                 F send(message) – message size fixed or variable
                           nextConsumed = buffer[out];                                                                 F receive(message)
                           out = (out + 1) % BUFFER_SIZE;
                                                                                                                   n If P and Q wish to communicate, they need to:
                      }
                                                                                                                       F establish a communication link between them
                                                                                                                       F exchange messages via send/receive
                                                                                                                   n Implementation of communication link
                                                                                                                       F physical (e.g., shared memory, hardware bus)
                                                                                                                       F logical (e.g., logical properties)




Operating System Concepts                     4.21          Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                      4.22          Silberschatz, Galvin and Gagne ”2002




                               Implementation Questions                                                                              Direct Communication

                n How are links established?                                                                       n Processes must name each other explicitly:
                n Can a link be associated with more than two processes?                                              F send (P, message) – send a message to process P
                n How many links can there be between every pair of                                                   F receive(Q, message) – receive a message from process Q
                      communicating processes?                                                                     n Properties of communication link
                n What is the capacity of a link?                                                                     F Links are established automatically.
                n Is the size of a message that the link can accommodate                                              F A link is associated with exactly one pair of communicating
                      fixed or variable?                                                                                processes.
                                                                                                                      F Between each pair there exists exactly one link.
                n Is a link unidirectional or bi-directional?
                                                                                                                      F The link may be unidirectional, but is usually bi-directional.




Operating System Concepts                     4.23          Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                      4.24          Silberschatz, Galvin and Gagne ”2002
Slides for Operating System Concepts,
                                                                                                                                          By Silberschatz, Galvin, and Gagne
                                                                                                                                   http://www.wiley.com/college/silberschatz



                                     Indirect Communication                                                                            Indirect Communication
                  n Messages are directed and received from mailboxes
                        (also referred to as ports).                                                                   n Operations
                            F Each mailbox has a unique id.                                                               F create a new mailbox
                            F Processes can communicate only if they share a mailbox.                                     F send and receive messages through mailbox
                  n Properties of communication link                                                                      F destroy a mailbox
                     F Link established only if processes share a common mailbox                                       n Primitives are defined as:
                     F A link may be associated with many processes.                                                         send(A, message) – send a message to mailbox A
                     F Each pair of processes may share several communication                                                receive(A, message) – receive a message from mailbox A
                       links.
                     F Link may be unidirectional or bi-directional.




Operating System Concepts                           4.25        Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                    4.26       Silberschatz, Galvin and Gagne ”2002




                                     Indirect Communication                                                                                  Synchronization

                n Mailbox sharing                                                                                      n Message passing may be either blocking or non-blocking.
                   F P1 , P2 , and P3 share mailbox A.                                                                 n Blocking is considered synchronous
                   F P1 , sends; P2 and P3 receive.                                                                    n Non-blocking is considered asynchronous
                   F Who gets the message?                                                                             n send and receive primitives may be either blocking or
                n Solutions                                                                                                  non-blocking.
                   F Allow a link to be associated with at most two processes.
                   F Allow only one process at a time to execute a receive
                     operation.
                   F Allow the system to select arbitrarily the receiver. Sender is
                     notified who the receiver was.




Operating System Concepts                           4.27        Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                    4.28       Silberschatz, Galvin and Gagne ”2002




                                                  Buffering                                                                         Client-Server Communication

                n Queue of messages attached to the link; implemented in                                               n Sockets
                      one of three ways.                                                                               n Remote Procedure Calls
                        1. Zero capacity – 0 messages                                                                  n Remote Method Invocation (Java)
                           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.




Operating System Concepts                           4.29        Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                    4.30       Silberschatz, Galvin and Gagne ”2002
Slides for Operating System Concepts,
                                                                                                                                 By Silberschatz, Galvin, and Gagne
                                                                                                                          http://www.wiley.com/college/silberschatz



                                           Sockets                                                                             Socket Communication

                n A socket is defined as an endpoint for communication.
                n Concatenation of IP address and port
                n The socket 161.25.19.8:1625 refers to port 1625 on host
                      161.25.19.8
                n Communication consists between a pair of sockets.




Operating System Concepts                  4.31        Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                    4.32    Silberschatz, Galvin and Gagne ”2002




                               Remote Procedure Calls                                                                       Remote Method Invocation

                n Remote procedure call (RPC) abstracts procedure calls                                       n Remote Method Invocation (RMI) is a Java mechanism
                  between processes on networked systems.                                                           similar to RPCs.
                n Stubs – client-side proxy for the actual procedure on the                                   n RMI allows a Java program on one machine to invoke a
                  server.                                                                                           method on a remote object.
                n The client-side stub locates the server and marshalls the
                  parameters.
                n The server-side stub receives this message, unpacks the
                  marshalled parameters, and peforms the procedure on
                  the server.




Operating System Concepts                  4.33        Silberschatz, Galvin and Gagne ”2002   Operating System Concepts                    4.34    Silberschatz, Galvin and Gagne ”2002




                                Marshalling Parameters




Operating System Concepts                  4.35        Silberschatz, Galvin and Gagne ”2002

More Related Content

What's hot

file system in operating system
file system in operating systemfile system in operating system
file system in operating system
tittuajay
 
Chapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationChapter 6 - Process Synchronization
Chapter 6 - Process Synchronization
Wayne Jones Jnr
 

What's hot (20)

Ch6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinCh6 CPU Scheduling galvin
Ch6 CPU Scheduling galvin
 
Chapter 9 Operating Systems silberschatz
Chapter 9 Operating Systems silberschatzChapter 9 Operating Systems silberschatz
Chapter 9 Operating Systems silberschatz
 
Lecture#5
Lecture#5Lecture#5
Lecture#5
 
file system in operating system
file system in operating systemfile system in operating system
file system in operating system
 
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
 
Operating systems chapter 5 silberschatz
Operating systems chapter 5 silberschatzOperating systems chapter 5 silberschatz
Operating systems chapter 5 silberschatz
 
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
 
Memory management
Memory managementMemory management
Memory management
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
 
cpu scheduling
cpu schedulingcpu scheduling
cpu scheduling
 
File Management in Operating Systems
File Management in Operating SystemsFile Management in Operating Systems
File Management in Operating Systems
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
 
Ch1-Operating System Concept
Ch1-Operating System ConceptCh1-Operating System Concept
Ch1-Operating System Concept
 
Mutual exclusion and sync
Mutual exclusion and syncMutual exclusion and sync
Mutual exclusion and sync
 
Linux System Programming - File I/O
Linux System Programming - File I/O Linux System Programming - File I/O
Linux System Programming - File I/O
 
CS9222 Advanced Operating System
CS9222 Advanced Operating SystemCS9222 Advanced Operating System
CS9222 Advanced Operating System
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Chapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationChapter 6 - Process Synchronization
Chapter 6 - Process Synchronization
 
Process state in OS
Process state in OSProcess state in OS
Process state in OS
 
5 process synchronization
5 process synchronization5 process synchronization
5 process synchronization
 

Similar to Slides For Operating System Concepts By Silberschatz Galvin And Gagne

An Infrastructure for Team Development - Gaylord Aulke
An Infrastructure for Team Development - Gaylord AulkeAn Infrastructure for Team Development - Gaylord Aulke
An Infrastructure for Team Development - Gaylord Aulke
dpc
 
Process Synchronisation Operating System
Process Synchronisation Operating SystemProcess Synchronisation Operating System
Process Synchronisation Operating System
DRAnithaSofiaLizCSES
 

Similar to Slides For Operating System Concepts By Silberschatz Galvin And Gagne (20)

Chapter03
Chapter03Chapter03
Chapter03
 
Ch04
Ch04Ch04
Ch04
 
ch3_EN_BK_Process.pdf
ch3_EN_BK_Process.pdfch3_EN_BK_Process.pdf
ch3_EN_BK_Process.pdf
 
Processes
ProcessesProcesses
Processes
 
Chapter01
Chapter01Chapter01
Chapter01
 
Ch4
Ch4Ch4
Ch4
 
Process
ProcessProcess
Process
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Lecture - 2.pptx
Lecture - 2.pptxLecture - 2.pptx
Lecture - 2.pptx
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
 
ICTSS 2010 - Iterative Software Testing Process for Scrum and Waterfall Projects
ICTSS 2010 - Iterative Software Testing Process for Scrum and Waterfall ProjectsICTSS 2010 - Iterative Software Testing Process for Scrum and Waterfall Projects
ICTSS 2010 - Iterative Software Testing Process for Scrum and Waterfall Projects
 
05-Process-Synchronization.pdf
05-Process-Synchronization.pdf05-Process-Synchronization.pdf
05-Process-Synchronization.pdf
 
An Infrastructure for Team Development - Gaylord Aulke
An Infrastructure for Team Development - Gaylord AulkeAn Infrastructure for Team Development - Gaylord Aulke
An Infrastructure for Team Development - Gaylord Aulke
 
Michael snowhite1
Michael snowhite1Michael snowhite1
Michael snowhite1
 
Clifford sugerman
Clifford sugermanClifford sugerman
Clifford sugerman
 
Ogce Workflow Suite Tg09
Ogce Workflow Suite Tg09Ogce Workflow Suite Tg09
Ogce Workflow Suite Tg09
 
Process Synchronisation Operating System
Process Synchronisation Operating SystemProcess Synchronisation Operating System
Process Synchronisation Operating System
 
Using LCDS to Power Live REAs
Using LCDS to Power Live REAsUsing LCDS to Power Live REAs
Using LCDS to Power Live REAs
 
Ch6
Ch6Ch6
Ch6
 
Operating System-Ch4.processes
Operating System-Ch4.processesOperating System-Ch4.processes
Operating System-Ch4.processes
 

Recently uploaded

Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
lizamodels9
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
Abortion pills in Kuwait Cytotec pills in Kuwait
 
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
amitlee9823
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Sheetaleventcompany
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Anamikakaur10
 
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
 
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service NoidaCall Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
dlhescort
 

Recently uploaded (20)

Falcon Invoice Discounting: The best investment platform in india for investors
Falcon Invoice Discounting: The best investment platform in india for investorsFalcon Invoice Discounting: The best investment platform in india for investors
Falcon Invoice Discounting: The best investment platform in india for investors
 
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Cracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxCracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptx
 
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
 
Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...
Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...
Call Girls Zirakpur👧 Book Now📱7837612180 📞👉Call Girl Service In Zirakpur No A...
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
Call Now ☎️🔝 9332606886🔝 Call Girls ❤ Service In Bhilwara Female Escorts Serv...
 
Business Model Canvas (BMC)- A new venture concept
Business Model Canvas (BMC)-  A new venture conceptBusiness Model Canvas (BMC)-  A new venture concept
Business Model Canvas (BMC)- A new venture concept
 
Value Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and painsValue Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and pains
 
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Falcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business GrowthFalcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business Growth
 
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort ServiceMalegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
Malegaon Call Girls Service ☎ ️82500–77686 ☎️ Enjoy 24/7 Escort Service
 
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service NoidaCall Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
 
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60% in 6 Months
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60%  in 6 MonthsSEO Case Study: How I Increased SEO Traffic & Ranking by 50-60%  in 6 Months
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60% in 6 Months
 
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort ServiceEluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
 
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
 

Slides For Operating System Concepts By Silberschatz Galvin And Gagne

  • 1. Slides for Operating System Concepts, By Silberschatz, Galvin, and Gagne http://www.wiley.com/college/silberschatz Chapter 4: Processes Process Concept n An operating system executes a variety of programs: n Process Concept F Batch system – jobs n Process Scheduling F Time-shared systems – user programs or tasks n Operations on Processes n Textbook uses the terms job and process almost n Cooperating Processes interchangeably. n Interprocess Communication n Process – a program in execution; process execution n Communication in Client-Server Systems must progress in sequential fashion. n A process includes: F program counter F stack F data section Operating System Concepts 4.1 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.2 Silberschatz, Galvin and Gagne ”2002 Process State Diagram of Process State n As a process executes, it changes state F new: The process is being created. F running: Instructions are being executed. F waiting: The process is waiting for some event to occur. F ready: The process is waiting to be assigned to a process. F terminated: The process has finished execution. Operating System Concepts 4.3 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.4 Silberschatz, Galvin and Gagne ”2002 Process Control Block (PCB) Process Control Block (PCB) Information associated with each process. n Process state n Program counter n CPU registers n CPU scheduling information n Memory-management information n Accounting information n I/O status information Operating System Concepts 4.5 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.6 Silberschatz, Galvin and Gagne ”2002
  • 2. Slides for Operating System Concepts, By Silberschatz, Galvin, and Gagne http://www.wiley.com/college/silberschatz CPU Switch From Process to Process Process Scheduling Queues n Job queue – set of all processes in the system. n Ready queue – set of all processes residing in main memory, ready and waiting to execute. n Device queues – set of processes waiting for an I/O device. n Process migration between the various queues. Operating System Concepts 4.7 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.8 Silberschatz, Galvin and Gagne ”2002 Ready Queue And Various I/O Device Queues Schedulers n Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue. n Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU. Operating System Concepts 4.9 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.10 Silberschatz, Galvin and Gagne ”2002 Schedulers (Cont.) Context Switch n Short-term scheduler is invoked very frequently n When CPU switches to another process, the system must (milliseconds) fi (must be fast). save the state of the old process and load the saved state n Long-term scheduler is invoked very infrequently for the new process. (seconds, minutes) fi (may be slow). n Context-switch time is overhead; the system does no n The long-term scheduler controls the degree of useful work while switching. multiprogramming. n Time dependent on hardware support. n Processes can be described as either: F I/O-bound process – spends more time doing I/O than computations, many short CPU bursts. F CPU-bound process – spends more time doing computations; few very long CPU bursts. Operating System Concepts 4.11 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.12 Silberschatz, Galvin and Gagne ”2002
  • 3. Slides for Operating System Concepts, By Silberschatz, Galvin, and Gagne http://www.wiley.com/college/silberschatz Process Creation Process Creation (Cont.) n Parent process create children processes, which, in turn n Address space create other processes, forming a tree of processes. F Child duplicate of parent. n Resource sharing F Child has a program loaded into it. F Parent and children share all resources. n UNIX examples F Children share subset of parent’s resources. F fork system call creates new process F Parent and child share no resources. F exec system call used after a fork to replace the process’ n Execution memory space with a new program. F Parent and children execute concurrently. F Parent waits until children terminate. Operating System Concepts 4.13 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.14 Silberschatz, Galvin and Gagne ”2002 Processes Tree on a UNIX System Process Termination n Process executes last statement and asks the operating system to decide it (exit). F Output data from child to parent (via wait). F Process’ resources are deallocated by operating system. n Parent may terminate execution of children processes (abort). F Child has exceeded allocated resources. F Task assigned to child is no longer required. F Parent is exiting. 4 Operating system does not allow child to continue if its parent terminates. 4 Cascading termination. Operating System Concepts 4.15 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.16 Silberschatz, Galvin and Gagne ”2002 Cooperating Processes Producer-Consumer Problem n Independent process cannot affect or be affected by the n Paradigm for cooperating processes, producer process execution of another process. produces information that is consumed by a consumer n Cooperating process can affect or be affected by the process. execution of another process F unbounded-buffer places no practical limit on the size of the buffer. n Advantages of process cooperation F bounded-buffer assumes that there is a fixed buffer size. F Information sharing F Computation speed-up F Modularity F Convenience Operating System Concepts 4.17 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.18 Silberschatz, Galvin and Gagne ”2002
  • 4. Slides for Operating System Concepts, By Silberschatz, Galvin, and Gagne http://www.wiley.com/college/silberschatz Bounded-Buffer – Shared-Memory Solution Bounded-Buffer – Producer Process n Shared data #define BUFFER_SIZE 10 Typedef struct { item nextProduced; ... } item; while (1) { item buffer[BUFFER_SIZE]; while (((in + 1) % BUFFER_SIZE) == out) int in = 0; ; /* do nothing */ int out = 0; buffer[in] = nextProduced; n Solution is correct, but can only use BUFFER_SIZE-1 in = (in + 1) % BUFFER_SIZE; elements } Operating System Concepts 4.19 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.20 Silberschatz, Galvin and Gagne ”2002 Bounded-Buffer – Consumer Process Interprocess Communication (IPC) n Mechanism for processes to communicate and to item nextConsumed; synchronize their actions. n Message system – processes communicate with each while (1) { other without resorting to shared variables. while (in == out) n IPC facility provides two operations: ; /* do nothing */ F send(message) – message size fixed or variable nextConsumed = buffer[out]; F receive(message) out = (out + 1) % BUFFER_SIZE; n If P and Q wish to communicate, they need to: } F establish a communication link between them F exchange messages via send/receive n Implementation of communication link F physical (e.g., shared memory, hardware bus) F logical (e.g., logical properties) Operating System Concepts 4.21 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.22 Silberschatz, Galvin and Gagne ”2002 Implementation Questions Direct Communication n How are links established? n Processes must name each other explicitly: n Can a link be associated with more than two processes? F send (P, message) – send a message to process P n How many links can there be between every pair of F receive(Q, message) – receive a message from process Q communicating processes? n Properties of communication link n What is the capacity of a link? F Links are established automatically. n Is the size of a message that the link can accommodate F A link is associated with exactly one pair of communicating fixed or variable? processes. F Between each pair there exists exactly one link. n Is a link unidirectional or bi-directional? F The link may be unidirectional, but is usually bi-directional. Operating System Concepts 4.23 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.24 Silberschatz, Galvin and Gagne ”2002
  • 5. Slides for Operating System Concepts, By Silberschatz, Galvin, and Gagne http://www.wiley.com/college/silberschatz Indirect Communication Indirect Communication n Messages are directed and received from mailboxes (also referred to as ports). n Operations F Each mailbox has a unique id. F create a new mailbox F Processes can communicate only if they share a mailbox. F send and receive messages through mailbox n Properties of communication link F destroy a mailbox F Link established only if processes share a common mailbox n Primitives are defined as: F A link may be associated with many processes. send(A, message) – send a message to mailbox A F Each pair of processes may share several communication receive(A, message) – receive a message from mailbox A links. F Link may be unidirectional or bi-directional. Operating System Concepts 4.25 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.26 Silberschatz, Galvin and Gagne ”2002 Indirect Communication Synchronization n Mailbox sharing n Message passing may be either blocking or non-blocking. F P1 , P2 , and P3 share mailbox A. n Blocking is considered synchronous F P1 , sends; P2 and P3 receive. n Non-blocking is considered asynchronous F Who gets the message? n send and receive primitives may be either blocking or n Solutions non-blocking. F Allow a link to be associated with at most two processes. F Allow only one process at a time to execute a receive operation. F Allow the system to select arbitrarily the receiver. Sender is notified who the receiver was. Operating System Concepts 4.27 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.28 Silberschatz, Galvin and Gagne ”2002 Buffering Client-Server Communication n Queue of messages attached to the link; implemented in n Sockets one of three ways. n Remote Procedure Calls 1. Zero capacity – 0 messages n Remote Method Invocation (Java) 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. Operating System Concepts 4.29 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.30 Silberschatz, Galvin and Gagne ”2002
  • 6. Slides for Operating System Concepts, By Silberschatz, Galvin, and Gagne http://www.wiley.com/college/silberschatz Sockets Socket Communication n A socket is defined as an endpoint for communication. n Concatenation of IP address and port n The socket 161.25.19.8:1625 refers to port 1625 on host 161.25.19.8 n Communication consists between a pair of sockets. Operating System Concepts 4.31 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.32 Silberschatz, Galvin and Gagne ”2002 Remote Procedure Calls Remote Method Invocation n Remote procedure call (RPC) abstracts procedure calls n Remote Method Invocation (RMI) is a Java mechanism between processes on networked systems. similar to RPCs. n Stubs – client-side proxy for the actual procedure on the n RMI allows a Java program on one machine to invoke a server. method on a remote object. n The client-side stub locates the server and marshalls the parameters. n The server-side stub receives this message, unpacks the marshalled parameters, and peforms the procedure on the server. Operating System Concepts 4.33 Silberschatz, Galvin and Gagne ”2002 Operating System Concepts 4.34 Silberschatz, Galvin and Gagne ”2002 Marshalling Parameters Operating System Concepts 4.35 Silberschatz, Galvin and Gagne ”2002