Thread: Solaris IPC

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    20

    Solaris IPC

    I'm new to this system programming bit. I have no idea how to do this stuff, so keep this in mind. I have never forked/execed a process, used semaphores for synchronization, or used shared memory for synchronication, with my code. Ever.

    I have an input file in the following format:
    Code:
    Message 1
    Message 2
    Message 3
    Message 4
    There are up to 5 lines in the file. Reading input from the file is not a problem. Based on the number of lines in the file, I am to get, from the user, a permutation of numbers. This is also not a problem: if the user enters 2 1 3 4, I am all set. The problem is, I have to fork (in this example) 4 processes and synchronize them using semaphores. So, if the user enters 2 1 3 4, here's what I have to output:
    Code:
    Message 2: Forked child number 2, PID 39127
    Message 1: Forked child number 1, PID 39657
    Message 3: Forked child number 3, PID 39534
    Message 4: Forked child number 4, PID 39178
    It outputs the messages from the file, followed by the child's number, followed by the child's PID. Seems simple, right? All's I need to do is read the file into a local variable (already done), fork x children (where x = number of lines in the file), execute them according to the order the user requests, terminate the processes, and be finished.

    Please help me out here, I've never done this stuff before

    Thanks in advance
    --- EDK
    liberate tutamet ex inferis

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    20
    Oh come on, I'm sure someone knows what's going on. You have answers to every other question except mine.

    All I need to do is fork 4 processes, have each one wait for a semaphore, and have them execute in a specific order based on which semaphore was signalled.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > You have answers to every other question except mine.
    Happy now?

    http://www.cm.cf.ac.uk/Dave/C/
    Has info / examples of fork and IPC

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simulating wireless netowork using IPC
    By tenkasian in forum C Programming
    Replies: 3
    Last Post: 03-23-2009, 04:16 PM
  2. Solaris SMF problem?
    By cpjust in forum Tech Board
    Replies: 0
    Last Post: 02-24-2009, 01:46 PM
  3. Segmentation fault - IPC
    By kbfirebreather in forum C Programming
    Replies: 7
    Last Post: 02-01-2009, 03:17 PM
  4. mkdir - solaris 10
    By StevieT in forum C Programming
    Replies: 4
    Last Post: 08-17-2006, 03:36 AM
  5. Fatal error with solaris socket
    By WaterNut in forum Linux Programming
    Replies: 10
    Last Post: 05-26-2005, 01:12 PM