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

SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSDhaval Sakhiya
Β 
Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Ra'Fat Al-Msie'deen
Β 
Chapter 7 - Deadlocks
Chapter 7 - DeadlocksChapter 7 - Deadlocks
Chapter 7 - DeadlocksWayne Jones Jnr
Β 
Virtualization on embedded boards
Virtualization on embedded boardsVirtualization on embedded boards
Virtualization on embedded boardsMohamed Ramadan
Β 
Chapter 7
Chapter 7Chapter 7
Chapter 7Amin Omi
Β 
2 operating system structures
2 operating system structures2 operating system structures
2 operating system structuresDr. Loganathan R
Β 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling AlgorithmsShubhashish Punj
Β 
Ch6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinCh6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinShubham Singh
Β 
CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2Kathirvel Ayyaswamy
Β 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategiesDr. Loganathan R
Β 
Deadlock
DeadlockDeadlock
DeadlockMohd Arif
Β 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.pptLuis Goldster
Β 
Operating systems chapter 5 silberschatz
Operating systems chapter 5 silberschatzOperating systems chapter 5 silberschatz
Operating systems chapter 5 silberschatzGiulianoRanauro
Β 
Operating Systems - "Chapter 4: Multithreaded Programming"
Operating Systems - "Chapter 4:  Multithreaded Programming"Operating Systems - "Chapter 4:  Multithreaded Programming"
Operating Systems - "Chapter 4: Multithreaded Programming"Ra'Fat Al-Msie'deen
Β 
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDHIVYADEVAKI
Β 
Ch1-Operating System Concept
Ch1-Operating System ConceptCh1-Operating System Concept
Ch1-Operating System ConceptMuhammad Bilal Tariq
Β 
Round Robin Scheduling Algorithm
Round Robin Scheduling AlgorithmRound Robin Scheduling Algorithm
Round Robin Scheduling AlgorithmAdeel Rasheed
Β 
Chapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationChapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationWayne Jones Jnr
Β 
Chapter 3 - Processes
Chapter 3 - ProcessesChapter 3 - Processes
Chapter 3 - ProcessesWayne Jones Jnr
Β 
Operating Systems - Processor Management
Operating Systems - Processor ManagementOperating Systems - Processor Management
Operating Systems - Processor ManagementDamian T. Gordon
Β 

What's hot (20)

SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
Β 
Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"
Β 
Chapter 7 - Deadlocks
Chapter 7 - DeadlocksChapter 7 - Deadlocks
Chapter 7 - Deadlocks
Β 
Virtualization on embedded boards
Virtualization on embedded boardsVirtualization on embedded boards
Virtualization on embedded boards
Β 
Chapter 7
Chapter 7Chapter 7
Chapter 7
Β 
2 operating system structures
2 operating system structures2 operating system structures
2 operating system structures
Β 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
Β 
Ch6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinCh6 CPU Scheduling galvin
Ch6 CPU Scheduling galvin
Β 
CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2
Β 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
Β 
Deadlock
DeadlockDeadlock
Deadlock
Β 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.ppt
Β 
Operating systems chapter 5 silberschatz
Operating systems chapter 5 silberschatzOperating systems chapter 5 silberschatz
Operating systems chapter 5 silberschatz
Β 
Operating Systems - "Chapter 4: Multithreaded Programming"
Operating Systems - "Chapter 4:  Multithreaded Programming"Operating Systems - "Chapter 4:  Multithreaded Programming"
Operating Systems - "Chapter 4: Multithreaded Programming"
Β 
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed Systems
Β 
Ch1-Operating System Concept
Ch1-Operating System ConceptCh1-Operating System Concept
Ch1-Operating System Concept
Β 
Round Robin Scheduling Algorithm
Round Robin Scheduling AlgorithmRound Robin Scheduling Algorithm
Round Robin Scheduling Algorithm
Β 
Chapter 6 - Process Synchronization
Chapter 6 - Process SynchronizationChapter 6 - Process Synchronization
Chapter 6 - Process Synchronization
Β 
Chapter 3 - Processes
Chapter 3 - ProcessesChapter 3 - Processes
Chapter 3 - Processes
Β 
Operating Systems - Processor Management
Operating Systems - Processor ManagementOperating Systems - Processor Management
Operating Systems - Processor Management
Β 

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

