Message Passing and Locks
Message passing can be used as a way of controlling access to resources in a concurrent or asynchronous system. One of the main alternatives is mutual exclusion or locking. Examples of resources include shared memory, a disk file or region thereof, a database table or set of rows.
In locking, a resource is essentially shared, and processes wishing to access it (or a sector of it) must first obtain a lock. Once the lock is acquired, other processes are blocked out, ensuring that corruption from simultaneous writes does not occur. After the process with the lock is finished with the resource, the lock is then released.
With the message-passing solution, it is assumed that the resource is not exposed, and all changes to it are made by an associated process, so that the resource is encapsulated. Processes wishing to access the resource send a request message to the handler. If the resource (or subsection) is available, the handler makes the requested change as an atomic event, that is conflicting requests are not acted on until the first request has been completed. If the resource is not available, the request is generally queued. The sending programme may or may not wait until the request has been completed.
Read more about this topic: Message Passing
Famous quotes containing the words message, passing and/or locks:
“The whole idea of image is so confused. On the one hand, Madison Avenue is worried about the image of the players in a tennis tour. On the other hand, sports events are often sponsored by the makers of junk food, beer, and cigarettes. Whats the message when an athlete who works at keeping her body fit is sponsored by a sugar-filled snack that does more harm than good?”
—Martina Navratilova (b. 1956)
“The little toy dog is covered with dust,
But sturdy and stanch he stands;
And the little toy soldier is red with rust,
And the musket moulds in his hands.
Time was when the little toy dog was new,
And the soldier was passing fair;
And that was the time when our Little Boy Blue
Kissed them and put them there.”
—Eugene Field (18501895)
“So Lycidas sunk low, but mounted high
Through the dear might of him that walkd the waves,
Where other groves and other streams along
With nectar pure his oozy locks he laves
And hears the unexpressive nuptial song
In the blessd kingdoms meek of joy and love.
There entertain him all the saints above
In solemn troops and sweet societies,
That sing, and singing in their glory move,
And wipe the tears for ever from his eyes.”
—John Milton (16081674)