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 thread's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "thread Watch "thread New topic
Author

thread's

nitin sharma
Ranch Hand

Joined: Feb 24, 2001
Posts: 290
STEPS:
THREE THREAD'S OF EQUAL PRIORITY WHAT CAN HAPPEN.
1)START() WILL REGISTER ALL THE THREE THREAD'S WITH SCHEDULER
2)AFTER REGISTERING IT'S UPTO THE SCHEDULER WHICH THREAD IT START'S FIRST.
3)IT MAY OR MAY MOT START ANY ONE THREAD OUT OF THREE.
4)RUN METHOD WILL GET FIRED,THAT IS THE STARTING POINT OF THREAD'S EXECUTION.
5)WHEN A RUN METHOD FINISHES IT'S EXECUTION,THAT THREAD DIES.
6)WHEN ALL THE THREE THREAD'S ARE RUNNING, IT'S UP TO THE SCHEDULER TO DECIDE WHICH THREAD IT GIVE'S MORE TIME TO RUN.
7)IN SUCH A CASE WE CANNOT PREDICT THE OUTPUT BECAUSE THE THREAD SCHEDULING IS NOT PREDICTABLE.
8)SCHEDULER IS PLATFORM DEPENDENT.
IS IT POSSIBLE TO PREDICT THE OUTPUT IF WE PUT TWO THREAD'S PERFORMING DIFFERENT TASK'S INSIDE THE SYNCHRONIZED BLOCK'S.WHAT I FEEL IS WE CANNOT PREDICT BEACUSE THREAD SCHEDULER WILL DECIDE WHICH THREAD IT ALLOW'S TO RUN FIRST, I AM ASSUMING THAT BOTH THE THREAD'S HAVE THE SAME PRIORITY.
PLEASE LET ME KNOW IF I HAVE MISSED SOMETHING OR

nitin sharma
Ranch Hand

Joined: Feb 24, 2001
Posts: 290
please let me know if all the above given point's are correct or not.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
If you have two threads of equal prioirty running against a synchronized piece of code, you can not predict what order they will be run.


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: thread's