473,471 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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
Nov 14 '05 #1
2 3943
ian douglas <go****@w98.us> spoke thus:
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.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 14 '05 #2
In article <ce**********@chessie.cirr.com>, at***@nospam.cyberspace.org says...
ian douglas <go****@w98.us> spoke thus:
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.)


comp.programming.threads

--
Randy Howard
To reply, remove FOOBAR.
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dh | last post by:
Runtime.getRuntime().exec() ... mad buffering of stdout ... It buffers stdout without limit ... so if your Java program doesn't keep up with the Process output then memory fills up! I wish it...
3
by: MrNobody | last post by:
I am developing an application that has several multi threaded tasks where one thread is doing IO and another thread is grabbing data from the first thread to process it further. I've been...
0
by: Kyle Rowe | last post by:
class Buffer { const int size = 4; int n = 0; public void Put(char ch) { lock(this) { while (n == size) Monitor.Wait(this);
2
by: Rene Ruppert | last post by:
Hi, I'm trying to implement the Producer-Consumer-Problem in C#. Below is my code. The problem is, that the buffer always contains only one element...it seems that the Thread.Sleep() in the...
4
by: cpptutor2000 | last post by:
Could someone please help me? I am looking for a C language implementation of the producer consumer model. Any help would be greatly appreciated. Thanks in advance for your help.
4
by: mps | last post by:
It seems to me that the MSDN code for synchronizing a producer and consumer thread at http://msdn2.microsoft.com/en-us/library/yy12yx1f.aspx is completely wrong. There is no reason to assume that...
1
by: Eihab | last post by:
how to write a message based producer consumer program for linux with four processes . the reader process will read an input file , one line at a time . reader will take the each line of the input...
10
by: George Sakkis | last post by:
I'd like some feedback on a solution to a variant of the producer- consumer problem. My first few attempts turned out to deadlock occasionally; this one seems to be deadlock-free so far but I can't...
1
by: akevan | last post by:
Hi all, I'm writing a cross-platform audio processing app that should run on various hardware platforms. Some of these have OSs that provide software threads, some have hardware threads, but some are...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.