ChorusOS 4.0 Introduction

Inter-thread communication

The ChorusOS operating system provides the following services to support multithreaded programming:

SEM

The SEM feature provides semaphore synchronization objects. A semaphore is an integer counter and an associated thread wait queue. When initialized, the semaphore counter receives a user-defined positive or null value.

Two main atomic operations are available on semaphores: P (or pass) and V (or free).

Semaphores are data structures allocated in the actors' address spaces. No kernel data structure is allocated for these objects. They are simply designated by the address of the structures. The number of these types of objects that threads may use is therefore unlimited.

For more details, see SEM(5FEA).

EVENT

The EVENT feature provides the management of event flag sets.

An event flag set is a set of bits in memory that is associated with a thread wait queue. Each bit is associated with one event. Event flag sets are data structures allocated in the actors' address spaces. No kernel data structure is allocated for these objects. They are simply designated by the address of the structures. The number of these types of objects that threads may use is therefore unlimited.

When a flag is set, it is said to be posted, and the associated event is considered to have occurred. Otherwise the associated event has not yet occurred. Both threads and interrupt handlers can use event flag sets for signaling purposes.

A thread can wait on a conjunctive (and) or disjunctive (or) subset of the events in one event flags set. Several threads may be pending on the same event. In that case, each of the threads will be made eligible to run when the event occurs.

For more details, see EVENT(5FEA).

RTMUTEX

The RTMUTEX feature provides mutual exclusion locks, using a priority inheritance protocol, in order to avoid thread priority inversion problems.

For more details, see RTMUTEX(5FEA).