Based on P66 [[ Java precisely ]]. To understand Thread.yield(), you need to recognize 2 of many states a real-world thread can be in.
“Eligible” = “Enabled” = eligible for CPU time-slice or “eligible for cpu assignment“. Not blocked or waiting for a lock or IO.
“Running” = “running on a cpu” or occupying the driver’s seat, and /driving/ the CPU to execute this thread’s instructions. I believe each native thread (T2000 has 32) can only have a single Running thread (driver) at any time. Running state is unrelated to Runnable.
Similarly, for a Process (rather than a thread), “Ready” means Eligible, i.e. not blocked. See P152 [[art of debugging]] http://web.cs.wpi.edu/~cs502/e07/LectureNotes/Week%202,%20Unix%20Processes.ppt shows that a process can be in Running state or in the Ready state. The Ready is very similar to the Eligible state of a thread – waiting to be assigned CPU
Now we are ready to explain Thread.yield() — it changes the current thread state from Running into Enabled. This thread now joins the “eligible bachelors” club. One of them will receive the CPU. If the club has nobody else, then this thread will.
State transition diagram on P 67 shows there exist only one route to Running — via Enabled. Implications:
1) At end of sleep(), the current thread doesn’t immediately start Running, but joins the Enabled club.
=> After sleeping, threads may not run.
2) A thread waking up from wait(), reacquiring lock, also joins the Enabled-club.
=> After notification, the awake thread can get delayed by lock-reacquisition or Enabled-club.