正在加载图片...
5.3.1 What is semaphore? (5/10) Semaphores have a non-negative integer value, and support two operations PO: an atomic operation that waits for semaphore to become positive, then decrement it by 1 VO: an atomic operation that increments semaphore by 1 and wakes up a waiting thread at Po, if any · Features: Only operations are PO and vo Cannot read or write semaphore values Except at the initialization times Operations are atomic A sleeping thread at po cannot miss a wakeup from Vo5.3.1 What is semaphore?(5/10) • Semaphores have a non-negative integer value, and support two operations • P(): an atomic operation that waits for semaphore to become positive, then decrement it by 1 • V(): an atomic operation that increments semaphore by 1 and wakes up a waiting thread at P(), if any. • Features: • Only operations are P() and V() • Cannot read or write semaphore values • Except at the initialization times • Operations are atomic • A sleeping thread at P() cannot miss a wakeup from V() 8
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有