Concurrent process

yogendrajoshi3 1,390 views 21 slides Jul 18, 2016
Slide 1
Slide 1 of 21
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

About This Presentation

important concurrent process


Slide Content

L Cdr Manish Tandon, CAT
CONCURRENT
PROCESS

L Cdr Manish Tandon, CAT
CONCURRENT PROCESS
What are the consequences and ramification
of the co-existence of processes within one
system?
What are the effects of processes competing
for resources?
How are the need of processes which want to
communicate with each other met?

L Cdr Manish Tandon, CAT
TYPES OF PROCESS
Fully independent processes; Users working
on applications within the system such as
compiling and running their own programmes.
Independent but related processes;Users
contributing to one application such as
several clerks in an order processing
department.

L Cdr Manish Tandon, CAT
TYPES OF PROCESS
Concurrent Programming applications,
Applications constituted as a set of co-
operating processes.

L Cdr Manish Tandon, CAT
RESOURCES
Obvious Resources: Processor, Main
Memory, I/O devices, Secondary Storage,
etc.
Logical Resources: Data Items in Main
Memory or on secondary storage employed
for system such as message queues, shared
data structures etc.

L Cdr Manish Tandon, CAT
RESOURCES
Resources can be classified as reusable or
consumable.
Reusable resource is not destroyed by being
used , eg.. Physical Resource – Processor,
etc. if resource can be used by one process
at a time it is called serially reusable , eg.
Printer.

L Cdr Manish Tandon, CAT
RESOURCES
Consumable Resource is a transient data
item, a signal which is created by one process
and ceases to exist when received by
another.

L Cdr Manish Tandon, CAT
MUTUAL EXCLUSION &
DEADLOCK
Principal problem arising from sharing of
serially reusable resources is to ensure that
they are only used by one process at one
time ie… ensure mutual exclusion. Eg. A
printer must remain allocated to the process
until the printout is completed.

L Cdr Manish Tandon, CAT
MUTUAL EXCLUSION &
DEADLOCK
Mutual Exclusion creates the potential danger
of Deadlock.
A process is said to be deadlocked if it is
waiting for a resource held by the other.

L Cdr Manish Tandon, CAT
ACHIVING MUTUAL
EXCLUSION
Operating System maintains the centralised control
of resources , hence Mutual Exclusion is readily
achieved.
Software Solutions – Flags, etc.
Hardware Solutions - Machine Instructions (Test
And Set), etc.
Semaphores – Development of Software Solution,
Low Level software techniques such as GOTO, etc.

L Cdr Manish Tandon, CAT
ACHIVING MUTUAL
EXCLUSION
Monitor – programming constructs used to
control access to shared data.
File and Record Locking.

L Cdr Manish Tandon, CAT
DEADLOCK
Deadlock can arise in many different and
unanticipated situations. They generally occur
in normal running of a system and can not be
attributed to faulty programming only.

L Cdr Manish Tandon, CAT
CONDITIONS FOR
DEADLOCK
Mutual Exclusion : Only one process can use a
resource at a time.
Resource Holding : Processes hold some resources
while requesting more.
No Preemption : Resources can not be forcibly
removed from a process.
Circular Wait : A closed circle of processes exists,
where each process requires a resource held by
next.

L Cdr Manish Tandon, CAT
DEALING WITH DEADLOCK
Deadlock Prevention : Deadlock not occur
due to adoption of sound resource allocation
policy. Eliminates all four conditions and does
not let them occur. Inefficient way of handling
deadlock.

L Cdr Manish Tandon, CAT
DEALING WITH DEADLOCK
Deadlock Avoidance : Although deadlock is
still possible, the system will avoid it when
one threatens, ie.. when a deadlock would
arise from a particular resource allocation -
this allocation is not done. Various techniques
used – Bankers Algorithm, etc.

L Cdr Manish Tandon, CAT
DEALING WITH DEADLOCK
Deadlock Detection : A deadlock detection strategy
accepts the risk of a deadlock occurring and
periodically executes a procedure to detect any in
place. The usual principle applied is to detect
circular wait situation in resource allocation and
request information maintained by the system…
while this is quite feasible , it can consume
considerable processing time. The frequency of
checking routine would need to reflect the probability
of deadlock occurrence.

L Cdr Manish Tandon, CAT
INTERPROCESS COMMUNICATION
Modern Operating System provide variety of
facilities to processes which require to them
communicate with on another. The nature of
communication ranges from the simple signaling of
an event, to the passing of messages via a queuing
system . Techniques available for these include :
 Signals
 Shared Files ie.. Pipes
 Message Passing
 Shared Memory

L Cdr Manish Tandon, CAT
INTERPROCESS COMMUNICATION
Signals : A fairly primitive form of communication
used to alert a process to occurrence of some event
usually abnormal condition something similar to
Interrupt. Eg. Ctrl ‘C’ Key Combination, Kernel sends
signal SIGINT to all processes which would
terminate by default due to receipt of this signal
except SHELL which ignores it.

L Cdr Manish Tandon, CAT
INTERPROCESS COMMUNICATION
Pipes : Pipe is a mechanism whereby the
output of one process is directed into the
input of another. Implicit in this operation is
the creation of an temporary intermediate file
into which the first process writes its output
and from which the second process reads its
input. Widely used in UNIX.

L Cdr Manish Tandon, CAT
INTERPROCESS COMMUNICATION
Message Passing : A sequence of arbitrary
characters can be sent from one process to
other. Similar to Pipe, but Message Passing is
more flexible and transparent.
Communication takes place via message
queues.

L Cdr Manish Tandon, CAT
INTERPROCESS COMMUNICATION
Shared Memory : Concept of shared memory
segments , which can be shared by two or
more processes. Unix provides this facility, by
providing four specific system calls for this
technique.
Tags