java - Do spurious wakeups actually happen? -


Looking at the question related to various locking and (almost) always searches for 'loop' due to fake detective 1 I wonder, did anyone have such an awakening experience (for example, assuming a decent hardware / software environment)?

I know that the word 'fake' does not have any meaning, but what can be the reason for it

( 1 Note:

Edit: A helpful question (People who prefer code samples):

If I have the following program , And I run it:

  public class fake {public static zero main string [] args) {lock lock = new retront lock (); Condition condom = lock.newCondition (); Lock.lock (); Try {try {cond.await (); System.out.println ("wake up!"); } Grip (Prerupted Pre-Probe) {System.out.println ("Just a regular interrupt."); }} Finally {lock.unlock ();         

This is tidbit in Wikipedia:

In the pthread_cond_wait () function is implemented in futex Using system call. On Linux every blocking system call suddenly comes back with a EINTR when the process receives a signal ... pthread_cond_wait () waiting can not be restarted because it can not resume a bit In the long run, one can remember the actual wakeup, this code was out of the futex system call, only the status of this race can be avoided by checking the caller for an irreversible. A posix signal will therefore generate a counterfeit wake.

Summary : If a Linux process prompts its waiting threads, then each one is good, hot fake Wakeup .

I buy it. It is usually given a reasonably easy to swallow compared to obscure "The reason it is for performance" is often given.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -