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. :-[