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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ian douglas

    #1

    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
  • Christopher Benson-Manica

    #2
    Re: multi-threaded, multi-process producer/consumer example?

    ian douglas <google@w98.u s> spoke thus:
    [color=blue]
    > 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.[/color]

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

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





    for posting guidelines and frequently asked questions. Thank you.

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cybers pace.org | don't, I need to know. Flames welcome.

    Comment

    • Randy Howard

      #3
      Re: multi-threaded, multi-process producer/consumer example?

      In article <cebiet$epq$1@c hessie.cirr.com >, ataru@nospam.cy berspace.org says...[color=blue]
      > ian douglas <google@w98.u s> spoke thus:
      >[color=green]
      > > 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.[/color]
      >
      > (Stop right there and head over to comp.threads.)[/color]

      comp.programmin g.threads

      --
      Randy Howard
      To reply, remove FOOBAR.

      Comment

      Working...