Thread: Shared memory segments

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    1

    Shared memory segments

    I have created a shared memory segment (which size is 64 bytes) using shmget, shmat e.t.c and i want to divide it into 2 areas. One area for input data and one area for output? How can i do that?

    Furthermore, When i have to write my input data into the shared memory segment i want to write something like this:

    a text messase, an integer, another integer

    Which function of c should i use? If i had to write only a text message and read it from another process i would use memcpy, but now i have the text messase and two integers (which i use as flags in my code).

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So how do you think you should do it? No, I'm not asking to be silly - your thoughts are very much important here, for three reasons:
    1. We may well suggest something that you have already thought of.
    2. You (hopefully) unerstand more about the ACTUAL problem you are trying to solve.
    3. You will learn a whole lot more by solving the problem yourself.

    I can think of several solutions that MAY work, but it depends.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-06-2009, 12:27 PM
  2. Partly shared memory
    By DrSnuggles in forum C++ Programming
    Replies: 13
    Last Post: 01-21-2009, 03:35 AM
  3. Shared Memory semaphores?
    By Ironic in forum C Programming
    Replies: 0
    Last Post: 10-31-2008, 07:13 PM
  4. Shared memory woes
    By joshdick in forum C Programming
    Replies: 4
    Last Post: 07-28-2005, 08:59 AM
  5. Shared memory in Linux: B-TREE of structures
    By zahid in forum Linux Programming
    Replies: 3
    Last Post: 01-26-2002, 11:15 PM