1 / 10

Concurrent Execution

Concurrent Execution. CS561 Computer Architecture Hye Yeon Kim. Chapter topics. Processes represent independent threads of control, each of which executes sequential code. Process creation declaration Unabbreviated form of processes Concurrent invocation statement

Download Presentation

Concurrent Execution

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Concurrent Execution CS561 Computer Architecture Hye Yeon Kim

  2. Chapter topics • Processes • 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 executionthe order of the p1, p2 execution is not knownwrite(“in p1”,x) # added to process p1write (“in p2”,x) # added to process p2The 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

More Related