Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

nice(2) [redhat man page]

NICE(2) 						     Linux Programmer's Manual							   NICE(2)

NAME
nice - change process priority SYNOPSIS
#include <unistd.h> int nice(int inc); DESCRIPTION
nice adds inc to the nice value for the calling pid. (A large nice value means a low priority.) Only the superuser may specify a negative increment, or priority increase. RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
EPERM A non-super user attempts to do a priority increase by supplying a negative inc. CONFORMING TO
SVr4, SVID EXT, AT&T, X/OPEN, BSD 4.3. However, the Linux and glibc (earlier than glibc 2.2.4) return value is nonstandard, see below. SVr4 documents an additional EINVAL error code. NOTES
Note that the routine is documented in SUSv2 to return the new nice value, while the Linux syscall and (g)libc (earlier than glibc 2.2.4) routines return 0 on success. The new nice value can be found using getpriority(2). Note that an implementation in which nice returns the new nice value can legitimately return -1. To reliably detect an error, set errno to 0 before the call, and check its value when nice returns -1. SEE ALSO
nice(1), getpriority(2), setpriority(2), fork(2), renice(8) Linux 2001-06-04 NICE(2)

Check Out this Related Man Page

NICE(3) 						   BSD Library Functions Manual 						   NICE(3)

NAME
nice -- set program scheduling priority LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <unistd.h> int nice(int incr); DESCRIPTION
This interface is obsoleted by setpriority(2). The nice() function obtains the scheduling priority of the process from the system and sets it to the priority value specified in incr. The priority is a value in the range -20 to 20. The default priority is 0; lower priorities cause more favorable scheduling. Only a process with appropriate privileges may lower priorities. Children inherit the priority of their parent processes via fork(2). RETURN VALUES
Upon successful completion, nice() returns the new nice value minus NZERO. Otherwise, -1 is returned, the process' nice value is not changed, and errno is set to indicate the error. ERRORS
The nice() function will fail if: [EPERM] The incr argument is negative and the caller does not have appropriate privileges. SEE ALSO
nice(1), fork(2), setpriority(2), renice(8) STANDARDS
The nice() function conforms to X/Open Portability Guide Issue 4, Version 2 (``XPG4.2''). HISTORY
A nice() syscall appeared in Version 6 AT&T UNIX. BSD
April 30, 2011 BSD
Man Page

14 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Please Help Me With This Nice And Renice Stuff

i read a book about this a couple of times and i still find it confusing. they talking about when you increase a priority number, that decreases nice number. I really dont understand this. I'm working on a solaris and linux red hat 7.2 system. if anyone can explain this stuff to me in... (3 Replies)
Discussion started by: TRUEST
3 Replies

2. AIX

Where to Order 5.1L Cds

Anyone know where you can purchase a 5.1 cd set? IBM no longer ships this out and do not have a set. I have a burned copy, but would be nice to have the originals. I'd like to send my copies offsite for DR once i get an original set. Thanks! (2 Replies)
Discussion started by: slacker
2 Replies

3. Programming

nice command and nice() system call

Hi I want to implement the nice command in the shell that I am building. I came to know that there is a corresponding nice() system call for the same. But since I will be forking different processes to run different commands typed on the command prompt, is there any way I can make a command... (2 Replies)
Discussion started by: tejbuch
2 Replies

4. AIX

destroying the OS

Hi Guys I have a cool job to do and that's to destroy aix5.1 on two of my servers. I need to get rid of all information. I have thought of a way of doing this and wondered if any of you had any ideas!! Get the machine into maint mode and run the dd cmd! (7 Replies)
Discussion started by: animata
7 Replies

5. Shell Programming and Scripting

File filter

Hi Everyone , have a nice i would need a little help on this i have file which contains blocks such as given below <hgsdp:msisdn=923228719047,loc; HLR SUBSCRIBER DATA SUBSCRIBER IDENTITY MSISDN IMSI STATE AUTHD 923228719047 410072110070614 CONNECTED ... (3 Replies)
Discussion started by: Dastard
3 Replies

6. HP-UX

top and nice

Hi, I have two identical 12 CPU HPUX machines, and I run the same processes on each that load the boxes fully. top on one reports activity under the NICE (19%) and SYS (18%) columns, while top on the other reports 0% NICE and 16% SYS. What would cause NICE to be zero on one machine and not... (5 Replies)
Discussion started by: CBorgia
5 Replies

7. UNIX for Dummies Questions & Answers

System call code - nice()

Hi there, i'm trying to find the implementation code for the system call nice(). Since it's a system call i'm having problems finding where it would be? is it in the linux kernel directory somewhere? I would assume it would be a file called nice.c or something like this. Thanks in advance! (2 Replies)
Discussion started by: sport23
2 Replies

8. What is on Your Mind?

Newbie

Hi guys, I am new to here, hope to have a nice time here..! Regards, Anish (2 Replies)
Discussion started by: anishjp
2 Replies

9. UNIX for Dummies Questions & Answers

Newb writing his first shell script

Hey! This is my first post on this forum, nice to meet ya! I've been using Linux for a good few years, I grew up using DOS and a few similar CLI-based OS's so I'm fairly okay with navigating my way around the terminal. Recently I decided I wanted to become a sysadmin so I've been teaching... (3 Replies)
Discussion started by: Tamachan87
3 Replies

10. Shell Programming and Scripting

A nice way to check a string

Guys, I need some advice on how to check a string, which may or may not have a entry.. Never really worked out how to do this.. May be a good time to learn now. This is what i am trying to do Run a command, to return a string If the string is not empty , then run the if statement,... (4 Replies)
Discussion started by: Junes
4 Replies

11. UNIX for Advanced & Expert Users

Use of Capabilities

I wonder if anyone could assist with some problems I'm having with Linux Capabilities and their use when using the commands "nice" and "schedtool". I run a couple of PCs, one is an elderly AMD Sempron 2800+ (32-bit, 2GHz clock and 3GB memory) that is used as a family multimedia system running... (3 Replies)
Discussion started by: MikeGM
3 Replies

12. HP-UX

Top cmd showing NICE value 97% -what to tune?

Running 2 VM Guests on an HPUX Integrity Server. One Guest runs great, the other is always at a high NICE value and 0% idle as shown in TOP: What do you think should be tuned to bring down the NICE and increase IDLE %? Thanks in advance -hpuxadmin slow VM GUEST Load averages: 2.56,... (5 Replies)
Discussion started by: hpuxadmin
5 Replies

13. Shell Programming and Scripting

Set nice value in an executable in a script?

Is it possible to set a nice value for an executable in a script so that every time the executable runs it has this nice value? I'm trying to set aerender (After Effects terminal renderer) to run at +18 by replacing the original aerender script with a bash script with something like this in it: ... (3 Replies)
Discussion started by: scribling
3 Replies

14. BSD

Which UNIX / Linux to build a new machine with?

Is freeBSD a good choice for new Unix machine? I want to get back into Unix / Linux. System would be used for light scripting and file server needs. Something with nice software or hardware raid support would be good. If it could support virtual machines, kind of like VMWare's ESX that would be... (5 Replies)
Discussion started by: grips03
5 Replies