Message passing model. buffer producerconsumer PRODUCER-CONSUMER PROBLEM.

Slides:



Advertisements
Similar presentations
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Advertisements

Deadlocks, Message Passing Brief refresh from last week Tore Larsen Oct
©2009 Operačné systémy Procesy. 3.2 ©2009 Operačné systémy Process in Memory.
Concurrency: mutual exclusion and synchronization Slides are mainly taken from «Operating Systems: Internals and Design Principles”, 8/E William Stallings.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Informationsteknologi Wednesday, September 26, 2007 Computer Systems/Operating Systems - Class 91 Today’s class Mutual exclusion and synchronization 
Enforcing Mutual Exclusion Message Passing. Peterson’s Algorithm for Processes P0 and P1 void P0() { while( true ) { flag[ 0 ] = false; /* remainder */
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Adapted from slides ©2005 Silberschatz, Galvin, and Gagne Lecture 4: Processes.
Chapter 3 Processes.
1 Semaphores Special variable called a semaphore is used for signaling If a process is waiting for a signal, it is suspended until that signal is sent.
Concurrency CS 510: Programming Languages David Walker.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
Inter Process Communication:  It is an essential aspect of process management. By allowing processes to communicate with each other: 1.We can synchronize.
3.5 Interprocess Communication
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Threads CSCI 444/544 Operating Systems Fall 2008.
1/30/2004CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Chapter 3: Processes. Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
1/26/2007CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Process Description and Control A process is sometimes called a task, it is a program in execution.
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication in Client-Server.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Process Concept Process – a program.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Parallel Computing A task is broken down into tasks, performed by separate workers or processes Processes interact by exchanging information What do we.
1 Lecture 5 (part2) : “Interprocess communication” n reasons for process cooperation n types of message passing n direct and indirect message passing n.
3.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 3: Processes.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Outline n Process Concept n Process.
Chapter 3: Processes. 3.2CSCI 380 Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Processes. Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
1 Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
CS212: OPERATING SYSTEM Lecture 2: Process 1. Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
Processes © Sekolah Tinggi Teknik Surabaya 1. » Process Concept » Process Scheduling » Operations on Processes » Interprocess Communication » Examples.
Synchronization Methods in Message Passing Model.
Processes CSCI 4534 Chapter 4. Introduction Early computer systems allowed one program to be executed at a time –The program had complete control of the.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 3 Operating Systems.
PREPARED BY : MAZHAR JAVED AWAN BSCS-III Process Communication & Threads 4 December 2015.
Chapter 3: Process-Concept. Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
1 Lecture 8: Concurrency: Mutual Exclusion and Synchronization(cont.) Advanced Operating System Fall 2009.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Jan 19, 2005 Chapter 3: Processes Process Concept.
Chapter 3 – Processes (Pgs 101 – 141). Processes  Pretty much identical to a “job”  A task that a computer is performing  Consists of: 1. Text Section.
Operating Systems Lecture Notes Processes Matthew Dailey Some material © Silberschatz, Galvin, and Gagne, 2002.
Threads-Process Interaction. CONTENTS  Threads  Process interaction.
Processes. Process Concept Process Scheduling Operations on Processes Interprocess Communication Communication in Client-Server Systems.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Cooperating Processes The concurrent processes executing in the operating system may be either independent processes or cooperating processes. A process.
 Process Concept  Process Scheduling  Operations on Processes  Cooperating Processes  Interprocess Communication  Communication in Client-Server.
Operating Systems CMPSC 473 Signals, Introduction to mutual exclusion September 28, Lecture 9 Instructor: Bhuvan Urgaonkar.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
Gokul Kishan CS8 1 Inter-Process Communication (IPC)
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Message passing model. buffer producerconsumer PRODUCER-CONSUMER PROBLEM.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Process concept.
CS 6560: Operating Systems Design
Chapter 3 Process Management.
Concurrency: Mutual Exclusion and Synchronization
Presentation transcript:

message passing model

buffer producerconsumer PRODUCER-CONSUMER PROBLEM

Two semaphores empty (i.v. 1) full (i.v. O)

{ while (TRUE) { ; P (empty); ; V (full); } void producer(void)

{ while (TRUE) { P (full); ; V(empty); ; } void consumer(void)

buffer producerconsumer

Three semaphores empty (i.v. N) full (i.v. O) mutex (i.v. 1)

{ while (TRUE) {< generate one message to be put into the buffer >; P (empty); P (mutex); ; V (mutex); V(full);} } void producer (void)

{while (TRUE) {P (full); P(mutex); ; V(mutex); V(empty); ;} } void consumer(void)

MESSAGE PASSING MODEL

 send (destination, message) The functions of message passing are normally provided in the form of a couple of primitives:  receive (source,message)

 One process sends information in the form of a message to another process designated by a destination

 A process receives information by executing the receive primitive, to obtain the source of the sending process and the message

Design issues of message systems:  Addressing  Synchronization

Addressing  Direct addressing The send primitive includes a specific identifier for the destination process send (P2, message)

The receive can be handled in one of the two ways:  The process explicitly design a sending process: receive (P1, message)

 If it is impossible to specify in advance the source process

 implicit addressing: the source parameter specifies a value yelded when the receive operation has been performed to indicate the sender process.

Indirect addressing Messages are not directly sent from senders to receivers

Messages are sent to intermedia shared data structures (mailbox) that can temporaly hold messages

The relationship between senders and receivers can be: one-to-one many-to-one many-to-many

A one-to-one relationship allows private communication to be set up betweeen a couple of processes.

A many-to-one relationship is useful for client-server interaction. The mailbox is often referred to as a port

client/server model server client port P 1 R P n

A one-to-many relationship allows for one sender and multiple receivers.

It is useful for applications where messages are to be broadcasted to groups of reveiver processes.

Message header body origin e message type destination ID source ID message length control information message contents

SYNCHRONIZATION The communication of a message between two processes implies some level of synchronization

The receiver cannot receive a message until it has been sent by another process SYNCHRONIZATION

In addition, we need to specify what happens to a process after a send or receice primitive.

Message passing may be either blocking or nonblocking (synchronous or asynchronous)

Blocking send: the sending process is blocked until the message is received either by the receiving process or by the mailbox.

Nonblocking send: the sending process sends the message and immediately resumes operation.

Blocking receive: the receiver blocks until a message is available.

Nonblocking receive: if there is no waiting message, the process continues executing, abandoning the attempt to receive.

Rendez vous betveen the sender and the receiver: both send and receive are blocked by the operation

Extended rendezvous: the sender is blocked until the receiver completed the implied action.

KERNEL OF A PROCESS SYSTEM

 A small set of data structures and functions that provide the core support to any concurrent program.

 The role of a kernel is to provide a virtual processor to each process

 PCBs  process_in_execution  ready-process-queues  semaphores and blocked- process-queues Kernel data structures

 Context switch management: save and restore the PCBs of the processes. Kernel functions

 Decision of the ready process to which assign the CPU. Kernel functions

 Interrupt handling  Operations on processes (system calls)

 The kernel starts executing when an interrupt occurs  External interrupts from peripheral devices

 Internal interrupts or traps triggered by the executing process

 A stack is associated to any process Example

 Double set of general registers R1, R2, …, Rn and R’1, R’2, …, R’n and two registers SP and SP’ (user and kernel) Example

11  n  P PCB kernel stack R1R1 RnRn SP PC PS    SP’ R1’R1’ Rn’Rn’  g PC value of the process that executed the SVC Process-in- execution P stack d PS value of the process that executed the SVC  interrupt handler address z kernel PSW

 1’  n’ ’’ P PCB kernel stack R1R1 RnRn SP PC PS   ’  ’ SP’ R1’R1’ Rn’Rn’ P stack P’ PCB P’stack 11  n     1’  n’ ’’  ’ ’’   iret address  Kernel PSW Process- in -execution