Previous | Next --- Slide 45 of 48
Back to Lecture Thumbnails
HLAHat

So, does the Message Passing model have any synchronization aspects to it? If the only shared data is the stuff being explicitly passed through the messages, it seems like there's no way for the threads to access anything they're not supposed to. Is that a reasonable perspective?

jazzbass

@HLAHat I believe that the Message Passing model does have synchronization aspects. Take for example the red and black dots example, where we distribute work by blocks. In this case, we must synchronize the worker of row i with the workers of rows i-1 and i+1. Worker i must wait for the message of workers i-1 and i+i for him to compute the new values for his assigned dots, else he might compute the new values for his assigned dots with "old" values, technically accessing data that he's not supposed to (at least not until he receives the new data).

HLAHat

Hmmm. Yeah, I guess it just seems different because of how structured the message passing is. But I suppose the key idea of Message Passing is explicit communication between threads, not necessarily tight controls on accessing data. It's just that messages are used for locks and barriers instead of just calling a lock or a barrier. So, synchronization is still present, just mostly up to the programmer to keep things regulated.