Lec4-2 - Concurrent processes Concurrent Execution We...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Concurrent Execution Abhik Roychoudhury CS 3211 National University of Singapore CS3211 2009-10 by Abhik Modified from Kramer and Magee’s lecture notes. Reading material: Chapter 3 of Textbook. 1 Concurrent processes We structure complex systems as sets of simpler activities, each represented as a sequential process . Processes can overlap or be concurrent, so as to reflect the concurrency inherent in the physical world, or to offload time-consuming tasks, or to manage communications or other devices. Designing concurrent software can be complex and Model processes as finite Concept of a process as a sequence of actions. error prone. A rigorous engineering approach is essential. Model processes as finite state machines. Program processes as threads in Java. CS3211 2009-10 by Abhik 2 Definitions ± Concurrency z Logically simultaneous processing. Does not imply multiple processing elements (PEs). Requires interleaved execution on a single PE. ± Parallelism A Time B C z Physically simultaneous processing. Involves multiple PEs and/or independent device operations. Both concurrency and parallelism require controlled access to shared resources . We use the terms parallel and concurrent interchangeably and generally do not distinguish between real and pseudo-concurrent execution. Time C B A 3.1 Modeling Concurrency ± How should we model process execution speed? z arbitrary speed (we abstract away time) ± How do we model concurrency? z arbitrary relative order of actions from different processes ( interleaving but preservation of each process order ) ± What is the result? z provides a general model independent of scheduling ( asynchronous model of execution) parallel composition - action interleaving If P and Q are processes then (P||Q) represents the concurrent execution of P and Q. The operator || is the parallel composition operator. ITCH = (scratch->STOP). think Æ talk Æ scratch think Æ scratch Æ talk scratch Æ think Æ talk Possible traces as a result of action interleaving. CONVERSE = (think->talk->STOP). ||CONVERSE_ITCH = (ITCH || CONVERSE). parallel composition - action interleaving 2 states 3 states ITCH scratch 0 1 CONVERSE think talk 0 1 2 scratch (0,0) (0,1) (0,2) (1,2) (1,1) (1,0) from CONVERSE from ITCH 2 x 3 states CONVERSE_ITCH think scratch talk scratch talk think 0 1 2 3 4 5
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 parallel composition - algebraic laws Commutative: (P||Q) = (Q||P) Associative: (P||(Q||R)) = ((P||Q)||R) = (P||Q||R). Clock radio example: CLOCK = (tick->CLOCK). RADIO = (on->off->RADIO). ||CLOCK_RADIO = (CLOCK || RADIO). LTS? Traces? Number of states? Class Exercise CLOCK = (tick->CLOCK). RADIO = (on->off->RADIO). ||CLOCK_RADIO = (CLOCK || RADIO). LTS? Traces? Number of states? CS3211 2009-10 by Abhik 8 The components CLOCK and RADIO run independently. modeling interaction - shared actions If processes in a composition have actions in common, these actions are said to be shared .
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/02/2011 for the course CS 3211 taught by Professor Dunnowho during the Spring '11 term at National University of Singapore.

Page1 / 7

Lec4-2 - Concurrent processes Concurrent Execution We...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online