File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes wait() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "wait()" Watch "wait()" New topic
Author

wait()

Matt DeLacey
Ranch Hand

Joined: Oct 12, 2000
Posts: 318
Hey cowpokes,
Can you use notify() to notify a specific thread to move to it's Ready state from it's Waiting state? Suppose you have 10 threads waiting(t1..t10) and you want to move t3 to a Ready state. Can you do this?
Matt
satishind Reddy
Ranch Hand

Joined: Oct 17, 2000
Posts: 33
Hi
Using 'notify()' method you cannot specify which thread should go Ready state from waiting state. this activity taken care by Thread Scheduler.
Thread Scheduler is Operating system dependent.
For windows 98 it will applay 'Time sliced' Scheduling.
For Sun Solarisys it will applay 'Primitive sliced' Scheduling.
Higher priority thread serve first. I think now you know how to bring Ready state your 't3' thread.

hope this will help you....
Regards
Satish
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Matt,
To add to the above posts; when you're using more than one thread use notifyAll(). You still can't guarantee which thread the scheduler will choose to run but at least all of them get to compete.

------------------
Jane
The cure for boredom is curiosity.
There is no cure for curiousity.
-- Dorothy Parker
[This message has been edited by Jane Griscti (edited November 01, 2000).]


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
 
 
subject: wait()
 
Threads others viewed
notify
notify() in threads
sample question on threads
notify and notifyAll
why this??
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com