Mutex Objects

A mutex is a sychronization primitive that can be used to ensure that access to a shared resource is limited to one thread at a time. OKL4 2.1 introduced kernel-based mutex objects that may be used by user-level threads.

Motivation

Kernel-based mutex objects were introduced to overcome limitations of the existing user-level-based mutex library. The kernel implementation of mutex objects prevents threads blocked on mutexes from being scheduled by the kernel, reducing CPU overhead in systems with high mutex contention. In addition, a deadlock-avoidance scheme known as priority inheritance is supported by kernel-based mutex operations.

Usage

In order to use a mutex object, it must first be created by a privileged user thread using the MutexControl system control. This control requires the calling thread to specify a currently unused MutexId which is used to name the newly created mutex. Once the mutex is created, threads in the system may attempt to lock and unlock the mutex by calling the Mutex system call with the MutexId. Both blocking and non-blocking mutex operations are provided.

Further Reading

The Mutex and MutexControl system calls are further described in Sections A-11.8 Mutex and A-11.9 MutexControl of the OKL4 Kernel Programming Manual.

Mutex (last edited 2008-08-11 02:34:30 by localhost)