Deadlock occurs when a task owning a binary semaphore attempts to acquire that same semaphore and blocks as result. Since the semaphore is allocated to a task, it cannot be deleted. Therefore, the task that currently holds the semaphore and is also blocked waiting for that semaphore will never execute again.
RTEMS addresses this problem by allowing the task
holding the binary semaphore to obtain the same binary semaphore
multiple times in a nested manner. Each
rtems.semaphore_obtain
must be accompanied with a
rtems.semaphore_release
. The semaphore will
only be made available for acquisition by other tasks when the
outermost rtems.semaphore_obtain
is matched with
a rtems.semaphore_release
.
Simple binary semaphores do not allow nested access and so can be used for task synchronization.
Copyright © 1988-2008 OAR Corporation