Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Assuming we have read the following question: Change niceness (priority) of a running process and we know about root, non-root permissions:

What actually happens when a running process (Through renice) or a new process (Through nice) gets its priority changed to a positive/negative value it previously had.

  • Does it mean more memory is assign to it?
  • Does more CPU power go to that particular process?
  • Does it reduce any timing for resources for that process?

What happens when the process priority change?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

In PCs running recent OSs processes seem to run simultaneously, but are actually running one after another. Processes can be in several states, simplified here:

  • running (currently claiming CPU time)
  • ready (ready to claim the CPU for some work)
  • wait (waiting for other processes via inter-process communication, or I/O like disk or network)
  • sleep ("I don't need your time now")

The priority a process has tells the scheduler to pick the process with the highest priority with a ready state to allow to use the CPU. So, in the case where several processes are in the ready state, the one with the highest priority will get most of the time. And because Linux is a preemptive kernel, it can put processes from the running state on hold and let other processes do their work. The time processes get is divided in timeslices and the algorithm for the actual scheduling can also be selected.

Changing the nicelevel does not change anything for the memory manager as far as I know, but yes, it does influence on resource locking in a way that processes with a higher priority should finish earlier.

I suggest you to read more on this topic: Wikipedia: Preemptive multitasking and O'Reilly - Understanding the Linux Kernel (2000)

And, by the way, please note that a lower nicelevel means higher priority in Linux.

share|improve this answer

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.