V
vj
Hello group,
I know that its a very lame question to ask experts like you but still
i cannot help myself asking the question that "What is the Diffrence
Between Notify & NotifyAll" method in the Object Class.
Well so far my search on the Internet and JDK Documentation reveals
that 'notify' method wakes up a single thread waiting on the object
and passes the control of the monitor to it. So far so good and for
'NotifyAll' it says that its will wake up all the threads waiting on
the object and will select a thread to pass control to it. Well as per
me during that period the unselected thread will again go back to sleep
in the JVM scheduler list and they will need yet another call to
Notifty (or NotifyAll) in order to wake them up. So, as far as i see
there is no diffrence between notify & notifyall as they both will
result in waking up a single thread waiting on the Object.
If above assertions are indeed true than why to have two diffrent
methods.
Thanks,
VJ
I know that its a very lame question to ask experts like you but still
i cannot help myself asking the question that "What is the Diffrence
Between Notify & NotifyAll" method in the Object Class.
Well so far my search on the Internet and JDK Documentation reveals
that 'notify' method wakes up a single thread waiting on the object
and passes the control of the monitor to it. So far so good and for
'NotifyAll' it says that its will wake up all the threads waiting on
the object and will select a thread to pass control to it. Well as per
me during that period the unselected thread will again go back to sleep
in the JVM scheduler list and they will need yet another call to
Notifty (or NotifyAll) in order to wake them up. So, as far as i see
there is no diffrence between notify & notifyall as they both will
result in waking up a single thread waiting on the Object.
If above assertions are indeed true than why to have two diffrent
methods.
Thanks,
VJ