Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Some processes spend most of their "lives" in a sleep status. Daemons, servers and general listener come to mind. I was wondering if they get the same CPU time in that state? On something like my laptop, that wouldn't be very optimal!

I vaguely remember from my operating system course that there are different approaches to scheduling. I am interested to find out more about my current Linux (Debian) box.

How can I find out about my current scheduling policies? Can I change them dynamically? With a pretty userland app?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

Processes do not consume CPU resources while they are sleeping. They may add some overhead since the Kernel has to juggle them around, but that is very insignificant.

However, because of the way the question is worded, I should mention that when using Linux's CFS (Completely Fair Scheduler), it attempts to give programs increased CPU time in proportion to the time it sleeps - that is, if a process sleeps a lot, when it is resumed, it gets a higher priority.

See http://www.ibm.com/developerworks/linux/library/l-completely-fair-scheduler/ for a description of CFS.

share|improve this answer
1  
I want to vote this answer up but your current rep score (6,666) is too pretty to change. Ah well, I'm doing it anyway... –  rahmu Oct 19 '11 at 14:37
1  
@rahmu noooo! My beautiful straight sixes! I'll just have to get to sevens now. –  Shawn J. Goff Oct 19 '11 at 14:40
add comment

By definition, a sleeping process is not executing on the cpu, so obviously the amount of cpu time it is using is zero.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.