Forums Register Login

thread's

+Pie Number of slices to send: Send
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

+Pie Number of slices to send: Send
please let me know if all the above given point's are correct or not.
+Pie Number of slices to send: Send
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.
What are you saying? I thought you said that Santa gave you that. And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 535 times.
Similar Threads
thread's
start()
thread's
Please give me reply.
Will a started thread run to completion in this example?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 06:27:09.