[Return to Top] [Standard Processes]

EROS Object Reference

Standard Processes

Mutex

D R A F T

Description

The Mutex object provides a mechanism for coordination over shared resources by providing a mechanism for mutual exclusion. An actor (a process) that wishes to posess exclusive access to a resource first invokes the mutex object. On return, the actor "owns" the mutex object, and holds a "relinquish" key to the mutex. When the actor has completed it's operations, it calls the relinquish key to allow other actors to proceed.

It should be emphasized that the exclusion applies only to those processes that make use of the mutex object voluntarily. The mutex object provides no mechanism for mutual exclusion among non-cooperating users.

A mutex object has two keys: the mutex request key, which is long lived, and the mutex release key, which lasts for the duration of a single exclusion.


Operations

Check Alleged Key Type (OC = KT)

Returns the alleged type of the key. Note that checking the alleged key type of a mutex relinquish key has the side effect of releasing the mutex.
ResultR10x020000: Key is a mutex request key.

0x020001: Key is a mutex relinquish key.

Request Mutex (OC = 1)

Requests ownership of a mutex object. This operation may be performed on either a mutex request key or a mutex relinquish key, though it isn't terribly clever to ask for a mutex you already hold.

Returns a mutex relinquish key.
ReplyRK3The mutex relinquish key.
Result0Mutex ownership granted.

Release Mutex (OC = 2)

Releases ownership of a mutex object, allowing the mutex to be granted to another requester.
Result0Mutex released.
KT+3Key is not a mutex release key.


Copyright 1998 by Jonathan Shapiro. All rights reserved. For terms of redistribution, see the GNU General Public License