Question

My university professor has asked me to develop a project in C for Unix machines. I should do a soccer championship emulator, in which there is a parent, and there are some child(every match between two teams). The parent must create the matches, and the matches must tell the end result to the parent.

I think the best thing to do is to use fork() syscall and unnamed pipes.

What do you think about?

Thanks

Était-ce utile?

La solution

Your suggestion above is valid. That approach would work. It might be easier to use a chunk of shared memory and mutex instead, but it's ultimately your call. I've included a working example that uses pthread_mutex calls and mmap in the references below that should get you up and running. Good luck!

References


  1. C procs, fork(), and mutexes, Accessed 2014-04-29, <https://stackoverflow.com/questions/19172541/procs-fork-and-mutexes>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top