1 / 8

Process Synchronization

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)

Rita
Télécharger la présentation

Process Synchronization

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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-memorymodel • 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 passingmodel • 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. • 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). • Message Passing • 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 Communications models. (a) Message passing. (b) Shared memory.

  6. Producer Consumer paradigm • A producer process producesinformation • 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 paradigmneeds synchronization The unbounded-buffer producer-consumer problem places no practical limit on the size of the buffer. Waiting means - Synchronization

  8. Producer Consumer paradigmmore 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.

More Related