Sunday, March 13, 2005

Application of knowledge

This is geeky to the core! But a funny discussion
nonetheless...

This weekend in a coffee day, we observed the rest-room.
One of my friends had a doubt if the staff have a
seperate one or the entire coffee day had just one common
rest room. Another guy was of the opinion that the staff
had a seperate entrance to the same rest-room!! :-))

"Then this is a classic critical section problem!"
said one of us...

"Yep, there must be guarantee for mutual exclusion"
said another...

"They can probably use semaphores to take care of that,
so that only one can be in the rest-room at a time"
said the first one again...

"There are some problems with semaphores though - lot
of responsibility on the programmer (user of the rest room here!)"

"Ya maga - imagine, if someone forgot to unlock the
semaphore before exiting"

"Right - the other people would suffer indefinite starvation
(starvation of the rest-room :-)) )"

"On the other hand, what if the guy forgets to lock onto the
semaphore before he enters the rest-room?!"

"That would mean its possible for two people to be in the
rest-room at the same time!!!!"

"Semaphores cant be a solution because there are 2 entry
points to the same critical section. This would require some
sort of sync between 2 semaphores."

"Thats also correct... But a feasible solution is to be careful
and to lock both semaphores before entering and release them
when done!"

Some sort of Toilet Control System (EH?!)

1 comment:

  1. lol...really clever macha...sooper post...the parody on TCS was as subtle as it can get...;)

    ReplyDelete

What I want to say is: