Well , i got an idea that scheduling algorithm and hence its decision cannot be predicted , so any application made should be independent of scheduling decision made my JVM scheduler.
We say when a certain
Thread sleeps , it would go into Blocked state.
Assertion :- Suppose we have X number of threads and X>=3 and suppose there names are as follows.
1. Sahil
2. Ankit
3. Stella
and currently running thread is Sahil. Now suppose Sahil goes to sleep for some miliseconds. Say 1000 milliseconds. Moreover Ankit and stella threads are also not dead and in Runnable state. Also suppose no other Computer process is scheduled by OS while we are talking about the following.....
Is there a Possibility (not guarantee ) of Sahil to be again scheduled after 1000 milliseconds......??? I think i can guarantee that it should not be....!!! But is it so ???
Question 2:- When we say that Thread.sleep(1000), does it mean that JVM thread sleeps for 1000 milliseconds of its scheduled time by cpu or of real cpu time. Ooops let me clear. Suppose there are 10 processes running in a system and suppose we have Round Robin scheduling implemented by CPU, and time slice is 2000 ms.
Now i am concerned that is the counting of sleeping thread continues even when scheduled process by cpu is not the JVM and is the another out of 9 rest processes, or the counting continues only when JVM is running by CPU !!!
Thanks !!!