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

Operating system 31 multiple processor scheduling
Operating system 31 multiple processor schedulingOperating system 31 multiple processor scheduling
Operating system 31 multiple processor schedulingVaibhav Khanna
 
Operating system Concepts
Operating system Concepts Operating system Concepts
Operating system Concepts RANVIJAY GAUR
 
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
 
Shell and its types in LINUX
Shell and its types in LINUXShell and its types in LINUX
Shell and its types in LINUXSHUBHA CHATURVEDI
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Mukesh Chinta
 
Ch2: Computer System Structure (OS)
Ch2: Computer System Structure (OS)Ch2: Computer System Structure (OS)
Ch2: Computer System Structure (OS)Ahmar Hashmi
 
Operating system presentation
Operating system presentationOperating system presentation
Operating system presentationSonu Vishwakarma
 
Silberschatz / OS Concepts
Silberschatz /  OS Concepts Silberschatz /  OS Concepts
Silberschatz / OS Concepts Alanisca Alanis
 
Software engineering a practitioners approach 8th edition pressman solutions ...
Software engineering a practitioners approach 8th edition pressman solutions ...Software engineering a practitioners approach 8th edition pressman solutions ...
Software engineering a practitioners approach 8th edition pressman solutions ...Drusilla918
 
Leaky bucket algorithm
Leaky bucket algorithmLeaky bucket algorithm
Leaky bucket algorithmUmesh Gupta
 
Unit 6 Software Configuration Management
Unit 6 Software Configuration ManagementUnit 6 Software Configuration Management
Unit 6 Software Configuration ManagementKanchanPatil34
 
Operating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and DeadlocksOperating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and DeadlocksMukesh Chinta
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9myrajendra
 

What's hot (20)

Operating system 31 multiple processor scheduling
Operating system 31 multiple processor schedulingOperating system 31 multiple processor scheduling
Operating system 31 multiple processor scheduling
 
Operating system Concepts
Operating system Concepts Operating system Concepts
Operating system Concepts
 
Operating Systems - "Chapter 4: Multithreaded Programming"
Operating Systems - "Chapter 4:  Multithreaded Programming"Operating Systems - "Chapter 4:  Multithreaded Programming"
Operating Systems - "Chapter 4: Multithreaded Programming"
 
Semaphores
SemaphoresSemaphores
Semaphores
 
Shell and its types in LINUX
Shell and its types in LINUXShell and its types in LINUX
Shell and its types in LINUX
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
 
Ch2: Computer System Structure (OS)
Ch2: Computer System Structure (OS)Ch2: Computer System Structure (OS)
Ch2: Computer System Structure (OS)
 
Operating system presentation
Operating system presentationOperating system presentation
Operating system presentation
 
Component based software engineering
Component based software engineeringComponent based software engineering
Component based software engineering
 
Silberschatz / OS Concepts
Silberschatz /  OS Concepts Silberschatz /  OS Concepts
Silberschatz / OS Concepts
 
Software engineering a practitioners approach 8th edition pressman solutions ...
Software engineering a practitioners approach 8th edition pressman solutions ...Software engineering a practitioners approach 8th edition pressman solutions ...
Software engineering a practitioners approach 8th edition pressman solutions ...
 
Case study linux
Case study linuxCase study linux
Case study linux
 
Leaky bucket algorithm
Leaky bucket algorithmLeaky bucket algorithm
Leaky bucket algorithm
 
Unit 6 Software Configuration Management
Unit 6 Software Configuration ManagementUnit 6 Software Configuration Management
Unit 6 Software Configuration Management
 
Lec # 1 chapter 2
Lec # 1 chapter 2Lec # 1 chapter 2
Lec # 1 chapter 2
 
operating system structure
operating system structureoperating system structure
operating system structure
 
Operating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and DeadlocksOperating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and Deadlocks
 
Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9
 
Ch04
Ch04Ch04
Ch04
 
Chapter 7 - Deadlocks
Chapter 7 - DeadlocksChapter 7 - Deadlocks
Chapter 7 - Deadlocks
 

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

ch3_EN_BK_Process.pdf
ch3_EN_BK_Process.pdfch3_EN_BK_Process.pdf
ch3_EN_BK_Process.pdfHoNguyn746501
 
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

Catalogue ONG NUOC PPR DE NHAT .pdf
Catalogue ONG NUOC PPR DE NHAT      .pdfCatalogue ONG NUOC PPR DE NHAT      .pdf
Catalogue ONG NUOC PPR DE NHAT .pdfOrient Homes
 
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
 
2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis UsageNeil Kimberley
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Dave Litwiller
 
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,noida100girls
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communicationskarancommunications
 
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
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Neil Kimberley
 
Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...
Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...
Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...lizamodels9
 
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Dipal Arora
 
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...lizamodels9
 
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
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Serviceritikaroy0888
 
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...lizamodels9
 
Non Text Magic Studio Magic Design for Presentations L&P.pptx
Non Text Magic Studio Magic Design for Presentations L&P.pptxNon Text Magic Studio Magic Design for Presentations L&P.pptx
Non Text Magic Studio Magic Design for Presentations L&P.pptxAbhayThakur200703
 
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
 
/:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc...
/:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc.../:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc...
/:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc...lizamodels9
 

Recently uploaded (20)

Catalogue ONG NUOC PPR DE NHAT .pdf
Catalogue ONG NUOC PPR DE NHAT      .pdfCatalogue ONG NUOC PPR DE NHAT      .pdf
Catalogue ONG NUOC PPR DE NHAT .pdf
 
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.
 
2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
 
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communications
 
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
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023
 
Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...
Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...
Lowrate Call Girls In Sector 18 Noida ❤️8860477959 Escorts 100% Genuine Servi...
 
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
 
Best Practices for Implementing an External Recruiting Partnership
Best Practices for Implementing an External Recruiting PartnershipBest Practices for Implementing an External Recruiting Partnership
Best Practices for Implementing an External Recruiting Partnership
 
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
 
Forklift Operations: Safety through Cartoons
Forklift Operations: Safety through CartoonsForklift Operations: Safety through Cartoons
Forklift Operations: Safety through Cartoons
 
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
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Service
 
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
 
Non Text Magic Studio Magic Design for Presentations L&P.pptx
Non Text Magic Studio Magic Design for Presentations L&P.pptxNon Text Magic Studio Magic Design for Presentations L&P.pptx
Non Text Magic Studio Magic Design for Presentations L&P.pptx
 
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
 
/:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc...
/:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc.../:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc...
/:Call Girls In Jaypee Siddharth - 5 Star Hotel New Delhi ➥9990211544 Top Esc...
 
KestrelPro Flyer Japan IT Week 2024 (English)
KestrelPro Flyer Japan IT Week 2024 (English)KestrelPro Flyer Japan IT Week 2024 (English)
KestrelPro Flyer Japan IT Week 2024 (English)
 

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