Sleep()

Time slice is time-sharing operating system assigns to each running process for some CPU time on the micro. Time slots assigned by the operating system kernel scheduler to each process. First, the kernel will equal the initial process allocation for each time slice, and then turns to perform each process corresponding time, when all processes in the time slice depleted state, the kernel is recalculated and allocation of time for each process sheet, and so forth.
Since a computer usually has only one CPU, so can not really run multiple tasks simultaneously. The process "looks like" to run simultaneously, but in reality is run turns, because of the time slice is usually very short (on Linux is 5ms-800ms), the user will not feel it.

Sleep () relies on the kernel of the time slice, if the sleep time between 1 to 2 time slots, then the waiting time will be the final one or two time slots, i.e. Sleep () will 0-15.625 (1 time slices) error

http://www.sohu.com/a/155676858_714863

Guess you like

Origin www.cnblogs.com/elong1995/p/10972829.html