Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Nice (Unix)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Use and effect== <code>nice</code> becomes useful when several processes are demanding more resources than the [[Central processing unit|CPU]] can provide. In this state, a higher-priority process will get a larger chunk of the CPU time than a lower-priority process. Only the [[superuser]] (root) may set the niceness to a lower value (i.e. a higher priority). On Linux it is possible to change <code>/etc/security/limits.conf</code> to allow other users or groups to set low nice values.<ref>{{man|5|limits.conf|ManKier}}</ref> If a user wanted to compress a large file without slowing down other processes, they might run the following: <syntaxhighlight lang="console"> $ nice -n 19 tar cvzf archive.tgz largefile </syntaxhighlight> The exact mathematical effect of setting a particular niceness value for a process depends on the details of how the [[Scheduling (computing)|scheduler]] is designed on that implementation of Unix. A particular operating system's scheduler will also have various heuristics built into it (e.g. to favor processes that are mostly I/O-bound over processes that are CPU-bound). As a simple example, when two otherwise identical CPU-bound processes are running simultaneously on a single-CPU Linux system, each one's share of the CPU time will be proportional to 20 β ''p'', where ''p'' is the process' priority. Thus a process, run with <code>nice +15</code>, will receive 25% of the CPU time allocated to a normal-priority process: (20 β 15)/(20 β 0) = 0.25.<ref>{{cite book |title=Operating system concepts |last1=Silberschatz |first1=Abraham |last2=Galvin |first2=Peter B. |last3=Gagne |first3=Greg |date=2013 |publisher=Wiley |location=Hoboken, N.J |isbn=978-1-118-06333-0 |page=294 |edition=ninth}}</ref> On the [[Berkeley Software Distribution|BSD]] 4.x scheduler, on the other hand, the ratio in the same example is about ten to one.{{Citation needed|date=November 2013}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)