1 / 11

PRAM

PRAM. EREW CREW ERCW CRCW. SYNCHRONIZACJA I STEROWANIE procesy są ściśle zsynchronizowane testowanie warunków zakończenia pętli - za pomocą sieci sterującej lub jednoczesnego zapisu do pamięci.

konane
Download Presentation

PRAM

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. PRAM

  2. EREW • CREW • ERCW • CRCW

  3. SYNCHRONIZACJA I STEROWANIE procesy są ściśle zsynchronizowane testowanie warunków zakończenia pętli - za pomocą sieci sterującej lub jednoczesnego zapisu do pamięci

  4. USTALANIE PORZĄDKU ELEMENTÓW NA LIŚCIE Metoda przeskakiwania (podwajania) : DANE : n elementowa lista rekordów (pola : klucz, d, next) WYNIK : d[i] = odległość elementu o kluczu=i od końca listy L 0 jeśli next[i] = NIL d[i] : = d[next[i]]+ 1 jeśli next[i] <>NIL

  5. Procedure LIST-RANK (L); { dla EREW } begin for każdy proces i in parallel do ifnext[i] = NIL thend[i] := 0 elsed[i] := 1; while istnieje element i w L taki, że next[i] <> NIL do for każdy proces iin parallel do if next[i] <> NIL then begin d[i] := d[i] + d[next[i]]; next[i] := next[next[i]]; end; end; T(n) = O(lg n)

  6. OBLICZENIA PREFIKSOWE NA LIŚCIE DANE: n, X = (x1, x2, ... xn ), n  1,  - binarny, łączny operator WYNIK: Y = (y1, y2, ... , yn ) x1 jeśli k = 1 yk = yk-1 xk jeśli k > 1 OZNACZENIA : [i,j] = xixi+1 ... xj

  7. Procedure LIST-PREFIX (L); { dla EREW } {(x1, x2, ... xn )umieszczone w liście L (xi, yi, next) } begin for każdy proces i in parallel do y[i] : = x[i]; while istnieje element i w L taki, że next[i] <> NIL do for każdy proces i in parallel do if next[i] <> NIL then begin y[next[i]] := y[i]  y[next[i]] next[i] := next[next[i]]; end; end; T(n) = O(lg n)

  8. PROBLEM MAKSIMUM DANE: n > 0 , x1, ... , xn, xi R; WYNIK : max = maximum {x1, ... , xn, xi  R}

  9. FAST-MAX (X); { dla CRCW z jednolitym zapisem } { wykorzystuje n2 procesów } begin for i : =0 to n-1 in parallel do m[i] := TRUE; for i := 0 to n-1, for j := 0 to n-1 in parallel do{proces dla pary (i,j) !} if X[i] < X[j] then m[i] = FALSE; { wiele procesów może pisać ale wszystkie zapisują tę samą wartość - FALSE } for i := 0 to n-1 in parallel do if m[i] = TRUE then max := X[i] { wiele procesów może pisać ale wszystkie zapisują tę samą wartość – max } return max end; T(n) = O(1)

  10. X[j} X[i]

  11. FIND-ROOTS(F) begin for każdy procesor i in paralleldo if parent[i] = NIL then root[i] := i; while istnieje węzeł i taki, że parent[i] <> NIL do for każdy procesor i in parallel do if parent[i] <>NIL then begin root[i] := root[parent[i]]; parent[i] := parent[parent[i]]; end; end;

More Related