Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS561 Computer Architecture Hye Yeon Kim

Similar presentations


Presentation on theme: "CS561 Computer Architecture Hye Yeon Kim"— Presentation transcript:

1 CS561 Computer Architecture Hye Yeon Kim
Concurrent Execution CS561 Computer Architecture Hye Yeon Kim

2 Chapter topics Processes Process creation
represent independent threads of control, each of which executes sequential code. Process creation declaration Unabbreviated form of processes Concurrent invocation statement Process scheduling & priorities

3 Processes Declarations
Processes in a resources or global are created when the resource or global is created. Processes are created as their declarations are encountered in executing the resource's or global’s initial code. (the initial code continues as soon as a process is created. It does not wait for the process to terminate.) For process declarations that contains quantifiers, one instance of the process is created for each combination of values of the bound variables.

4 Non- deterministic execution the order of the p1, p2 execution is not known write(“in p1”,x) # added to process p1 write (“in p2”,x) # added to process p2 The output from one write will not one interleaved with the output from the other.

5 Program with multiple processes terminates when all processes have terminated, a deadlock has occurred, or a stop statement is executed. Any final code in the main resource is then executed, and globals imported by the main resources are destroyed (unless a stop statement is executed with a non-zero exit status)

6 Unabbreviated form of processes
When processes need to be created as a program executes, we can use unabbreviated forms. proc and send invocation has been abbreviated in process declaration. send: a asynchronous invocation (i.e. non-blocking) call: a synchronous invocation (i.e. blocking) a send does not wait for the invoked proc to return any results; it terminates immediately after passing the arguments to the proc. A new process is created to execute the proc; it executes in parallel with the process that executed send

7 Concurrent invocation without postprocessing code
co p(3) // q() // a:= r(x,y) oc final invocation assigns the value that r returns to a. It terminates when all invocations terminates.

8 Concurrent invocation
It consists of one or more concurrent commands separated by // delimiters: co concurrent_command // concurrent_command // ... oc Each concurrent command consists of an invocation and optional block of postprocessing code. Invocation or invocation -> block

9 Concurrent invocation with postprocessing code
All invocations are first started in parallel. Then as each invocation terminates, the corresponding postprocessing block is executed, if there is one. Postprocessing blocks are executed one at a time; they are not executed concurrently and thus can change variables without requiring mutual exclusion.

10 Process scheduling & priorities
setproirity function


Download ppt "CS561 Computer Architecture Hye Yeon Kim"

Similar presentations


Ads by Google