I have a question with regard to the sleep function declared in unistd.h
Assume we use a CFS scheduler.
We have a process that is ready to run(lets call this "READY" state),it gets picked to run,and now is running(so called "RUNNING" state).
During its execution in the RUNNING state it encounters a sleep statement,say sleep(10) that makes it sleep for 10 seconds or until a signal gets delivered or whichever is sooner.
Now when sleep(10) is being executed,is the process in READY state or is it put back into its original priority in the RUNNING queue or is it put to the WAIT queue.
I am unable to visualize the correct sequence of events.One thought process suggests that it remains in the READY queue,while another thought is that its put to the WAIT queue waiting for a timer expiry of some sorts.
Please let me know how this would work,or if there is something wrong in my question. Thanks