Although simple synchronization problems can be solved by using lock algorithms, their implementations have quite a number of disadvantages. The oldest idea to eliminate some of these disadvantages is the synchronization construct of semaphores by Dijkstra. In this chapter, his ideas are presented, and many applications are used to demonstrate how semaphores can be used. This chapter specifies binary and—in the context of bounded buffers—general semaphores and discusses the interrelations between them, and after, Dijkstra’s sleeping barber is awakened, and the pitfalls of constructing general semaphores from binary ones are pointed out. The readers-writers problem and some of its solutions with semaphores lead to the pattern of the baton algorithm. It also deals with some specific issues: additive semaphores, barrier synchronization, the left-right problem, Dijkstra’s dining philosophers, the problem of the cigarette smokers, hints on the implementation of semaphores, and the convoy phenomenon.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Semaphores

  • Christian Maurer

摘要

Although simple synchronization problems can be solved by using lock algorithms, their implementations have quite a number of disadvantages. The oldest idea to eliminate some of these disadvantages is the synchronization construct of semaphores by Dijkstra. In this chapter, his ideas are presented, and many applications are used to demonstrate how semaphores can be used. This chapter specifies binary and—in the context of bounded buffers—general semaphores and discusses the interrelations between them, and after, Dijkstra’s sleeping barber is awakened, and the pitfalls of constructing general semaphores from binary ones are pointed out. The readers-writers problem and some of its solutions with semaphores lead to the pattern of the baton algorithm. It also deals with some specific issues: additive semaphores, barrier synchronization, the left-right problem, Dijkstra’s dining philosophers, the problem of the cigarette smokers, hints on the implementation of semaphores, and the convoy phenomenon.