Abstract:
In this program or demo we have shown a n eating room considered
as a critical section and a sofa of four sits infront of the eating room which is
considered as a semaphore queue. Here we consider the processes as a man.
When a man is hungry he comes in and performs the 'P' operation. If he is
accepted then he goes in, checks the eating room if it is busy or not. If it is
not busy then he goes in and eats his food. If it is busy then he waits on the
sofa infront of the eating room. One important thing is when a man is
accepted to go in he changes the value of the variable'S'. When there is no
man either in the eating room or on the sofa then the value of s remains full.
For example let us consider that there is no one and has the value 5. When a
man comes he decreases the value of'S' and gets in and this process goes
on. When the value of'S' is 0 then no one can enter. When the man in the
eating room finishes his job or work he then comes out and performs the' V'
operation. The 'V' operation is if there is any man waiting for the room let
one of then proceed. At this time the values of'S' is incremented. That
means there is an empty sit and any man who will come next can get in. If
there is no man to come, then the man in the room will let another man
proceed after he finishes his job and increments the value of'S' .
Description:
This thesis submitted in partial fulfillment of the requirements for the degree of Bachelor of Science in Computer Science and Engineering of East West University, Dhaka, Bangladesh.