Published on

COMP2310 Week 7 - Message-based Synchronisation

Table of Contents

Synchronisation

  • Synchronisation model

    • Asynchronous
    • Synchronous
    • Remove invocation
  • Addressing (Name space)

    • Direct communication
    • Mail-box communication
  • Message structure

    • Arbitrary
    • Restricted to 'basic' types
    • Restricted to un-typed communications

Message Protocols

Synchronous

  • Delay either the sender or receiver until both have reached communication stage

Sender process

  • Sender delayed until
    • Receiver becomes available
    • Reciever acknowledges reception
Sender process

Receiver process

  • Receiver delayed until
    • Sender becomes available
    • Sender acknowledges transmission
Receiver process

Asynchronous

  • Neither sender nor receiver is blocked

  • Message not transferred directly, rather a buffer is required to store messages.

    • A policy is required for buffer sizes and buffer overflow situations
  • Sender is allowed to continue with any tasks and doesn't need to be waiting or be interrupted immediately to recieve the message(s)

Asynchronous

Emulated

Asynchronous

  • Asynchronous messaging able to be emulated with underlying synchronous messages
  • Intermediate process needs to be accepting messages at all times
    • Recieves sent messages asynchronously and hold onto them until receiver is ready for them
  • Also needs to send out messages on request
  • While messages are blocked, they are not actually delayed
Asynchronous emulated

Synchronous

  • Both processes voluntarily suspend themselves until transaction is complete
  • Processes aren't actually synchronised -> No immediate communication ever takes place
  • Sender, but not receiver, knows when transaction is complete
Synchronous emulated

Remote Invocation

  • Delay sender or receiver until the first rendezvous point
  • Sending data and performing side-effecting computation, returning it at the end
  • Pass parameters
  • Keeps sender blocked while receiver executes local procedure before releasing both out of rendezvous
Remote invocation
Emulated
  • Two synchronous messages (possibility of two combined middle async)
Remote invocation emulated
No result (Active message)
  • Don't care about results
    • Both processes are actually synchronised at time of invocation
  • i.e. perform some side effect
No result

Synchronous vs Asynchronous Communications

  • Want synchronous when we want synchronisation

  • Want most recent data -> Asynchronous

    • Needs a buffer and policy for overflow cases
  • Synchronous message passing in distributed systems requires hardware support

  • Asynchronous message passing requires buffers and overflow policies

Addressing (Namespace)

  • Direct
send <message> to <process-name>
wait for <message> from <process-name>
  • Indirect
send <message> to <mailbox>
wait for <message> from mailbox>
  • Asymmetrical addressing
    • Client-server paradigm
send <message> to ...
wait for <message>
ConnectionsFunctionality
one-to-onebuffer, queue, synchronisation
one-to-manymulticast
one-to-allbroadcast
many-to-onelocal server, synchronisation
all-to-onegeneral server, synchronisation
many-to-manygeneral network, bus-system

Message Structure

  • Communication systems only handle streams (packets) of basic element types
  • Complexity varies
  • Conversion routines for data-structures other than basic element types exist
    • Manually (POSIX, C)
    • Semi-automatically (CORBA)
    • Automatic (Compiler generated)
    • Typed-persistent (Ada, CHILL, Occam2)