Lec11_Disjoint_Parallel - Disjoint Parallel Programs CS 536...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Disjoint Parallel Programs CS 536 Notes, Lecture 11, Mon Nov 15, 2010 A. Why Parallel programs are more exible than sequential programs. Parts of a parallel program can interfere with other parts. Knowing the behavior of the sequential components of a parallel program isnt enough to let us figure out its overall behavior. To study parallel programs, it helps to start with simple disjoint parallel programs and work our way up toward fully parallel programs. B. Outcomes After this lecture, you should Know the syntax of parallel programs. Know how to interleave execution of sequential threads. Know what makes a parallel program disjoint. Know that it doesnt matter how we interleave execution of a disjoint parallel program. C.Quiz 2 (30 min) D.Basic Definitions for Parallel Programs Syntax of parallel programs Syntax rule for parallel statements: S : := [ S || S || || S ] [ S || S || || S n ] is the parallel composition of the n sequential threads S , S , , S n in parallel. E.g., [ x:= x+1 || x:= x*2 ]. Can embed parallel programs within larger programs but cant nest parallel programs. Executing and Combining Parallel Programs We run sequential programs in parallel by interleaving their execution execute S for a while, then execute S for a while, etc. Execution can end in different states depending on how the interleaving is done. E.g., evaluate [ x:= x+1 || x:= x*2 ] by (1) Evaluating x:= x+1 and then x:= x*2 or ( 2 ) Evaluating x:= x*2 and then x:= x+1 . A parallel programs properties can be very different from the behaviors of the individual threads. Example: { x = 5 } x:= x+1 { x = 6 } and { x = 5 } x:= x2 { x = 10 } Illinois Institute of Technology Notes for Lecture 11 CS 536: Science of Programming - 1 of 8 - James Sasaki, 2010 But { x = 5 } [ x:= x+1 || x:= x2 ] { x = 11 x = 12 }. The problem with reasoning about parallel programs is that different threads can interfere with each other: They can break the assumptions used by other threads. Full interference is tricky, so were going to work our way up to it. E. Disjoint Parallel Programs Very simple, limited parallel programs whose threads dont interact at all (much less interfere). This models computations with n processors that share readable memory but not writable memory. Simple model will help us define some basic machinery. Definition : The threads S , S , , S n are pairwise disjoint if no program can change the variables used by any other: change ( S i ) vars ( S j ) = for all 1 i j n ....
View Full Document

This note was uploaded on 04/17/2011 for the course CS 536 taught by Professor Cs536 during the Fall '08 term at Illinois Tech.

Page1 / 8

Lec11_Disjoint_Parallel - Disjoint Parallel Programs CS 536...

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