UNIT-5: Task Communication
UNIT-5: Task Communication
UNIT-5: Task Communication
TASK
COMMUNICATION
CONTENTS
5.1. TASK COMMUNICATION
a) Shared Memory
b) Message passing
c) Remote procedure call(RPC) and
Sockets
5.2. TASK SYNCHRONISATION
a) Task communication/ synchronisation
issues
b) Task synchronisation techniques
c) Device drivers
d) How to choose an RTOS
5.1. TASK COMMUNICATION
In a multitasking system, multiple
tasks/processes run concurrently(pseudo
parallelism) and each process may or may not
interact between.
Based on degree of interaction, the processes
running on an OS are classified as,
i) Co-operating process: In this model, one
process requires the inputs from other
processes to complete its execution
ii) Competing process: it do not share anything
among themselves but they share the system
resources
Co-operating processes exchanges information
and communicate through the following
methods:
i) Co-operation through sharing: The co-
operating process exchange data through
some shared resources.
ii) Co-operation through communication: no
data is shared between the processes. But
they communicate for synchronisation
The mechanism through which
processes/tasks communicate each other is
known as inter process/ Task communication
(IPC)
IPC is essential for process co-ordination.
The various types of IPC mechanisms adopted
by process are kernel(OS) dependent.
Some of the important IPC mechanisms
adopted by various kernel are: Shared
memory(pipes), message passing( Message
queue, mailbox, Signalling), RPC
5.1(a). SHARED MEMORY
Processes share some area of the memory to
communicate among them
Process 1 Shared memory data Process 2
a) pipes
b) Memory mapped objects
a) Pipes
• ‘pipe’ is a section of the shared memory used
by processes for communicating
• Pipes follow the client-server architecture
• A process which creates a pipe is known as a
pipe server and a process which connects to a
pipe is known as pipe client
• a pipe can be considered as a conduitfor
information flow and has two conceptual
ends
It can be unidirectional, allowing information flow
in one direction or bidirectional allowing bi-
directional information flow.
Process 1 Process 2
Pipe (named/un-named)
Write Read
PROCESS 1 PROCESS 2
b) mailbox
Mailbox is an alternate form of ‘message
queues’ and it is used in certain RTOS for IPC
Mailbox for IPC in RTOS is usually used for one
way messaging.
The task/thread which wants to send a
message to other task/threads creates a
mailbox for a posting the messages.
Mailbox server---> taks which are send
message
Mailbox client --- > tasks which are receive
message.
TASK 1
MAILBOX
TASK 2 TASK 4
TASK 3
c) Signalling
Signalling is a primitive way of
communication between processes/threads
Signals are used for asynchronous
notifications where one process/thread fires a
signal, indicating the occurence of a scenario
which the other process(es)/Thread(s) is
waiting
Signals are not queued and they do not carry
any data.
5.1(c). RPC and SOCKETS
PROCESS
NETWORK
PROCESS 1 PROCESS 2
PROCEDURE
Ignore deadlocks
Avoid deadlocks
Prevent Deadlocks
C) Dining Philosophers problem
e) Readers-Writers Problem
f) Priority inversion
5.2(b). Task synchronisation Techniques