标题:线程问题求助!
取消只看楼主
yynn
Rank: 1
等 级:新手上路
帖 子:279
专家分:0
注 册:2005-11-4
 问题点数:0 回复次数:1 
线程问题求助!

The Smokers Problem

Three smokers are sitting around a table.Only one person can smoke at a time . To smoke a smoker needs three ingredients : tobacco ,paper and a match. Each smoker has an infinite supply of just one of these ingredients and must wait for the other two to be made available by a smoke’s agent.The smoker’s agent has an infinite supply of all three ingredients. The agent places two ingredients on the table and waits for a smoker to make a cigarette and smoke it .When the smoker is finished smoking it notifies the agent that another round of ingredients should be placed on the table to allow smoking to continue.

In this way smokers can continue smoking in some order forever!

Your task is to write a program that simulate the behaviour of the smokers and the smoker’s agent.

Hint: Think of the smokers and the agent as threads that share a table .
谁能帮我理一下,搞的很厉害!谢谢

搜索更多相关主题的帖子: 线程 
2007-11-03 01:50
yynn
Rank: 1
等 级:新手上路
帖 子:279
专家分:0
注 册:2005-11-4
得分:0 
一点也看不懂啊,有没有人提示我一下!

2007-11-04 00:18



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-183057-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015049 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved