- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
6.5 Points to Remember
Some points to remember include the following:
Using semaphores allows multiple tasks, or ISRs to tasks, to synchronize execution to synchronize execution or coordinate mutually exclusive access to a shared resource.
Semaphores have an associated semaphore control block (SCB), a unique ID, a user-assigned value (binary or a count), and a task-waiting list.
Three common types of semaphores are binary, counting, and mutual exclusion (mutex), each of which can be acquired or released.
Binary semaphores are either available (1) or unavailable (0). Counting semaphores are also either available(count =1) or unavailable (0). Mutexes, however, are either unlocked (0) or locked (lock count =1).
Acquiring a binary or counting semaphore results in decrementing its value or count, except when the semaphore s value is already 0. In this case, the requesting task blocks if it chooses to wait for the semaphore.
Releasing a binary or counting semaphore results in incrementing the value or count, unless it is a binary semaphore with a value of 1 or a bounded semaphore at its maximum count. In this case, the release of additional semaphores is typically ignored.
Recursive mutexes can be locked and unlocked multiple times by the task that owns them. Acquiring an unlocked recursive mutex increments its lock count, while releasing it decrements the lock count.
Typical semaphore operations that kernels provide for application development include creating and deleting semaphores, acquiring and releasing semaphores, flushing semaphore s task-waiting list, and providing dynamic access to semaphore information.
7.8 Points to Remember
Some points to remember include the following:
Message queues are buffer-like kernel objects used for data communication and synchronization between two tasks or between an ISR and a task.
Message queues have an associated message queue control block (QCB), a name, a unique ID, memory buffers, a message queue length, a maxi
文档评论(0)