1

I have a question regarding on how to design the following system:

My system is built of several clients listening to an environment. When a audio threshold is breached they send their information to a server, that has children listening on each connection. The server needs information from all the clients to make the necessary calculations.

Currently the server is working in UNIX and has forked out connections. They are working independently.

What I want to do is to tell the parent (in the server) that information has been sent and it's now time to process it. How should I do it?

I'm thinking of possible different ways to do it:

  1. Using signal()in Unix to somehow tell the parent that something has happened
  2. Convert to Threads and use some wait and notify functions

The signaling is preferable but I cannot figure out how to do it efficiently. Because the following can happen in my system:

  • If all the clients successfully sent information to their children of the server, how can I tell the parent that I'm ready in a efficient way? Don't know/I'm uncertain of how it will process them.
  • The server may not receive information from all clients. So the parent must wait for awhile for all the children but not too long. So I'm guessing some sort of timer?
7
  • 3
    Are you sure you want to do this with tasks? It seems more like you want to use threads instead. Unfortunately your question is not that clear. Commented Jan 14, 2013 at 9:28
  • I'll add more information but the question is clearly stated Commented Jan 14, 2013 at 9:33
  • Please specify the operating system, solutions might differ depending on that. Commented Jan 14, 2013 at 9:47
  • @KillianDS I can see why this is a bit vague and I really hesitated to post this here cause I knew that some people would find it unrelated cause there is no direct problem. That's why I named it a design question. But read the whole question. The protocol is stated in the title. The communication is also stated in the question. One server, many clients. Server has children that handles each connection seperatly. The clients send information to the server. It's as simple as that. I'll add more text to explain some more of the system. Commented Jan 14, 2013 at 9:49
  • @vladmihaisima The operating system is described in the question already Commented Jan 14, 2013 at 9:51

2 Answers 2

3

Doen't use fork, and don't use signals. Use a thread pool.

Sign up to request clarification or add additional context in comments.

1 Comment

Ah well, seems like I have to implement that. Thanks for convincing me
2

What about a Unix Domain Socket for an inter-processes communication between children and father?

http://en.wikipedia.org/wiki/Unix_domain_socket

As soon as a child receives data through the TCP connection, the same data will be forwarded to the father process through the Unix Domain Socket and the latter process will be instantly notified

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.