{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

dyn_multi_alg

# dyn_multi_alg - Introduction to Algorithms Massachusetts...

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

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

View Full Document
Handout 29: Dynamic Multithreaded Algorithms 3 F IB ( n ) 1 if n < 2 2 then return n 3 x spawn F IB ( n 1) 4 y spawn F IB ( n 2) 5 sync 6 return ( x + y ) A spawn is the parallel analog of an ordinary subroutine call. The keyword spawn before the subroutine call in line 3 indicates that the subprocedure F IB ( n 1) can execute in parallel with the procedure F IB ( n ) itself. Unlike an ordinary function call, however, where the parent is not resumed until after its child returns, in the case of a spawn, the parent can continue to execute in parallel with the child. In this case, the parent goes on to spawn F IB ( n 2) . In general, the parent can continue to spawn off children, producing a high degree of parallelism.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern