1. Process Communication
- Mechanism for processes to communicate and to synchronize their actions
- Two models
- communication through a shared memory
- communication through message passing
2. Communication through message passing
- Message system
- processes communicate with each other without resorting to shared variables
- A message passing facility must provide at least two operations
- send(message, recipient)
- receive(message, recipient)
- with indirect communication, the message are sent to and received from mailboxes
- Messaging passing can be either blocking (synchronous) or non-blocking (asynchronous)
- blocking send: the sending process is blocked until the message is received by the receiving process or by the mail box
- non-blocking send: the sending process resumes the operation as soon as the message is received by the kernel
- blocking receive: the receiver blocks until the message is available
- non-blocking receive: receive operation does not block, it either returns a valid message or a default value (null) to indicate a non-existing message
3. Communication through shared memory
- The memory region to be shared must be explicitly defined
- using system calls, in unix
- shmget: creates a shared memory block
- shmat: maps an existing shared memory block into a process’s address space
- shmdt: removes (unmaps) a shared memory block from the process’s address space
- shmctl: is a general-purpose function allowing various operations on the shared block (receive information about the block, set the permissions, lock in memory)
- Problems with simultaneous access to the shared variables
- Compilers for concurrent programming languages can provider direct support when declaring variables.