I keep asking myself whether to use fork or thread in a project I'm working on. I need to share some memory between the instances too.
The situation is: I'm gonna send some messages from client to server, and on the server the messages are gonna be placed in a queue. When a message is received on the server a fork/thread is going to handle the message and put it into the queue. This queue has to be shared among the different forks/threads and only one fork/thread can write to the queue at the same time so no data is lost.
I have thought about fork with shared memory and thread which uses the same memory but then with locks, but I really can't find out what to use? Can anyone help me out on which is the most simple and best solution?