WP1 - RTOS State of the Art Analysis: Deliverable D1.1 - RTOS Analysis | ||
---|---|---|
Prev | Chapter 10. RTEMS 4.5+ | Next |
RTEMS implements all standard POSIX 1003.1b IPC mechanisms for concurrent threads synchronization and communication.
POSIX binary, counting, with/without timeout, named/unnamed
Creation and destruction of unnamed semaphores: sem_init() and sem_destroy()
Opening/creation and closing of named semaphores: sem_open() and sem_close(). An unused named semaphore can be deleted by sem_unlink().
Function sem_wait() attempts to lock a semaphore, If the semaphore is unavailable (value is zero) blocks until the semaphore becomes available. There is nonblocking version sem_trywait() and version with timeout sem_timedwait().
Function sem_post() unlocks the semaphore and function sem_getvalue() enables to retrieve actual value of the semaphore.
Similar set of basic POSIX API functions exists as for semaphores. There are classic API functions as well.
Basic functions: pthread_mutex_init(), pthread_mutex_destroy(), pthread_mutex_lock(), pthread_mutex_trylock(), pthread_mutex_timedlock() and pthread_mutex_unlock().
Next functions are used to manipulate with mutex attributes: pthread_mutexattr_init(), pthread_mutexattr_destroy(), pthread_mutexattr_setprotocol(), pthread_mutexattr_getprotocol(), pthread_mutexattr_setprioceiling(), pthread_mutexattr_getprioceiling(), pthread_mutexattr_setpshared() and pthread_mutexattr_getpshared().
The following ordering protocols for waiting threads can be specified:
PTHREAD_PRIO_NONE: blocking order FIFO.
PTHREAD_PRIO_INHERIT: blocking order priority with the priority inheritance protocol in effect.
PTHREAD_PRIO_PROTECT: blocking order priority with the priority ceiling protocol in effect.
Possible to activate priority inheritance or priority ceiling protocol.
RTEMS implements POSIX conditional variables in Condition Variable Manager.
The following functions are responsible of conditional variables creation, destruction and manipulation: pthread_cond_init(), pthread_cond_destroy(), pthread_cond_signal(), pthread_cond_broadcast(), pthread_cond_wait() and pthread_cond_timedwait().
The shared attribute can be defined and read by corresponding attribute functions.
FIFO or task priority wakeup order, LIFO urgent messages support, with timeout, fixed depth and max message size.
Message Passing Manager implements next POSIX functions: mq_open(), mq_close(), mq_unlink(), mq_send(), mq_receive(), mq_notify(), mq_setattr() and mq_getattr().
In development.
Implemented only for ITRON API.
No special directives.
Standard and POSIX signals with timeout. Signals are numbered from 1 to 32.
There are standard functions for sending of signal to process (whole application) kill() and sigqueue() with value and queuing capability. The thread specific version exists as well pthread_kill(). Signals can be masked on process sigprocmask() or thread basis pthread_sigmask().
There are defined standard functions for signal mask manipulation sigaddset(), sigdelset(), sigfillset(), sigismember() and sigemptyset(). Required reaction on unmasked pending signal or received signal is defined by function sigaction().
More functions for waiting, examination of pending signals and combined mask manipulation and waiting are defined pause(), sigpending(), sigsuspend(), sigwait(), sigwaitinfo() and sigtimedwait().
Alarm signal after specified number of seconds can be scheduled by alarm() function.
Native RTEMS API for 32 events.
An event flag is used by a task/thread (or ISR) to inform another task of the occurrence of a significant situation. Thirty-two event flags are associated with each task. A collection of one or more event flags is referred to as an event set. The data type rtems_event_set is used to manage event sets.