Anda di halaman 1dari 31

|  |

       | 


What is parallel processing?

ë The simultaneous use of more than one CPU to


execute a program is called parallel processing.

ë It works on the principle that large problems can


often be divided into smaller ones, which are then
solved concurrently i.e in parallel.
K 
 
|  
 
_   

KK K
K 
  K   K 
      

K 
   
  K    
    
   
K    
  K   KK

ë R serial (non-parallel) computer.


ë Kingle instruction.
ë Kingle data.
ë Examples: most PCs, single CPU
workstations and mainframes.
K    
  
    K

     
  K   K

     
  
    

 | |  

ë Ô  para 
ë  ruc
 para 
ë aa para 
ë a para 
Ô     

ë Kpeed-up in computer architecture was driven by


doubling computer word size²the amount of
information the processor can execute per cycle.
ë Increasing the word size reduces the number of
instructions the processor must execute to
perform an operation on variables whose sizes are
greater than the length of the word.
  
      
ë The instructions can be re-ordered and combined into
groups which are then executed in parallel without
changing the result.
ë Processor with an N-stage pipeline can have up to N
different instructions at different stages of completion.
ë The canonical example of a pipelined processor is a
RIKC processor, with five stages: instruction fetch,
decode, execute, memory access, and write back. The
Pentium 4 processor had a 35-stage pipeline.
Oata parallelism
ë Î PREV2  0
ë 2 PREVÎ  Î
ë  CUR  Î
ë  d

ë  CUR  PREVÎ + PREV2


ë 6 PREV2  PREVÎ
ë  PREVÎ  CUR
ë 8 wh  (CUR < Î0)
Task parallelism
ë Entirely different calculations can be performed on either
the same or different sets of data.
ë This contrasts with data parallelism, where the same
calculation is performed on the same or different sets of
data. Task parallelism does not usually scale with the size
of a problem.
K  
ë (ultiple processors can operate independently but
share the same memory resources.

ë Changes in a memory location effected by one


processor are visible to all other processors.

ë Khared memory machines can be divided into two


main classes based upon memory access times: ° 
and ° 
°   °

ë (ost commonly represented today by Kymmetric


(ultiprocessor (K(P) machines.

ë Identical processors.

ë Equal access and access times to memory.

ë Kometimes called CC-U(R - Cache Coherent U(R.


[ °   
[°
ë ften made by physically linking two or more K(Ps.
ë ne K(P can directly access memory of another
K(P.
ë Not all processors have equal access time to all
memories.
ë (emory access across link is slower
ë If cache coherency is maintained, then may also be
called CC-NU(R - Cache Coherent NU(R
 
 
6  
K  
| |  

ë Khard M
ry M
d
ë hrad M
d
ë Mag Pa g M
d
ë aa Para M
d
ë ybr d
K   
ë In the shared-memory programming model, tasks share a
common address space, which they read and write
asynchronously.
ë Rn advantage of this model from the programmer's point of
view is that the notion of data "ownership" is lacking, so there
is no need to specify explicitly the communication of data
between tasks. Program development can often be simplified.
ë Rn important disadvantage in terms of performance is that it
becomes more difficult to understand and manage data
locality.
  
|K!  
Õ brary bad; ru r para c
d g
 Kpc  d by h EEE POK Î00.Îc a dard
(Î).
 C Õa guag
y
 C

y rrrd 
a Phrad.
 M
 hardwar  d
r
w
r Phrad add 


h r pr
pr ary hrad p a
.
 Vry p c  para ; ru r  g  ca 
pr
grar a 

da .
 |
 C
p r d rc  bad; ca u r a c
d
 J
y d d a d  d
rd by a gr
up
 aj
r
c
pur hardwar a d 
war  d
r. h
Op MP F
rra AP wa rad Oc
br 28, Î.
h C/C++ AP wa rad a Î8.
 P
rab / u pa
r, cud g U  a d W d
w
N pa
r
 Aa ab C/C++ a d F
rra p a

 Ca b ry ay a d  p 
u  pr
 d 
r
" cr a para "
  |  
 A 
 a  ha u h r
w 
ca 
ry dur g
c
pua
. Mu p a  ca r d
h a
phy ca ach  a w acr
 a arb rary ubr

 ach .
 a  cha g daa hr
ugh c
u ca
 by
 d g a d rc  g ag.
aa ra r uuay ru r c

pra 
pra


b pr
rd by ach pr
c. F
r ap, a  d

pra
u ha a ach g rc 
pra
.
  |  
 |  
 M

 h para w
r 
cu
pr
r g

pra

a daa . h daa   yp cay

rga d 
a c

rucur, uch a a array

r cub.
 A 
 a  w
r c
c y
h a daa
rucur, h
wr, ach a w
r 
a d r 
par 

 h a daa rucur.
 a  pr
r h a
pra

h r par 


w
r , 
r ap, "add  
ry array  ".
 |  
6 
Î. K g Pr
gra Mu p aa (KPM )

2.Mu p Pr
gra Mu p aa (MPM )
 

W h h hp
 para pr
c g, h ghy c
p cad
c    c pr
b ha ar
hrw  ry d  cu


 ca b 
d c y. Para c
pu g
ca b c y ud 
r a  ha 
 a arg
ubr
 cacua
, ha   c
ra  a d ca b
d  dd 
a ubr
 ar a .