| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 451 人关注过本帖
标题:线程问题求助!
取消只看楼主 加入收藏
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
快速回复:线程问题求助!
数据加载中...
 
   



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

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