File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

thread's

 
nitin sharma
Ranch Hand
Posts: 290
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 290
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please let me know if all the above given point's are correct or not.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic