Inter-Processor Communication
In a multiprocessing
environment processor implies parallelism by concurrent processing. The
concurrent processing requires sharing of resources between the
processors and inter-processor communication.
Basically,
there are two ways by which inter process communication is achieved:
1. Using
Shared Variables 2. Using Message Passing
1. IPC Using Shared Variable
In this
system shared variable are stored in common memory which is accessible to all
processors in the system. While sharing common resources or shared variables conflict
problem may arise. It is necessary to prevent conflict use of
shared resources by several processors. This task is done by operating
system.
Figure : IPC using Shared Variable |
Master-slave
operating system: In this system, processor that executes the
operating system function is called master. The other processors are called slave.
When slave needs operating system service it requests it by interrupting the
master.
Separate
operating system: In each processor has entire copy of operating
system can be execute operating system functions. This organization is more
suitable for loosely couple system.
Distributed
operating system: In this operating system, routines are
distributed among the available processors. Such type operating system is also
known as floating operating system.
2. Using Message Passing
In
multiprocessor system with no shared memory, we use message passing mechanism
to perform inter-process communication. When processor wants to communicate
with another processor, it uses a special procedure which initiates
communication.
Figure : IPC using message passing |
It
identifies the destination processor and once source and destination processors
are identified a communication channel is established. A message is then sent
through the communication channel.
Inter-Processer Synchronization
At the
higher level of parallelism, the program is partitioned into process that are
executed in different processors. This technique is called concurrent
processing. During concurrent processing when two or more processors
need the same resource at a time, the contention problem arise.
Such problem can be solved by synchronization.
To
achieve synchronization a set of hardware primitives are used to automatically
read and modified a memory location without any interruption between the two
operations. Such mechanisms are necessary to protect data from being changed
simultaneously by two or more processors. This mechanism is known as mutual
exclusion.
A program
sequence which accesses the shared resources, one begun, must complete
execution before another processor accesses the same shared address. Thus,
program sequence which accesses the shared memory is known as critical section of
the program. Inter-process communication done by mutual exclusion with semaphore
and mutual exclusion using load and store conditional instruction.
To learn more about Interprocessor Communication & Synchronization, watch below video
Watch more videos click here.
No comments:
Post a Comment