Chapter 10 - Message passing. This chapter discusses the semantics of message passing, and OS responsibilities in buffering and delivery of interprocess messages. It also discusses how message passing is employed in higher-level protocols for providing electronic mail facility and in providing intertask communication in parallel or distributed programs.
PROPRIETARY MATERIAL. © 2007 The McGrawHill Companies, Inc. All rights reserved. No part of this PowerPoint slide may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the publisher, or used beyond the limited distribution to teachers and educators permitted by McGrawHill for their individual course preparation. If you are a student using this PowerPoint slide, you are using it without permission. Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed Slide No: 1 Copyright © 2008 Message passing preliminaries • The sender process names the destination process and provides the message • The destination process specifies an area in which the message should be put Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed SlideNo:2 Copyrightâ2008 Issues in message passing Naming of processes * Direct and indirect naming Direct: Process names are specified in send / receive commands Indirect: Process names are inferred by the kernel * Symmetric and asymmetric naming Symmetric: Both sender and receiver processes specify each other’s names Asymmetric: Receiving process does not specify name of a sender process Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed Slide No: 3 Copyright © 2008 Issues in message passing • Method for transferring messages * Process executing a receive command is blocked until a message is delivered * The sender process may or may not be blocked until delivery Synchronous message passing: sender is blocked » Simplifies message passing, saves memory Asynchronous message passing: sender is not blocked * Order in which messages are delivered * Handling of exceptions like non-existing processes, undeliverable messages Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed Slide No: 4 Copyright © 2008 Issues in message passing • Kernel responsibilities – Buffering of messages * Kernel builds an interprocess message control block (IMCB) * IMCB is stored in an appropriate data structure The message may be stored in IMCB or separately – Blocking and unblocking of processes * May be performed using event control blocks (ECBs) Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed Slide No: 5 Copyright © 2008 Interprocess message control block (IMCB) Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed Slide No: 6 Copyright © 2008 Lists of IMCBs pending delivery of messages Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed Slide No: 7 Copyright © 2008 Symmetric naming and blocking sends (a) A process executes send and destination process has not executed receive (b) A process executes receive and sender process has not executed send Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed Slide No: 8 Copyright © 2008 Symmetric naming and blocking sends Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed Slide No: 9 Copyright © 2008 Symmetric naming and blocking sends Chapter 10: MessagePassing Dhamdhere:OperatingSystems AConceptưBasedApproach,2ed SlideNo:10 Copyrightâ2008 Mailbox Amailboxhasanameandisarepositoryofmessages Processesconnecttoamailboxandsend/receivemessagesfromit Chapter10: MessagePassing Dhamdhere:OperatingSystems AConceptưBasedApproach,2ed SlideNo:11 Copyrightâ2008 Mailbox Benefits of using a mailbox – Anonimity of receiver * A sender process need not know identity of receiver process – Classification of messages * A process can use numerous mailboxes, one for each kind of message Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed Slide No: 12 Copyrightâ2008 Use of mailboxes Anairlinereservationsprocessusesthreemailboxes book,enquire,receive Thiswayitcanprocesscancellationsfollowedbybookingsfollowedbyqueries Chapter10: MessagePassing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed Slide No: 13 Copyright © 2008 Message passing in Unix Pipe Message queue Socket • A pipe is a FIFO mechanism, message queue is analogous to a mailbox • Socket is one end of a communication path in a Unix domain or in the Internet domain Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed Slide No: 14 Copyright © 2008 Reservations server in Unix 5.4 • Cancellation, booking and enquiry messages are assigned types 1, 2 and 3 resp • The msgrcv call returns a cancellation message, if present • If no cancellation messages exist, it returns a bookings message, if present, or an enquiry message Chapter 10: MessagePassing Dhamdhere:OperatingSystems AConceptưBasedApproach,2ed SlideNo:15 Copyrightâ2008 Message passing in Windows Overview of Windows features – Local procedure call (LPC) for message passing between processes located in the same computer * Provides three types of message passing Small and large messages are sent using ports, where a port is like a mailbox » Small messages are stored in the port, large messages are stored in section objects Quick LPC: A server creates a thread for each client This thread and the client use event pair objects to synchronize Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed Slide No: 16 Copyright © 2008 ... Chapter 10: MessagePassing Dhamdhere: OperatingSystems AConceptưBasedApproach,2ed SlideNo :10 Copyrightâ2008 Mailbox Amailboxhasanameandisarepositoryofmessages Processesconnecttoamailboxandsend/receivemessagesfromit... • A pipe is a FIFO mechanism, message queue is analogous to a mailbox • Socket is one end of a communication path in a Unix domain or in the Internet domain Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed... process – Classification of messages * A process can use numerous mailboxes, one for each kind of message Chapter 10: Message Passing Dhamdhere: Operating Systems— A ConceptBased Approach, 2 ed