Thread: Qusetion related to shared memory

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    85

    Qusetion related to shared memory

    Good morning,

    I want to allocate memory by using shmget,I want this memory to consist of 4 integers and three semaphores(type sem_t) which are going to have access to the same buffer.

    How can ido that?

    Thanks, in advance!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Create a struct containing those items, then allocate sizeof(struct) amount of shared memory.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Share segment
    By ch4 in forum C Programming
    Replies: 7
    Last Post: 12-30-2008, 02:19 AM
  2. RE: client/server shared memory problem
    By hampycalc in forum C Programming
    Replies: 0
    Last Post: 03-10-2006, 02:26 PM
  3. shared memory can not read value over 255
    By jbsloan in forum C Programming
    Replies: 4
    Last Post: 04-03-2005, 11:56 AM
  4. Managing shared memory lookups
    By clancyPC in forum Linux Programming
    Replies: 0
    Last Post: 10-08-2003, 04:44 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