SGI: Need Something like 1 Mutual Exclusion Semaphore for Multible Programs - SGI

This is a discussion on SGI: Need Something like 1 Mutual Exclusion Semaphore for Multible Programs - SGI ; Hello, I have a assignment just thrown onto my desk. What is the easiest way to solve it? Below is a brief description of the task. There are multible programs which use the same library routine which is an interface ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: SGI: Need Something like 1 Mutual Exclusion Semaphore for Multible Programs

  1. SGI: Need Something like 1 Mutual Exclusion Semaphore for Multible Programs

    Hello,

    I have a assignment just thrown onto my desk.

    What is the easiest way to solve it? Below is a brief
    description of the task.

    There are multible programs which use the same library routine
    which is an interface to what I'll call a service program.

    The problem is that only 1 request at a time can be serviced by
    the service program.

    My boss told me to just use somehting such as using shared
    memory (via memmap) and set a flag in there to 1 when a program
    wants service. The various programs are to wait in a loop until
    that flag becomes 0. Once the flag becomes 0 then set it to 1 along
    with setting other parameters to send to the service program.

    But, woun't this lead to programs setting that flag to 1 at the
    same time causing loss of service etc.

    The way I see it is the flag described above is a critical
    section and must be protected by a mutual exclusion semaphore.

    I don't see anything wrong with using shared memory for sending
    other parameters to the service routine.

    O'kay what should I do?

    Thank you,
    Christopher Lusardi

    P.S.: I'm sorry if I'm posting this to the wrong group. :-[


  2. Re: SGI: Need Something like 1 Mutual Exclusion Semaphore for Multible Programs

    I'm going to find on the Internet a program that does the sequence:

    sem_open
    sem_init
    sem_wait
    sem_post
    sem_post

    The only thing I have to find out is how how do I declare the semaphore
    to be in
    shared memory.

    Thanks,
    Chris Lusardi


  3. Re: SGI: Need Something like 1 Mutual Exclusion Semaphore for Multible Programs

    I can't use the following sequence because the programs that use the
    library routine
    reside on different computers.

    sem_open
    sem_init
    sem_wait
    sem_post
    sem_post


    The only thing I have to find out is how how do I declare the semaphore

    to be in
    shared memory.


    Thanks,
    Chris Lusardi


  4. Re: SGI: Need Something like 1 Mutual Exclusion Semaphore for Multible Programs

    I can't use the following sequence because the programs that use the
    library routine
    reside on different computers.

    sem_open
    sem_init
    sem_wait
    sem_post
    sem_post


    The only thing I have to find out is how how do I declare the semaphore

    to be in
    shared memory.


    Thanks,
    Chris Lusardi


  5. Re: SGI: Need Something like 1 Mutual Exclusion Semaphore for Multible Programs

    I can't use the following sequence because the programs that use the
    library routine reside on different computers.

    sem_open
    sem_init
    sem_wait
    sem_post
    sem_post

    Thanks,
    Chris Lusardi


  6. Re: SGI: Need Something like 1 Mutual Exclusion Semaphore for MultiblePrograms

    clusardi2k@aol.com wrote:
    > I can't use the following sequence because the programs that use the
    > library routine reside on different computers.
    >
    > sem_open
    > sem_init
    > sem_wait
    > sem_post
    > sem_post
    >


    Different computers? What kind of shared memory was there supposed to be and
    and what was its memory model supposed to be?

    This sounds more like distributed programming and the newsgroups that discuss that
    might be better. Are you using some kind of distributed programming environment
    and what is it? Also, what is it your routine is doing that only one program can
    invoke it at a time, assuming that has any meaning?

    --
    Joe Seigh

    When you get lemons, you make lemonade.
    When you get hardware, you make software.

  7. Re: SGI: Need Something like 1 Mutual Exclusion Semaphore for MultiblePrograms

    clusardi2k@aol.com wrote:
    >
    > I have a assignment just thrown onto my desk.
    >

    .... snip ...
    >
    > P.S.: I'm sorry if I'm posting this to the wrong group. :-[


    You are, in at least two of the groups you used. You also
    neglected to set follow-ups to whatever home group you are using.
    F'ups set.

    --
    "If you want to post a followup via groups.google.com, don't use
    the broken "Reply" link at the bottom of the article. Click on
    "show options" at the top of the article, then click on the
    "Reply" at the bottom of the article headers." - Keith Thompson



  8. Re: SGI: Need Something like 1 Mutual Exclusion Semaphore for Multible Programs

    In article <1120742189.678926.138110@g49g2000cwa.googlegroups. com>,
    clusardi2k@aol.com wrote:

    : I have a assignment just thrown onto my desk.
    :
    : What is the easiest way to solve it? Below is a brief
    : description of the task.
    :
    : There are multible programs which use the same library routine
    : which is an interface to what I'll call a service program.
    :
    : The problem is that only 1 request at a time can be serviced by
    : the service program.

    There's a few options. You can, in order of decreasing preference:

    * Fix your service program to queue requests
    * Add an intermediary service program that queues requests to the service program
    * Use some distributed API for locking (since you mention they're on different
    machines), like maybe MPI, PVM, or something like RPC
    * Use a reject-and-retry collision system

    You could also possibly parallelize your service program so that it can serve
    more than one request at a time, or make it transactional if it's not quite
    parallelizable. It all depends on what your service program actually does.


    Cheers - Tony 'Nicoya' Mantler

    --
    Tony 'Nicoya' Mantler -- Master of Code-fu -- nicoya@ubb.ca
    -- http://nicoya.feline.pp.se/ -- http://www.ubb.ca/ --

  9. Re: SGI: Need Something like 1 Mutual Exclusion Semaphore for MultiblePrograms

    clusardi2k@aol.com wrote:
    >
    > I can't use the following sequence because the programs that use
    > the library routine reside on different computers.
    >
    > sem_open
    > sem_init
    > sem_wait
    > sem_post
    > sem_post
    >
    > The only thing I have to find out is how how do I declare the
    > semaphore to be in shared memory.


    This has nothing to do with at least three of the groups to which
    you cross-posted without troubling to find out what they were
    about. F'ups set.

    --
    "If you want to post a followup via groups.google.com, don't use
    the broken "Reply" link at the bottom of the article. Click on
    "show options" at the top of the article, then click on the
    "Reply" at the bottom of the article headers." - Keith Thompson



+ Reply to Thread