Académique Documents
Professionnel Documents
Culture Documents
Concurrent grammar.
Communication & synchronization of
concurrent tasks.
Process / Thread System process
migration.
Shared memory.
Concurrent LISP.
Concurrent YACC.
Concurrent java.
Concurrent Grammer
S a SBC | aBC
CB BC
bCbc
aBab
cC cc
bB bb
Petri Net
Petri Net
Abstract formal model of information
flow
Major use:
Modeling of systems of events in which
it is possible for some events to occur
concurrently, but there are constraints
on the occurrences, precedence, or
frequency of these occurrences.
5
Markers (Tokens)
Tokens are moved by the firing of
6
transitions of the net.
A simple graph
representation
of a Petri net.
A marked
Petri net.
The marking
resulting from
firing transition
t 2.
Note that the
token in p1 was
removed &
tokens were
added to p2
& p3
9
(Figure 4)
Markings
resulting from
the firing of
different
transitions in the
net of Figure 3.
(b) Result of
firing transition t3
10
(Figure 4)
Markings
resulting from
the firing of
different
transitions in the
net of Figure 3.
(c) Result of
firing transition t5
11
(Figure 6)
Modeling of
a simple
computer system
13
(Figure 8)
Modeling of
simultaneous
which may
occur in either
order
14
(Figure 9)
Illustration of
conflicting
transitions.
Transitions tj
and tk conflict
since the
firing of one
will disable
the other
15
Customer 1
Customer 2
Take
order
Take
order
wait
eating
Serve food
3/17/15
Order
taken
Tell
kitchen
wait
eating
Serve food
Communication &
Synchronization of Concurrent
Tasks
Thread Vs Process
- Lightweight & heavyweight
Communication &
Synchronization of Concurrent
Tasks
Issues : If the communication between
dependent tasks is not properly designed then
data race condition can occur.
Concurrency models:
Dependency Relationships
Communication Dependencies
1. Posix_queue
2. Pipes
Cooperation Dependencies
When dependencies
bteween the threads
are calculated then
overall thread structure
of the process is
available.
The combination is
denoted by C(n,k)
N= total no. of
threads
K= threads involved
Interprocess Communication
e.g. Posix_queue.
Persistence of IPC
Persistence of object
Interprocess
communication
1. Files
2. Pipe
Named
Unnamed
3. Fifo
4. Shared memory
1. IPC - FILE
2. IPC- PIPE
2. IPC- PIPE
Priority
Length of msg
Msg or data
e.g.
PROT_READ
PROT_WRITE
PROT_EXEC
PROT_NONE
Explanation
We can read the data
We can write the data
Data can be executed
Data become inaccessible
Explanation
MAP_SHARED
MAP_PRIVATE
MAP_FIXED
made
Interthread Communications
Communication between threads is used to:1. Share data:The multiple threads share data for
processing required by concurrent
processes. The data can be modified or
new data can be created.
2. Send a message:
Synchronizing Concurrency
H/w resources.
Types of Synchronization
To share various resources there should be synchronization bet. the threads &
processes.
CRITICAL SECTION
Critical Sections
Critical Sections
PRAM MODELS
Semaphores
Process Migration:-
Remote Execution
Client
Server
Control
Function
Object
Main
Program
Arguments
Function/object
transfer
Argument transfer
Dispatcher
Function
Object
f( )
Remote
execution
Return value
Procedure code is
sent together with
arguments.
Server behaves like
a general cycle
server.
Server can evolve
itself.
Code on Demand
Client
Control
Server
Main
Program
Function
Object
func( )
Locally executed
Function/object itself
is returned.
Dispatcher
Remote
Function
Object
Process Migration
Time
Source Site
Destination Site
Process P1
:
:
:
:
Execution
suspended
Freezing
time
Transfer of
control
Execution
Resumed
:
:
:
:
Process P1
Selecting a process to
be migrated
Selecting the
destination node
Suspending the
process
Capturing the process
state
Sending the state to
the destination
Forwarding future
Concurrent lisp
pcall
(pcall + ( a b) ( c d))
(cond
(( = n 1) 1)
(( = n 2) 1)
newlisp
spawn
Concurrent java
java.util.concurrent
Processes
ProcessBuilder
Threads
Thread
Runnable
Subclass Thread
Concurrent YACC
A protocol-parser
paraLR parser
2. Concurrent YACC
2. Concurrent Java
8.Explain the concept.
1. IPC
2. ITC