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

Chapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresChapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresWayne Jones Jnr
 
Introduction to System Calls
Introduction to System CallsIntroduction to System Calls
Introduction to System CallsVandana Salve
 
Operating System Chapter 1
Operating System Chapter 1Operating System Chapter 1
Operating System Chapter 1Kasam Sharif
 
Unit 1 introduction to Operating System
Unit 1 introduction to Operating SystemUnit 1 introduction to Operating System
Unit 1 introduction to Operating Systemzahid7578
 
Os structure
Os structureOs structure
Os structureMohd Arif
 
NetBSD and Linux for Embedded Systems
NetBSD and Linux for Embedded SystemsNetBSD and Linux for Embedded Systems
NetBSD and Linux for Embedded SystemsMahendra M
 
Intermediate Operating Systems
Intermediate Operating SystemsIntermediate Operating Systems
Intermediate Operating SystemsJohn Cutajar
 
Operating system concepts (notes)
Operating system concepts (notes)Operating system concepts (notes)
Operating system concepts (notes)Sohaib Danish
 
Operating Systems Chapter 6 silberschatz
Operating Systems Chapter 6 silberschatzOperating Systems Chapter 6 silberschatz
Operating Systems Chapter 6 silberschatzGiulianoRanauro
 
Chapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatzChapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatzGiulianoRanauro
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating SystemJanki Shah
 
Design issues of dos
Design issues of dosDesign issues of dos
Design issues of dosvanamali_vanu
 
Evolution of operating system
Evolution of operating systemEvolution of operating system
Evolution of operating systemArshad khan
 
Ch6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinCh6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinShubham Singh
 
Operating systems Overview
Operating systems OverviewOperating systems Overview
Operating systems OverviewNAILBITER
 
Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)Vaibhav Bajaj
 

What's hot (20)

Chapter 2 - Operating System Structures
Chapter 2 - Operating System StructuresChapter 2 - Operating System Structures
Chapter 2 - Operating System Structures
 
Chapter 8 - Main Memory
Chapter 8 - Main MemoryChapter 8 - Main Memory
Chapter 8 - Main Memory
 
Introduction to System Calls
Introduction to System CallsIntroduction to System Calls
Introduction to System Calls
 
Operating System Chapter 1
Operating System Chapter 1Operating System Chapter 1
Operating System Chapter 1
 
Unit 1 introduction to Operating System
Unit 1 introduction to Operating SystemUnit 1 introduction to Operating System
Unit 1 introduction to Operating System
 
Complete Operating System notes
Complete Operating System notesComplete Operating System notes
Complete Operating System notes
 
Os structure
Os structureOs structure
Os structure
 
NetBSD and Linux for Embedded Systems
NetBSD and Linux for Embedded SystemsNetBSD and Linux for Embedded Systems
NetBSD and Linux for Embedded Systems
 
Intermediate Operating Systems
Intermediate Operating SystemsIntermediate Operating Systems
Intermediate Operating Systems
 
Operating system concepts (notes)
Operating system concepts (notes)Operating system concepts (notes)
Operating system concepts (notes)
 
Operating Systems Chapter 6 silberschatz
Operating Systems Chapter 6 silberschatzOperating Systems Chapter 6 silberschatz
Operating Systems Chapter 6 silberschatz
 
operating system structure
operating system structureoperating system structure
operating system structure
 
Chapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatzChapter 10 Operating Systems silberschatz
Chapter 10 Operating Systems silberschatz
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating System
 
Design issues of dos
Design issues of dosDesign issues of dos
Design issues of dos
 
Evolution of operating system
Evolution of operating systemEvolution of operating system
Evolution of operating system
 
Ch6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinCh6 CPU Scheduling galvin
Ch6 CPU Scheduling galvin
 
operating system lecture notes
operating system lecture notesoperating system lecture notes
operating system lecture notes
 
Operating systems Overview
Operating systems OverviewOperating systems Overview
Operating systems Overview
 
Operating system.ppt (1)
Operating system.ppt (1)Operating system.ppt (1)
Operating system.ppt (1)
 

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

Darshan Hiranandani [News About Next CEO].pdf
Darshan Hiranandani [News About Next CEO].pdfDarshan Hiranandani [News About Next CEO].pdf
Darshan Hiranandani [News About Next CEO].pdfShashank Mehta
 
Unlocking the Future: Explore Web 3.0 Workshop to Start Earning Today!
Unlocking the Future: Explore Web 3.0 Workshop to Start Earning Today!Unlocking the Future: Explore Web 3.0 Workshop to Start Earning Today!
Unlocking the Future: Explore Web 3.0 Workshop to Start Earning Today!Doge Mining Website
 
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCRashishs7044
 
Appkodes Tinder Clone Script with Customisable Solutions.pptx
Appkodes Tinder Clone Script with Customisable Solutions.pptxAppkodes Tinder Clone Script with Customisable Solutions.pptx
Appkodes Tinder Clone Script with Customisable Solutions.pptxappkodes
 
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607dollysharma2066
 
Memorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMMemorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMVoces Mineras
 
