1 / 20

Asynchronous Message Passing

Asynchronous Message Passing. EE 524/CS 561 Wanliang Ma 03/08/2000. Mechanisms for Concurrent Programming. Dynamic process creation Semaphores Asynchronous message passing Remote procedure call (RPC) Rendezvous. Call and Send. Call : Synchronous

folks
Download Presentation

Asynchronous Message Passing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Asynchronous Message Passing EE 524/CS 561 Wanliang Ma 03/08/2000

  2. Mechanisms for Concurrent Programming • Dynamic process creation • Semaphores • Asynchronous message passing • Remote procedure call (RPC) • Rendezvous

  3. Call and Send • Call : • Synchronous • two-way communication plus synchronization • Send : • asynchronous • fork a new instance of a proc • one-way communication

  4. Process Interaction Mechanisms

  5. Asynchronous Message Passing • Higher level and more powerful than semaphores • Allow processes to communicate • Allow processes to synchronize

  6. Asynchronous Message Passing • Implemented by having processes send messages to and receive messages from operations • The sender continues after sending • asynchronous ( non-blocking) • The receiver delays until receiving and removing a message • synchronous (blocking) • an abbreviation for more general mechanism

  7. Outline of Chapter 9 • Operations as message queues • Semaphores revisited • Data-containing semaphores • Shared Operations

  8. Operations as Message Queues • A new use of operations as message queues • The operation has no corresponding proc • Receive statements service and remove the invocation of an operation from the message queue • The executing process delays if no invocation is present

  9. Operations as Message Queues • How to invoke an operation : send and call • Send invocation: • the invocation is appended to the message queue • the invoker continues after sending • Call invocation : • synchronous form of message passing

  10. Receive statement format receive op_id subscripts ( variable, variable, …)

  11. Examples • Stream merging • Client-Serve models • one client process and one server process • multiple clients and one server process • multiple clients and multiple servers

  12. Semaphores Revisited • Semaphores:abbreviations for operations • a parameterless operation • with send restriction • P statements:abbreviations for send statements • V statements:abbreviations for receive statements

  13. Semaphores Revisited

  14. Semaphores Revisited • The two classes of mechanisms are equally efficient • Both are more efficient than a general message passing • semaphores make programs more concise and readable

  15. Data-Containing Semaphores • A generalization of standard semaphores • contain data and a synchronization signal • an unbounded buffer of messages that have been produced and not yet consumed • Declared within a resource or a global • Data is passed as a parameter of a operation

  16. Data-Containing Semaphores • Send statements to append data to the operation’s message queue • receive statements to remove data from the operation’s message queue • synchronization between processes accessing the queue is implicit through their use of send and receive statements

  17. Data-Containing Semaphores • Advantages • saves the programmer from having to write code that explicitly implements a list of free buffers and code that synchronizes access to the list. • Disadvantages • less efficient

  18. Shared Operations • Declared at the top level within a resource or global • can not be declared within processes • If the operation is declared in a resource, only the processes located in the same resource can share the operation • If the operation is declared in a global g, the processes located in g or in any resource or global that imports g can share the operation

  19. Shared Operations • applications • multiple instances of a process can service the same resource operation • server work queues

  20. Shared Operations • Example: • compute the integral of f(x) from 1 to r. • It employs a shared operation, bag, which contains a bag of tasks • Each task represents a sub-interval over which the integral of f is to be approximated

More Related