Flash Games

 FAQ   Search   Members   Groups   User Control Panel      Login 

It is currently Fri Dec 05, 2008 2:34 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Multi threading -- please read, please help
PostPosted: Sat Apr 12, 2008 6:20 pm 
Offline

Joined: Sat Dec 29, 2007 9:06 pm
Posts: 20
I am writing a program for my operating systems class, and I need help. I have a general idea of what to do, but I am getting all kinds of errors, which makes me think I should just start over.

The purpose of this exercise is to simulate a candy factory. Three ingredients are needed to make a candy bar: chocolate, nuts and a wrapper. Assuming that there are three candy bar making machines (clients), the first client has an unlimited supply of chocolate, the second client has an unlimited supply of nuts, and the third client has an unlimited supply of wrappers. Each client takes a random amount of time to make a candy bar as soon as it has all three ingredients.

Theres a fourth machine (agent), with an unlimited supply of all three ingredients. The agent places two ingredients on the table at the same time. From the table these two ingredients are immediately available for the agents to use to make a candy bar. The agent decides at random which two of the ingredients it will put on the table. As soon as a client can use the ingredients placed on the table, it takes them (both at the same time). At that point the agent is immediately free (without waiting for the client to finish making a candy bar) to put down two new ingredients.

So I have to write a java program that uses threads to simulate the activities of the agent and the clients. And as much as possible, the agent's activities have to be independent from the clients, and the clients' activities should be independent from each other.

Is anyone a threading guru/wants to help me?

_________________
Joie


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games

Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User:
Pass:
Log me on automatically each visit: