Friday, December 15, 2006

What a way to explain something serious ! ... (need to understand thread model to njoy this)

I came across a post in java forum on thread synchronization, it reads like this

Synchronized block is a toilet room with a lock in a public lavatory.
Only one person(running thread) can have the lock at a time.
And, she/he have to receive the lock from a particular object obj like:
synchronized(obj){.....} // one object has only one lock for this {} toilet and for any other toilets how many there are... *


and fun is in the way he explains a deadlock situation it goes like this .. read on

The guy inside has the key to toilet. The guy outside has the toilet paper.


geeks too have great sense of humour :-) !!!

1 comment:

Arun S R said...

Amazing!!!
This makes learning very easy :-) ha ha ha