RTEMS Logo

RTEMS 4.7.99.2 On-Line Library


Semaphore Manager Nested Resource Access

PREV UP NEXT Bookshelf RTEMS Ada User's Guide

9.2.1: Nested Resource Access

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.


PREV UP NEXT Bookshelf RTEMS Ada User's Guide

Copyright © 1988-2004 OAR Corporation