Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Topic: Ipc Reader-Writer Problem

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 11

Topic

IPC READER-WRITER PROBLEM

Submitted by
Guided by
Abhijeet Pawar(04) Prof. A W. Sawarkar
What is Inter-Process Communication?

Inter-process communication or Interprocess communication (IPC)


refers specifically to the mechanisms an operating system provides to allow the
processes to manage shared data. Typically, applications can use IPC,
categorized as clients and servers, where the client requests data and the server
responds to client requests. Many applications are both clients and servers, as
commonly seen in distributed computing. Methods for doing IPC are divided
into categories which vary based on software requirements, such as
performance and modularity requirements, and system circumstances, such as
network bandwidth and latency.
Shared memory
This is a another mechanism by which processes can

communicate with each other.


In this mechanism we declare a section of memory as

shared memory.
This shared memory section is used by

communicating processes simultaneously.


What is Message Passing?

Message passing is a technique for invoking behavior


(i.e., running a program) on a computer.
 The invoking program sends a message to a process
(which may be an actor or object) and relies on the
process and the supporting infrastructure to select and
invoke the actual code to run.
Message passing differs from conventional
programming where a process, subroutine, or function
is directly invoked by name.
 
Synchronization
Process Synchronization means sharing system resources by
processes in a such a way that, Concurrent access to shared
data is handled thereby minimizing the chance of
inconsistent data. Maintaining data consistency demands
mechanisms to ensure synchronized execution of
cooperating processes.
Process Synchronization was introduced to handle problems
that arose while multiple process executions. 
What is a Semaphore?

Semaphore is a process synchronization tool. Semaphore is typically


an integer variable S that is initialized to the number of resources
present in the system and the value of semaphore can
be modified only by two functions wait() and signal() apart from
initialization.
The wait() and signal() operation modify the value of the
semaphore indivisibly. It means that when a process is modifying the
value of the semaphore, no other process can simultaneously modify
the value of the semaphore. Semaphore are distinguished by the
operating system in two categories Counting
semaphores and Binary semaphore.
Mutex
Mutual Exclusion Object is shortly termed as Mutex. From
the term mutual exclusion, we can understand that only one
process at a time can access the given resource.
The mutex object allows the multiple program threads to
use the same resource but one at a time not simultaneously.
When a program starts it request the system to creates a
mutex object for a given resource.
The system creates the mutex object with a unique name or
ID. Whenever the program thread wants to use the resource
it occupies lock on mutex object, utilizes the resource and
after use, it releases the lock on mutex object. Then the
next process is allowed to acquire the lock on mutex object.
BASIS FOR COMPARISON SEMAPHORE MUTEX

Basic Semaphore is a signalling mechanism. Mutex is a locking mechanism.

Existence Semaphore is an integer variable. Mutex is an object.

Function Semaphore allow multiple program threads to access a Mutex allow multiple program thread to access a single
finite instance of resources. resource but not simultaneously.

Ownership Semaphore value can be changed by any process acquiring Mutex object lock is released only by the process that has
or releasing the resource. acquired the lock on it.

Categorize Semaphore can be categorized into counting semaphore Mutex is not categorized further.
and binary semaphore.
Reader and Writer
 
The readers-writers problem relates to an object such as a file that is
shared between multiple processes. Some of these processes are readers
i.e. they only want to read the data from the object and some of the
processes are writers i.e. they want to write into the object.
The readers-writers problem is used to manage synchronization so
that there are no problems with the object data. For example - If two
readers access the object at the same time there is no problem. However if
two writers or a reader and writer access the object at the same time, there
may be problems.

You might also like