This project is to initiate The Inter Process Communications and multi processing. And it must be written in C on Linux.
We must realise a simulator that sells the remaining tickets in the lastest moment for a commercial flight. To do so, some specificities MUST be respected :
5 Process must be used and coded separately in separate files (with a makefile and a file.h) and they must be able to communicate (mutex/semaphore/Message queue/Shared memory/Message passing/Pipe)
-The first process must be named "Utilisateur" :
It must send the "destination" of the concerned flight ticket and the number of places entered by the user to the process "Agence" using a Message Queue.
- The process "Agence": Read the informations in the Shared Memory and verify if the transaction is possible
"Agence" answers "Utilisateur" using signals.
- The process "Tirage" : periodicly and randomly choses a destination and a number of places, then sends them to "Ecrivain" with an ordinary pipe.
-The process "Ecrivain" : Harvests the informations contained in the pipe and puts them in the shared memory if there is free space in it. If not, it waits untill space if free.
-The process "Affichage" : reads the shared memory and displays the flights that aren't full yet. It also must erase the complete destinations from the shared memory.
The maximum number of character for each destination is 20.
So before filling he shared memory, the process "Ecrivain" must adjust the names of each destination to make it 20 character (by filling the remaining free characters with something).
The max number of simultanious flights is set to 20.
The shared memories, the semaphores, and the pipes need a key to use theses IPCs. There are the keys chosen to do so :
• Shared memory key : 100
• Message Queue key : 200
• Semaphor mutex key : 300
The Coding must be done in C.
And it must be detailed as much as possible with lots of commentaries IN THE CODE.
Commentaries must be explicit and pedagogic for everyone to understand every step of the coding.
The code must copile and run, and the process must communicate with each other without any problem.
Libraries are joined for shared memories and semaphor uses.
Also, this project is initially written in FRENCH. I will attach the full subject so if any question, ask me or try to translate the subject.
The processes must run on separated terminals with a command (exemple : ./utilisateur) and their closing must be programmed as when you close one of them, all of them close. (or when a SIGQUIT signal is recieved). The process "Utilisateur" will then be closed with an exit(0).