I need to perform a tp on semaphores and shared segments of memory, but I have
a bit of trouble with the first notion.
In short, we are asked to create 3 programs:
The first director, who with the create capacity file argument, will create the
museum with the different IPC system objects with the maximum capacity given in
argument and the maximum number of visitors in the maximum queue given by the
The open and close arguments will open or close the museum.
The delete argument will delete the museum and IPC System 5 objects.
Then, the controller program, called without argument, will ensure that the
current capacity of the museum does not exceed the maximum capacity.
Finally, the visitor program simulates the arrival of a visitor, with the time
remaining in the arguments. It is called as many times as there are visitors. A
visitor ends if the queue exceeds the limit set at creation, otherwise he asks
for permission to enter the museum.
We are asked here to use only the IPC system 5 objects that are the shared
memory segments and semaphores.
So we will have our semaphores as the only synchronization mechanism.
So I create my 3 programs, with a shared memory segment for different
information (maximum capacity and file)
On the other hand, I can not really know how to use semaphores.
Should I create a binary semaphore already for the case of open or close museum?
Also, I do not really see how to implement everything in the case where we have
to share information between 3 programs and suddenly how to implement
semaphores of this kind ...
thank you in advance