chapter 5 interprocess Flashcards
when correct execution depends on the timing of processes or threads running a critical section of code
Race condition
when a lower priority item is unfairly delayed by higher priority items arriving later (never have chance to get into CPU)
Starvation
a portion of a program that modifies a shared resources (where it will enter to do operation)
critical section
the conditions where two or more processes are not able to continue because they are waiting on each other to either release a resource or do something
Deadlock
Process executing concurrently in OS may be either ___________ or ____________ processes
independent or coorperating
what is independent process
- If it cannot affect or be affected by the other process executing in the
system - If it does not share data with any other process
what is cooperating process
If it can affect or be affected by the other processes executing in the
system
If it share data with any other process
Several reasons for providing an environment that allows process cooperation (why process cooperation)?
- information sharing
- computation speedup
- modularity
- convenience
cooperating process require __________ that will allow them to exchange _____ and ______
IPC (interprocess communication),
data and
information
Two fundamental model of interprocess communication
- shared memory: faster
- message passing: time-consuming
Other processes that wish to communicate using this ________must attach it to their _________
shared-memory segment,
address space
The producer process produces ________ that is ________ by a consumer process
information
consumed
what is unbounded buffer and bounded buffer?
unbounded buffer: not practical limit size on buffer
bounded buffer: there is a fixed size of buffer
what is Message Passing system?
Mechanism for processes to communicate and to synchronize their actions
IPC facility provides two operations
- send (message)
- receive (message)
If processes P and Q wish to communicate, they need to via message passing systems
Establish a communication link between them
Exchange message via send/receive
if processes wish to communicate via shared memory
IPC using shared memory requires communicating the process to establish a region of shared memory
Implementation of communication link
Physical:
Shared memory
Hardware bus
Network
Logical
Direct or indirect
Synchronous or asynchronous
Automatic or explicit buffering
Properties of direct communication link
Link are established automatically
A link is associated with exactly one pair of communicating processes
Between each pair there exists exactly one link
The link may be unidirectional, but is usually bi-directional
what is direct communication
Processes must name each other explicitly
send(P, message) – send a message to process P receive(Q, message) – receive a message from process Q
what is indirect communication?
Messages are directed and received from mailboxes (also referred to as ports)
Each mailbox has a unique id
Processes can communicate only if they share a mailbox
properties of communication link
Properties of the communication link
Link established only if processes share a common mailbox
A link may be associated with many processes
Each pair of processes may share several communication links
Link may be unidirectional or bi-directional
Message passing may be either _______or _________
blocking or non-blocking
what is synchronous
Blocking is considered synchronous
Blocking send – the sender is blocked until the message is received
Blocking receive – the receiver is blocked until a message is available
what is asynchronous
Non-blocking is considered asynchronous
Non-blocking send – the sender sends the message and continue
Non-blocking receive – the receiver receives: A valid message, or
Null message
When both send() and receive() are blocking, we have a _________
between the sender and receiver
rendezvous
If special care is not taken to correctly coordinate or synchronize access to shared resources, it can cause a number of problems:
Starvation
Deadlock
Data Inconsistency
Shred Buffer Problem
A condition can occur when multiple processes or threads compete for access to a shred resource
starvation
A condition can occur when two processes need multiple shared resources at the same time in order to continue
A deadlock
When shared resources are modified at the same time by multiple resources, data errors or inconsistencies may occur
data inconsistency
Sections of a program that might cause these problems are called __________
Failure to coordinate access to a critical section is called a _____________
critical sections
race condition