Presentation is loading. Please wait.

Presentation is loading. Please wait.

Process Synchronization

Similar presentations


Presentation on theme: "Process Synchronization"— Presentation transcript:

1 Process Synchronization
Cooperating Processes Process Cooperation Purposes Information sharing (Share files) Computation speedup (create subtasks to run simultaneously) Modularity (system function divide into separate processes or threads) Convenience (Run several tasks of the same user in the same environment at the same time)

2 Inter process communication (IPC) mechanisms
Concurrent execution of cooperating processes requires mechanisms that allow processes to communicate with one another and to synchronize their actions. Cooperating processes require an interprocess communication (IPC) mechanism that will allow them to exchange data and information to communicate and to synchronize. OS provides those IPC mechanisms.

3 IPC models There are two fundamental models of interprocess communication: (1) shared memory and (2) message passing. In the shared-memory model a region of memory that is shared by cooperating processes is established. Processes can then exchange information by reading and writing data to the shared region. In the message passing model communication takes place by means of messages exchanged between the cooperating processes.

4 IPC models Communications models. (a) Message passing. (b) Shared memory.

5 IPC models. Tradeoff. Message Passing Shared Memory Slow speed
(system calls, kernel intervention) Complex to implement for inter process sharing. data is sent by message Easier to implement for Inter Process and Inter Computer communication / synchronization Shared Memory Maximum speed (memory operations) Convenience for sharing between local processes (simple write/read) Difficult to implement for Inter Computer sharing or communication (needs polling). Communications models. (a) Message passing. (b) Shared memory.

6 Producer Consumer paradigm
A producer process produces information that is consumed by a consumer process. The producer and consumer must be synchronized. Web server produces HTML files and images which are consumed by the client print program produces characters that are consumed by the printer driver

7 Producer Consumer paradigm needs synchronization
The unbounded-buffer producer-consumer problem places no practical limit on the size of the buffer. Waiting means - Synchronization

8 Producer Consumer paradigm more synchronization
The bounded-buffer assumes a fixed buffer size. The Bounded Buffer Problem - to make sure that the producer won't try to add data into the buffer if it's full and that the consumer won't try to remove data from an empty buffer.


Download ppt "Process Synchronization"

Similar presentations


Ads by Google