问题描述:
理发店里有一位理发师,一把理发椅,N把供等候理发顾客坐的椅子。
如果没有顾客,理发师睡眠,当顾客到来时叫醒理发师。
若理发师正在理发时又有顾客来,那么有空椅子就坐下,否则离开。
代码实现一个理发师,n个顾客的情况。




输出
这个输出有点不正经啊,多线程并行难道就是这种神经错乱的效果?尬笑.jpg
问题描述:
理发店里有一位理发师,一把理发椅,N把供等候理发顾客坐的椅子。
如果没有顾客,理发师睡眠,当顾客到来时叫醒理发师。
若理发师正在理发时又有顾客来,那么有空椅子就坐下,否则离开。
代码实现一个理发师,n个顾客的情况。
输出
这个输出有点不正经啊,多线程并行难道就是这种神经错乱的效果?尬笑.jpg
本文标题:PV操作解决理发师问题
本文链接:https://www.haomeiwen.com/subject/fimjwqtx.html
网友评论