slides04 Flashcards
cooperating processes and reasons for using them
-can affect or be affected by another process
-reasons:P
1. information sharing
2. computation speedup
3. modularity
two models of IPC
- shared memory
- memory passing
shared memory
- in user mode
- physical or virtual memory that is accessible to both processes
- producer/consumer does the following to access shared memory:
1. create shared memory (must be on same computer)
2. map shared memory into their address spaces
3. read/write to shared memory - tradeoff: cost of setting up shared memory space vs quick read/write
message passing
- suitable for small number of message transfers
- processes read/write to a message queue in kernel
types of communication links (3)
- direct vs indirect
- synchronous vs asynchronous
- automatic vs explicit buffering
direct vs indirect communication links
DIRECT
- 2 processes must be able to address each other
- advantages: processes could have multiple communication links
INDIRECT
- through a mailbox or port
- messages are consumable -> once consumed, it is no longer available
advantages/disadvantages of indirect communication links
advantages:
- sender/receiver identities can change and communication program does not need to be updated eg. zoom
disadvantages
- higher delay of sending messages
- number of messages that can be sent is lower
mailboxes vs ports
- ports only have one consumer; we know exactly where our message is going
- mailboxes can have multiple consumers; more fault tolerance, load balance between consumers
synchronization with message passing
- message passing can be blocking or non-blocking
BLOCKING (SYNCHRONOUS)
- blocking send: sender is blocked until message is received
- blocking receive: receiver is blocked until message is available
NON-BLOCKING (ASYNCHRONOUS)
- non-blocking send: sender sends msg and continues
- non-blocking receive: receiver receives either a valid msg or a null msg
- minimizes wait times
- if both sender/receiver are synchronous: RENDEZVOUS (they reach and leave a point in execution at the same time)
buffering in communication links
- zero capacity: no messages are queued in link. sender must wait for the receiver
- bounded capacity: finite length of n messages. sender must wait if buffer is full
- unbounded capacity: infinite length. sender never waits.