I experimented with codes for various synchronization methods. One way to create a delay is to start the thread with thread.sleep (millis), but it is very well said that the time during which the thread wakes up is not so accurate and can be before or after this time. Then I came across a definition where it is possible to use thread.sleep (millis, nanos), where nanos gives "extra nanosecond precision".
My question is that thread.sleep () is not so accurate in milliseconds, what does adding extra nano give us? When this value is added, the sleep method suddenly becomes more accurate, for example, forcing the operating system to be more strict or higher priority when monitoring it? Also .join () has the same option, I suppose the answer to the thread.sleep () part is similar to the .join () part. Thank.
source
share