一道关于操作系统的题目,是临界区问题还是信号量问题?请写出代码?

问题描述:

一道关于操作系统的题目,是临界区问题还是信号量问题?请写出代码?
There is only one single-log bridge(独木桥) over the river connecting the west and the east.If there is some one on the bridge,people from other direction must wait until there is no person on the bridge.While if several people go the same direction,they can pass through at the same time.Write a code sketch for two kinds of people,people from west to east and people from east to west,which follows the given rules and guarantees that two kinds of people are never on the bridge at the same time using semaphores.

信号量问题啊