multi-threaded, multi-process producer/consumer example?

I

ian douglas

I have one process that will be multi-threaded. The parent (A) will
sit and deal with TCP/IP issues, and feed data to its child process
(B) via shared memory. I need assistance in finding a good example of
(B) pausing (not in a busy-wait loop) until it gets a signal from (A)
that data is ready.

That the child process (B) will then have a shared memory segment with
a second running process (C), where (B) will be the producer for (C),
so (B) must also be able to get a signal from (C) to pass it more data
once (C) is ready to accept more data.

(C) then is a consumer for (B), and a producer for a thread (E) of
another separate process (D). (C) should also sit in a loop (not
hogging up cpu cycles), to get signals either from (B) or (E) to do
its work.

(D) that will deal with another TCP/IP connection, and will consume
data from its child (E). This child (E) will be a consumer for (C) and
a producer for (D).

Specifically what I need to find is a clear, documented example of how
a process can sit quietly, without hogging up CPU cycles, and wait for
a signal before acting on that signal. Having an example for dealing
with a signal from a parent or child thread, and having another
example for dealing with a signal from an external process (passed by
the OS?), is what I'm looking for.

Test platform is Fedora Core 2, 2.6.6 kernel. Production platform will
likely be RedHat 8.0 running some variant of the 2.4 kernel.

Thanks for any tips or samples.

-id
 
C

Christopher Benson-Manica

ian douglas said:
I have one process that will be multi-threaded. The parent (A) will
sit and deal with TCP/IP issues, and feed data to its child process
(B) via shared memory. I need assistance in finding a good example of
(B) pausing (not in a busy-wait loop) until it gets a signal from (A)
that data is ready.

(Stop right there and head over to comp.threads.)

Your post is off-topic for comp.lang.c. Please visit

http://www.ungerhu.com/jxh/clc.welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html

for posting guidelines and frequently asked questions. Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top