a question regarding ipc

This is a discussion on a question regarding ipc within the Linux Programming forums, part of the Platform Specific Boards category; i have a link list of sturctures and these structures are created in one program and then these are passed ...

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    14

    a question regarding ipc

    i have a link list of sturctures and these structures are created in one program and then these are passed to the other programs on linux.
    Commonly it is said that pipes are the most efficient ipc I can pass the structure list to the other program but is it really efficient
    should not the shared memory more fficient in my case
    bcuz i think might be able to read and write the whole link list at once what do u people say
    /*****
    One can't let go and still win
    ******/

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    If you put them in shared memory, there's only one copy of them. If you have to pass them through a pipe, each program is going to get it's own copy, thus efficiency (in terms of access speed) is lost.

    Your design is going to depend on your programs requirements/objectives.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    14

    my actual program

    actually iam programming a flow based analyzer .The program should work at high speed. So One program matches the packets and updates the structures' linklist on the basis of packets. Then this details is to be passed to another program which is going to apply some algos to these statistics. So what do u say Pipes(Fifos) or Shared Memory.
    /*****
    One can't let go and still win
    ******/

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,338
    Well if you're really that concerned about performance, then make them all part of the same program.
    Then it's just a function call parameter.

    Even if you use shared memory, there are going to be plenty of rather expensive context switches alternating between one process and another.
    Not to mention all the semaphore / mutex overhead to make sure that one process doesn't trash the shared memory just as the other is looking at it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Jun 2003
    Posts
    14

    actually

    actually both can't be the part of the same program bcuz they have to be seprate. It is in the design that statistics collector is a different program and the analyzer is different.
    Now what do u recommend
    pipes fifos shared memory or some thing else
    /*****
    One can't let go and still win
    ******/

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,338
    Since you've already committed yourself to the millstone around your neck, the rest doesn't really matter.

    Saying which is best relies on knowing details of your environment, and details of your competence at implementing the correct solution correctly (in short, it's not going to happen).

    Try several approaches and learn something!

    > It is in the design that statistics collector is a different program and the analyzer is different.
    Designed by who? your tutor?
    In a production environment, this would be challenged, or at least have to be justified with some pretty good arguments.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Registered User
    Join Date
    Jun 2003
    Posts
    14

    actual question

    let's forget every thing and come to generality

    if i say that the speed is what i require and i have to use ipc then what do u recommend
    fifo or shared memory

    i m going to try myself also the performance difference and do let u know i got confused bcuz the sams linux programming book says that shared memory is the fastest and another document on the internet says that fifo is the fastest

    What do u think shared memory or fifo?
    /*****
    One can't let go and still win
    ******/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  2. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  3. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  4. Question about linked lists.
    By cheeisme123 in forum C++ Programming
    Replies: 6
    Last Post: 02-25-2003, 12:36 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 12:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21