next up previous contents
Next: The distributed virtual machine Up: Parallelization paradigms Previous: Distributed memory (MPI/PVM)   Contents

Shared memory (threads)

A threaded program will often resemble something like:
Node$_0$   Node$_1$
synchronization
computation   computation
synchronization
computation   computation
     
The ``synchronization'' can be both a real synchronization but it can also just be seen as one of the threads holding a mutual exclusion semaphore that effectively blocks all other threads that try to grab the same semaphore. Mutual exclusion semaphores are sometimes needed when accessing data in shared memory, to guarantee that no other threads use or modify the data one thread is in the process of changing.

Again, no code is distributed, since the entire program is running on one machine.

Parallelizing with threads is fairly error-prone, since there is no protection of data access except for the protection the programmer puts in herself. Contrary to the MPI / PVM case, where it is easy to forget to update all data, a threaded program is more likely to accidentally update data that is being used by another thread, without that thread knowing about it.


next up previous contents
Next: The distributed virtual machine Up: Parallelization paradigms Previous: Distributed memory (MPI/PVM)   Contents

1999-08-09