Comments

I think Sleep calls for Win32 API function Sleep which then tells Operating System "this thread is sleeping now for 5000 ms." After this process scheduler (this gets really deep into OS) schedules sleeping thread away and sets another thread into run. When scheduler has gone through every thread in the system it sees our sleeping thread. It checks if its still sleaping and if not, it starts scheduling some processor time for it again.

: I think Sleep calls for Win32 API function Sleep which then tells Operating System "this thread is sleeping now for 5000 ms." After this process scheduler (this gets really deep into OS) schedules sleeping thread away and sets another thread into run. When scheduler has gone through every thread in the system it sees our sleeping thread. It checks if its still sleaping and if not, it starts scheduling some processor time for it again.: