Task communication

6,558 views 32 slides Apr 06, 2020
Slide 1
Slide 1 of 32
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32

About This Presentation

A brief introduction to task communication in real time operating system.It covers Inter-process communication like concepts of shared memory , message passing, remoteprocedure call .Interprocess communication (IPC) refers specifically to the mechanisms an operating system provides to allow the proc...


Slide Content

TASK
COMMUNICATION
A PRESENTATION BY:



JAIKI (13)
JAYANTI SINGH (14)
KAVITA RAJPUT (19)

WHAT IS A TASK ?
It is defined as a program in execution and has an
order of priority , schedule or timeline for
execution.

Also called a “job” .
A program / part of task / job in execution is called
a process.

TASKS OF THE OPETATING SYSTEM

TASK COMMUNICATION
Task communication 
comprises all mechanisms serving to exchange
information among tasks.
 
In a multitasking system multiple task/ process run concurrently (in
pseudo parallelism ) & each process may / may not interact .
Based on degree of interaction , processes running on OS are classified
as :
 Cooperating process
 Competing process

Cooperating Process
Cooperating processes are those that can affect or
are affected by other processes running on the
system. Cooperating processes may share data with
each other.
Exchange of information & communication by:
Cooperation by sharing
Cooperation by communication

Cooperation by sharing
The cooperating processes can cooperate
with each other using shared data such as
memory, variables, files, databases etc.
Critical section is used to provide data
integrity and writing is mutually exclusive to
prevent inconsistent data.

Cooperation by communication
No data is shared between processes . They
communicate for synchronization . The cooperating
processes can cooperate with each other using
messages. This may lead to deadlock if each
process is waiting for a message from the other to
perform a operation. Starvation is also possible if a
process never receives a message.

Competing Process
The processes do not share anything among themselves but they
share system resources . These type of processes compete for
system resources like file, display devices etc.
PROCESS 1 PROCESS 2 PROCESS 3
SHARED RESOURCES
(Critical Section)

INTER PROCESS COMMUNICATION (IPC)
The mechanism by which process or task communicate.
Essential for process coordination
IPC Mechanisms:
Shared Memory
Message Passing
Remote Procedure Call & Sockets

Shared Memory
Information to be communicated is written to shared
memory. Process that require this information can read it
from there.
It’s implementation is kernel dependant.
Mechanisms for implementing shared memory for IPC :
Pipes
Memory mapped objects

PIPES
A section of shared memory used by processes for
communicating .
Process that create a pipe – Pipe Server
Process that connect a pipe – Pipe Client
There are two types of pipe for IPC :
Anonymous pipes
Named pipes
WRITE ()
READ()
PROCESS
P[0]
P[1]

Anonymous pipe:
Unnamed, unidirectional for data transfer between two processes.
Named pipe:
Named , unidirectional / bidirectional for data exchange between
two processes.
Any process can act as both client and server allowing
point to point communication.

Memory Mapped Objects
A shared memory technique adopted by RTOS for allocating
shared block of memory that can be accessed by multiple
process simultaneously.
Any process which want to share data with other process can
map physical memory area of mapped object to it’s virtual
memory space and use it for sharing data.

Memory mapped
objects

MESSAGE PASSING
Operations
Send(message)
Receive(message)
Methods to implement link b/w two processes
Direct or indirect communication
Synchronous or asynchronous communication

Direct communication
Each process must explicitly name the recipient or sender of
communication.
send(P, message) – send a message to process P
receive(Q, message) – receive a message from process Q
Communication link has the following properties
Link is automatically established. Process must only know the
identity of other process.
Link is associated with exactly two processes
B/w each pair of processes, exists exactly one link

Symmetric Addressing

Asymmetric Addressing

Indirect communication
Messages are sent and received through mailboxes or ports.
Send(A, message) – send a message to mailbox
Receive (A, message) – receive a message from mailbox A
Link properties
Link is established between a pair of processes only if both
members of the pair have a shared mailbox.
Link may be associated with more than two processes.
Between each pair of communicating processes,
there may be a number of different links, with each
link corresponding to one mailbox.

Mail Box

Type of Communication
link by Mail Box:

One to One Link.
Many to One Link.
One to Many Link.
Many to Many link.

Difference between Shared
memory and Message passing
Shared memory
1.Processes exchange
information by reading
or writing into the
shared region.
2.Used for exchanging
large amount of data.
3.Faster than message
passing (system calls
required only to
establish shared
region and rest all
access are treated as
normal memory
access)
Message passing
1.Direct exchange of
messages.
2.Used for exchanging
small amounts of
data.
3.Slower than shared
memory because it is
implemented using
system calls , which
involves kernel
intervention.

REMOTE PROCEDURE CALL (RPC)
Is a protocol that one program can use to request a service from a
program located in another computer in a network without having to
understand network details.
A procedure call is also sometimes known as a function call or a
subroutine call.
The requesting program is a client and the service- providing
program is the server.
When program statements that use RPC are compiled into an
executable program, a stub is included in the compiled code
that acts as the representative of the remote procedure code.
the server includes a runtime program and stub that
interface with the remote procedure itself.

RPC allows programs to call procedures located on other machines.


When a process on machine A calls' a
procedure on machine B, the calling process
on A is suspended, and execution of the
called procedure takes place on B.
Information can be transported from the
caller to the callee in the parameters and
can come back in the procedure result.

STUBS
When the calling process calls a procedure, the action performed by that procedure will
not be the actual code as written, but code that begins network communication.
It has to connect to the remote machine, send all the parameters down to it, wait for
replies, do the right thing to the stack and return. This is the client side stub.
The server side stub has to wait for messages asking for
a procedure to run.
It has to read the parameters, and present them in a suitable form to execute the
procedure locally. After execution, it has to send the results back to the calling process.

HOW RPCWORKS?

An RPC is analogous to a function call. Like a
function call, when an RPC is made, the
calling arguments are passed to the remote
procedure and the caller waits for a response
to be returned from the remote procedure.
The client makes a procedure call that sends a
request to the server and waits.
When the request arrives, the server calls a
dispatch routine that performs the requested
service, and sends the reply to the client.
After the RPC call is completed, the client
program continues. RPC specifically
supports network applications.

RPC APPLICATION DEVELOPMENT
To develop an RPC application the following steps are needed:
Specify the protocol for client server communication
 Develop the client program
 Develop the server program
The programs will be compiled separately.
The communication protocol is achieved by generated stubs
and these stubs and RPC (and other libraries) will need to
be linked in.

STUB
The client calls the local stub procedure. The stub packages up the
parameters into a network message. This is called marshaling.
Networking functions in the O/S kernel are called by the stub to send the
message.
The kernel sends the message(s) to the remote system. This maybe
connection-oriented or connectionless.
A server stub unmarshals the arguments from the network message.
The server stub executes a local procedure call.
The procedure completes, returning execution to the server stub.
The server stub marshals the return values into a networkmessage.
The return messages are sent back.
The client stub reads the messages using the network functions.
The message is unmarshalled. And the return values are set on the
stack for the local process.

STUB

BIBLIOGRAPHY

www.geeksforgeeks.org/inter-process-com
municationipc/
www.w3schools.in/operating-system-tutori
al/interprocess-communicationipc/
microcontrollerslab.com/embedded-
operatingsystem/
www.sciencedirect.com/topics/computer-sc
ience/embeddedoperating-system
www.slideshare.net

THANK YOU