Process
Synchronization
, Process Synchronization
A cooperating process is one that can affect or be affected by other processes executing in the
system.
Cooperating process
Can either
directly share a logical address space or be allowed to share data only
(That is, both code and data) through files or messages.
Concurrent access to shared data may result in data inconsistency!
In this chapter,
we discuss various mechanisms to ensure -
The orderly execution of cooperating process that share a logical address space,
So that data consistency is maintained.
, Producer Consumer Problem
A producer process produces information that is consumed by a consumer process.
For example, a compiler may produce assembly code, which is consumed by an assembler. The
assembler, in turn, may produce object modules, which are consumed by the loader.
• One solution to the producer-consumer problem uses shared memory.
• To allow producer and consumer processes to run concurrently, we must have available a
buffer of items that can be filled by the producer and emptied by the consumer.
• This buffer will reside in a region of memory that is shared by the producer and consumer
processes.
• A producer can produce one item while the consumer is consuming another item.
• The producer and consumer must be synchronized so that the consumer does not try to
consume an item that has not yet been produced.
Synchronization
, Process Synchronization
A cooperating process is one that can affect or be affected by other processes executing in the
system.
Cooperating process
Can either
directly share a logical address space or be allowed to share data only
(That is, both code and data) through files or messages.
Concurrent access to shared data may result in data inconsistency!
In this chapter,
we discuss various mechanisms to ensure -
The orderly execution of cooperating process that share a logical address space,
So that data consistency is maintained.
, Producer Consumer Problem
A producer process produces information that is consumed by a consumer process.
For example, a compiler may produce assembly code, which is consumed by an assembler. The
assembler, in turn, may produce object modules, which are consumed by the loader.
• One solution to the producer-consumer problem uses shared memory.
• To allow producer and consumer processes to run concurrently, we must have available a
buffer of items that can be filled by the producer and emptied by the consumer.
• This buffer will reside in a region of memory that is shared by the producer and consumer
processes.
• A producer can produce one item while the consumer is consuming another item.
• The producer and consumer must be synchronized so that the consumer does not try to
consume an item that has not yet been produced.