Thread: Thread Prog in C language (seg fault)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Without changing the code, all you can do is ask the system administrator to increase the number of allowed per-process shared memory segments.

    >> would request you to give me some solution for this
    As I mentioned in the 2nd post, this can be fixed by using a single shared memory segment for all shared data. That means you call shmget() and shmat() only once. Then use that one block of shared memory for all your needs.

    gg

  2. #2
    Registered User
    Join Date
    Jun 2008
    Posts
    14

    Thread Prog in C language (seg fault)

    I am not sure, but what I believe is that for each writer I am creating 3 shared memory segments.

    like for each writer I am creating

    Code:
    for(i = 0; i < num_writers; i++) {
         
            read_count[i] ===> shmget() and shmat()
            checksum[i]    ===> shmget() and shmat()
            shmptr[i]        ===> shmget() and shmat()
    }
    This works fine when num_writers is 3 but it fails when num_writers is 4 or more. Anyway will try other way also as you suggested (will create only 1 segment).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. seg fault
    By hka26 in forum C++ Programming
    Replies: 1
    Last Post: 10-08-2007, 01:38 AM
  2. Replies: 5
    Last Post: 11-04-2006, 06:39 PM
  3. seg fault problems
    By nadamson6 in forum C++ Programming
    Replies: 11
    Last Post: 12-27-2005, 03:26 PM
  4. Pointer To Functions = Seg Fault
    By misplaced in forum C++ Programming
    Replies: 3
    Last Post: 04-05-2005, 08:03 AM
  5. Locating A Segmentation Fault
    By Stack Overflow in forum C Programming
    Replies: 12
    Last Post: 12-14-2004, 01:33 PM