views:

114

answers:

1

Hi, this is for an assignment so I'm not looking for code.

I have to simulate a game where each player has turns and needs to 'pay attention' to what's going on.

So far, i know I'll need two threads for each player, one that will sleep until the player's turn and the other paying attention.

My question is: Should I work each player as a 'fork' and the threads on the fork, or just create some threads for the player and associate them somehow?

It's the first time I've worked with concurrency, semaphores and threads so I'm not sure about the good practices and programming style.

Thanks!

+3  A: 
Norman Ramsey
The use of fork is not required, and since the general suggestion is to avoid the communication between Unix processes I'll go for the threads. I'll try to finish the assignment as soon as possible and have time to look at the process way (just to know how unpleasant they can be). Thank you for the answer and the book suggestion.
sergiobuj