正在加载图片...
5.3.2 Two Uses of Semaphores(2/18 Mutual Exclusion with a binary semaphore program mutualexclusion * const int n =/ number of processes */i semaphore s=1i Semaphore has an initial void P(int 1) value of 1 while (true) semWait(s)i PO is called before a / critical section semsignal(s)i critical section / remainder vO is called after the void main o critical section parbegin (P(1), P(2), Figure 5.6 Mutual Exclusion Using Semaphores5.3.2 Two Uses of Semaphores(2/18) • Mutual Exclusion with a binary semaphore 16 Semaphore has an initial value of 1 P() is called before a critical section V() is called after the critical section
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有