Organizational Structure Running A Successful Business
Organizational Structure Running A Successful BusinessOrganizational Structure Running A Successful Business
Organizational Structure Running A Successful BusinessSeta Wicaksana
 
Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Seta Wicaksana
 
Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...Peter Ward
 
Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03DallasHaselhorst
 
NewBase 19 April 2024 Energy News issue - 1717 by Khaled Al Awadi.pdf
NewBase  19 April  2024  Energy News issue - 1717 by Khaled Al Awadi.pdfNewBase  19 April  2024  Energy News issue - 1717 by Khaled Al Awadi.pdf
NewBase 19 April 2024 Energy News issue - 1717 by Khaled Al Awadi.pdfKhaled Al Awadi
 
8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCRashishs7044
 
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCRashishs7044
 
Financial-Statement-Analysis-of-Coca-cola-Company.pptx
Financial-Statement-Analysis-of-Coca-cola-Company.pptxFinancial-Statement-Analysis-of-Coca-cola-Company.pptx
Financial-Statement-Analysis-of-Coca-cola-Company.pptxsaniyaimamuddin
 
MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?Olivia Kresic
 
1911 Gold Corporate Presentation Apr 2024.pdf
1911 Gold Corporate Presentation Apr 2024.pdf1911 Gold Corporate Presentation Apr 2024.pdf
1911 Gold Corporate Presentation Apr 2024.pdfShaun Heinrichs
 
APRIL2024_UKRAINE_xml_0000000000000 .pdf
APRIL2024_UKRAINE_xml_0000000000000 .pdfAPRIL2024_UKRAINE_xml_0000000000000 .pdf
APRIL2024_UKRAINE_xml_0000000000000 .pdfRbc Rbcua
 
Chapter 9 PPT 4th edition.pdf internal audit
Chapter 9 PPT 4th edition.pdf internal auditChapter 9 PPT 4th edition.pdf internal audit
Chapter 9 PPT 4th edition.pdf internal auditNhtLNguyn9
 

Recently uploaded (20)

Darshan Hiranandani [News About Next CEO].pdf
Darshan Hiranandani [News About Next CEO].pdfDarshan Hiranandani [News About Next CEO].pdf
Darshan Hiranandani [News About Next CEO].pdf
 
Unlocking the Future: Explore Web 3.0 Workshop to Start Earning Today!
Unlocking the Future: Explore Web 3.0 Workshop to Start Earning Today!Unlocking the Future: Explore Web 3.0 Workshop to Start Earning Today!
Unlocking the Future: Explore Web 3.0 Workshop to Start Earning Today!
 
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
 
Appkodes Tinder Clone Script with Customisable Solutions.pptx
Appkodes Tinder Clone Script with Customisable Solutions.pptxAppkodes Tinder Clone Script with Customisable Solutions.pptx
Appkodes Tinder Clone Script with Customisable Solutions.pptx
 
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
 
Corporate Profile 47Billion Information Technology
Corporate Profile 47Billion Information TechnologyCorporate Profile 47Billion Information Technology
Corporate Profile 47Billion Information Technology
 
Memorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQMMemorándum de Entendimiento (MoU) entre Codelco y SQM
Memorándum de Entendimiento (MoU) entre Codelco y SQM
 
Organizational Structure Running A Successful Business
Organizational Structure Running A Successful BusinessOrganizational Structure Running A Successful Business
Organizational Structure Running A Successful Business
 
Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...
 
Call Us ➥9319373153▻Call Girls In North Goa
Call Us ➥9319373153▻Call Girls In North GoaCall Us ➥9319373153▻Call Girls In North Goa
Call Us ➥9319373153▻Call Girls In North Goa
 
Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...Fordham -How effective decision-making is within the IT department - Analysis...
Fordham -How effective decision-making is within the IT department - Analysis...
 
Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03
 
NewBase 19 April 2024 Energy News issue - 1717 by Khaled Al Awadi.pdf
NewBase  19 April  2024  Energy News issue - 1717 by Khaled Al Awadi.pdfNewBase  19 April  2024  Energy News issue - 1717 by Khaled Al Awadi.pdf
NewBase 19 April 2024 Energy News issue - 1717 by Khaled Al Awadi.pdf
 
8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR
 
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
 
Financial-Statement-Analysis-of-Coca-cola-Company.pptx
Financial-Statement-Analysis-of-Coca-cola-Company.pptxFinancial-Statement-Analysis-of-Coca-cola-Company.pptx
Financial-Statement-Analysis-of-Coca-cola-Company.pptx
 
MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?
 
1911 Gold Corporate Presentation Apr 2024.pdf
1911 Gold Corporate Presentation Apr 2024.pdf1911 Gold Corporate Presentation Apr 2024.pdf
1911 Gold Corporate Presentation Apr 2024.pdf
 
APRIL2024_UKRAINE_xml_0000000000000 .pdf
APRIL2024_UKRAINE_xml_0000000000000 .pdfAPRIL2024_UKRAINE_xml_0000000000000 .pdf
APRIL2024_UKRAINE_xml_0000000000000 .pdf
 
Chapter 9 PPT 4th edition.pdf internal audit
Chapter 9 PPT 4th edition.pdf internal auditChapter 9 PPT 4th edition.pdf internal audit
Chapter 9 PPT 4th edition.pdf internal audit
 

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