Chapter03
Chapter03Chapter03
Chapter03fawad124
Β 
Ch04
Ch04Ch04
Ch04fawad124
Β 
ch3_EN_BK_Process.pdf
ch3_EN_BK_Process.pdfch3_EN_BK_Process.pdf
ch3_EN_BK_Process.pdfHoNguyn746501
Β 
Processes
ProcessesProcesses
Processesvampugani
Β 
Chapter01
Chapter01Chapter01
Chapter01fawad124
Β 
Process
ProcessProcess
ProcessMohd Arif
Β 
Lecture - 2.pptx
Lecture - 2.pptxLecture - 2.pptx
Lecture - 2.pptxUmerMustafa14
Β 
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 ProjectsEliane Collins
Β 
05-Process-Synchronization.pdf
05-Process-Synchronization.pdf05-Process-Synchronization.pdf
05-Process-Synchronization.pdfmilisjojo
Β 
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 Aulkedpc
Β 
Ogce Workflow Suite Tg09
Ogce Workflow Suite Tg09Ogce Workflow Suite Tg09
Ogce Workflow Suite Tg09smarru
Β 
Process Synchronisation Operating System
Process Synchronisation Operating SystemProcess Synchronisation Operating System
Process Synchronisation Operating SystemDRAnithaSofiaLizCSES
Β 
Using LCDS to Power Live REAs
Using LCDS to Power Live REAsUsing LCDS to Power Live REAs
Using LCDS to Power Live REAsShailesh Mangal
Β 
Operating System-Ch4.processes
Operating System-Ch4.processesOperating System-Ch4.processes
Operating System-Ch4.processesSyaiful Ahdan
Β 

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

Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageMatteo Carbone
Β 
VIP Call Girls In Saharaganj ( Lucknow ) πŸ” 8923113531 πŸ” Cash Payment (COD) πŸ‘’
VIP Call Girls In Saharaganj ( Lucknow  ) πŸ” 8923113531 πŸ”  Cash Payment (COD) πŸ‘’VIP Call Girls In Saharaganj ( Lucknow  ) πŸ” 8923113531 πŸ”  Cash Payment (COD) πŸ‘’
VIP Call Girls In Saharaganj ( Lucknow ) πŸ” 8923113531 πŸ” Cash Payment (COD) πŸ‘’anilsa9823
Β 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communicationskarancommunications
Β 
Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Roland Driesen
Β 
Grateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfGrateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfPaul Menig
Β 
Call Girls in Gomti Nagar - 7388211116 - With room Service
Call Girls in Gomti Nagar - 7388211116  - With room ServiceCall Girls in Gomti Nagar - 7388211116  - With room Service
Call Girls in Gomti Nagar - 7388211116 - With room Servicediscovermytutordmt
Β 
7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...Paul Menig
Β 
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLMONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLSeo
Β 
GD Birla and his contribution in management
GD Birla and his contribution in managementGD Birla and his contribution in management
GD Birla and his contribution in managementchhavia330
Β 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear RegressionRavindra Nath Shukla
Β 
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
Tech Startup Growth Hacking 101  - Basics on Growth MarketingTech Startup Growth Hacking 101  - Basics on Growth Marketing
Tech Startup Growth Hacking 101 - Basics on Growth MarketingShawn Pang
Β 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdfRenandantas16
Β 
Progress Report - Oracle Database Analyst Summit
Progress  Report - Oracle Database Analyst SummitProgress  Report - Oracle Database Analyst Summit
Progress Report - Oracle Database Analyst SummitHolger Mueller
Β 
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999Tina Ji
Β 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMRavindra Nath Shukla
Β 
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurVIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurSuhani Kapoor
Β 
Understanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key InsightsUnderstanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key Insightsseribangash
Β 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.Aaiza Hassan
Β 
Forklift Operations: Safety through Cartoons
Forklift Operations: Safety through CartoonsForklift Operations: Safety through Cartoons
Forklift Operations: Safety through CartoonsForklift Trucks in Minnesota
Β 
Event mailer assignment progress report .pdf
Event mailer assignment progress report .pdfEvent mailer assignment progress report .pdf
Event mailer assignment progress report .pdftbatkhuu1
Β 

Recently uploaded (20)

Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usage
Β 
VIP Call Girls In Saharaganj ( Lucknow ) πŸ” 8923113531 πŸ” Cash Payment (COD) πŸ‘’
VIP Call Girls In Saharaganj ( Lucknow  ) πŸ” 8923113531 πŸ”  Cash Payment (COD) πŸ‘’VIP Call Girls In Saharaganj ( Lucknow  ) πŸ” 8923113531 πŸ”  Cash Payment (COD) πŸ‘’
VIP Call Girls In Saharaganj ( Lucknow ) πŸ” 8923113531 πŸ” Cash Payment (COD) πŸ‘’
Β 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communications
Β 
Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...Boost the utilization of your HCL environment by reevaluating use cases and f...
Boost the utilization of your HCL environment by reevaluating use cases and f...
Β 
Grateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdfGrateful 7 speech thanking everyone that has helped.pdf
Grateful 7 speech thanking everyone that has helped.pdf
Β 
Call Girls in Gomti Nagar - 7388211116 - With room Service
Call Girls in Gomti Nagar - 7388211116  - With room ServiceCall Girls in Gomti Nagar - 7388211116  - With room Service
Call Girls in Gomti Nagar - 7388211116 - With room Service
Β 
7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...7.pdf This presentation captures many uses and the significance of the number...
7.pdf This presentation captures many uses and the significance of the number...
Β 
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLMONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
Β 
GD Birla and his contribution in management
GD Birla and his contribution in managementGD Birla and his contribution in management
GD Birla and his contribution in management
Β 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear Regression
Β 
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
Tech Startup Growth Hacking 101  - Basics on Growth MarketingTech Startup Growth Hacking 101  - Basics on Growth Marketing
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
Β 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
Β 
Progress Report - Oracle Database Analyst Summit
Progress  Report - Oracle Database Analyst SummitProgress  Report - Oracle Database Analyst Summit
Progress Report - Oracle Database Analyst Summit
Β 
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Β 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSM
Β 
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurVIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
Β 
Understanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key InsightsUnderstanding the Pakistan Budgeting Process: Basics and Key Insights
Understanding the Pakistan Budgeting Process: Basics and Key Insights
Β 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.
Β 
Forklift Operations: Safety through Cartoons
Forklift Operations: Safety through CartoonsForklift Operations: Safety through Cartoons
Forklift Operations: Safety through Cartoons
Β 
Event mailer assignment progress report .pdf
Event mailer assignment progress report .pdfEvent mailer assignment progress report .pdf
Event mailer assignment progress report .pdf
Β 

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