Sei sulla pagina 1di 20

CCNCUkkLN1 kCCLSSLS

Cut||ne
W 8LCLuLnCL C8APS
W 1PL lC8k Anu !Cln CCnS18uC1S
W 1PL CC8LCln Anu CCLnu CCnS18uC1S
kLCLDLNCL GkAnS
W A precedence graph ls a dlrecLed acycllc graph
whose nodes correspond Lo lndlvldual
sLaLemenLs
W A edge from node Sl Lo node S[ lmplles S[ can
be execuLed only afLer sLaLemenL Sl has
compleLed execuLlon
Lxamp|e
Conslder Lhe followlng program segmenL
S1 ax+y
S2 bz+1
S3 cab
S4 wc+l
kLCLDLNCL GkAnS
S1 S2
S3
S4
Def|ne notat|on
W 8(Sl) Lhe read seL for Sl
W W(Sl) Lhe wrlLe seL for Sl
S cab
8(cab) a b
W(cab) c
ernste|ns cond|t|ons
1wo successlve sLaLemenLs S1 and S2 Lo be
execuLed concurrenLly lf
l) 8(S1) W(S2)
ll) W(S1) 8(S2)
lll) W(S1) W(S2)
rev|ous examp|e
S1 ax+y 8(S1) x y
S2 bz+1 8(S2) z
S3 cab W(S1) a
S4 wc+l W(S2) b
W S1 and S2 can be execuLed concurrenLly
(saLlsfy Lhe 8ernsLelns condlLlons)
W S2 cannoL be execuLed concurrenLly wlLh S3
slnce W(S2) 8(S3) b
|m|tat|on of precedence graph
W ulfflculLy of uslng a programmlng language
slnce lL ls a Lwo dlmenslonal ob[ecL
1nL ICkk AND ICIN CCNS1kUC1S
W 1he fork L lnsLrucLlon produces Lwo
concurrenL execuLlons ln a program
W Cne execuLlon sLarLs aL Lhe sLaLemenL labeled
L whlle Lhe oLher ls Lhe conLlnuaLlon of Lhe
execuLlon aL Lhe sLaLemenL followlng Lhe fork
lnsLrucLlon
1nL ICkk AND ICIN CCNS1kUC1S
W 1he [oln lnsLrucLlon provldes Lhe means Lo
recomblne Lwo concurrenL compuLaLlons lnLo
one
W 1he [oln lnsLrucLlon has parameLer (counL) Lo
speclfy Lhe number of compuLaLlons whlch are
Lo be [olned
W !oln counL counL
lf counL !0 Lhen
qulL
8LCln
counL 3 L1 S3
S1 CC 1C L3
lC8k L1
S2
S4
lC8k L2 L2 S6
S3 CC 1C L3
L3!Cln counL
S7
Lnu
1nL ICkk AND ICIN CCNS1kUC1S
|m|tat|on of ICkk]ICIN
W rogram has an awkward conLrol sLrucLure
(CC1C sLaLemenL has undeslrable effecLs)
1nL CCLGIN AND CCLND
CCNS1kUC1S
W All sLaLemenLs enclosed beLween CC8LCln
and CCLnu can be execuLed concurrenLly
1nL CCLGIN AND CCLND
CCNS1kUC1S
8LCln
S1
CC8LCln
S3
8LCln
S2
S4
CC8LCln
S3
S6
CCLnu
Lnu
CCLnu
S7
Lnu
1nL CCLGIN AND CCLND
CCNS1kUC1S
18? 1PlS !!
CCNCUSICN
W lC8k/!Cln consLrucL ls more powerful Lhan
Lhe CC8LCln/CCLnu

Potrebbero piacerti anche