renice 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-renice
핵심 정리
- 실행 중인 프로세스의 nice 값을 바꿉니다. 기본은 프로세스 ID로 지정하고,
-g는 프로세스 그룹,-u는 사용자로 지정합니다. -n 증가값을 지금 nice 값에 더합니다. 양수는 우선순위를 낮추고, 음수는 높이며 권한이 필요합니다.- root가 아니면 자기 프로세스만, 우선순위를 낮추는 쪽으로만 바꿀 수 있습니다(직접 낮췄던 것도 다시 높일 수 없음).
- root는 어떤 프로세스든 -20~20 범위로 바꿀 수 있습니다.
- 우선순위를 고정하는 것은
renice로 할 수 없고setpriority시스템 호출을 씁니다. - AIX 5.3과 6.1 문서의 내용이 같습니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (두 버전 내용 같음) |
| 원문 | IBM Commands Reference — 5.3 Volume 4, 6.1 Volume 4 |
| 파일 | /usr/sbin/renice, /etc/passwd |
| 관련 명령어 | nice, ps |
목적
실행 중인 프로세스의 nice 값을 바꿉니다.
영어 원문
Alters the nice value of running processes.
구문
renice [ -n Increment ] [ -g | -p | -u ] ID ...
설명
renice 명령은 실행 중인 프로세스 하나 이상의 nice 값을 바꿉니다. nice 값은 프로세스의 시스템 스케줄링 우선순위를 나타내는 10진 값입니다. 기본으로 대상 프로세스는 프로세스 ID로 지정하며, 프로세스 그룹을 지정하면 그 그룹의 모든 프로세스에 적용합니다.
nice 값을 정하는 방식은 구현에 따라 다릅니다. 요청한 증가값으로 nice 값이 구현의 한계를 넘으면, 넘은 쪽의 한계값을 씁니다.
root 권한이 없으면 자신이 가진 프로세스만, 020 범위 안에서 우선순위를 낮추는 쪽으로만 바꿀 수 있습니다(20이 가장 낮은 우선순위). root 권한이 있으면 어떤 프로세스든 -2020 범위의 값으로 바꿀 수 있습니다. 지정한 Increment는 우선순위를 다음과 같이 바꿉니다.
| Increment | 효과 |
|---|---|
| 1~20 | 기본 우선순위보다 느리게 실행합니다. |
| 0 | 기본 스케줄링 우선순위로 정합니다. |
| -20~-1 | 기본 우선순위보다 빠르게 실행합니다. |
renice는 이 값을 커널이 실제로 쓰는 값으로 바꿉니다.
참고:
- root 권한이 없으면 프로세스의 nice 값을 높일 수 없습니다(전에 직접 우선순위를 낮췄더라도).
renice로 프로세스를 고정 우선순위로 실행하게 할 수는 없습니다. 그러려면setpriority시스템 호출을 씁니다.
영어 원문
The renice command alters the nice value of one or more running processes. The nice value is the decimal value of the system scheduling priority of a process. By default, the processes affected are specified by their process IDs. When you specify a process group, the request applies to all processes in the process group.
The nice value is determined in an implementation-dependent manner. If the requested increment raises or lowers the nice value of the executed utility beyond implementation-dependent limits, the limit whose value was exceed is used.
If you do not have root user authority, you can only reset the priority of processes you own and can only increase their priority within the range of 0 to 20, with 20 being the lowest priority. If you have root user authority, you can alter the priority of any process and set the priority to any value in the range -20 to 20. The specified Increment changes the priority of a process in the following ways:
- 1 to 20 — Runs the specified processes slower than the base priority.
- 0 — Sets priority of the specified processes to the base scheduling priority.
-20to-1— Runs the specified processes quicker than the base priority.
The renice command maps these values to those actually used by the kernel.
Notes:
If you do not have root user authority, you cannot increase the nice value of processes (even if you had originally decreased their priorities).
You cannot use the renice command to change a process to run at a constant priority. To do this, use the setpriority system call.
플래그
| 플래그 | 설명 |
|---|---|
-g |
모든 ID를 부호 없는 10진 정수 프로세스 그룹 ID로 해석합니다. |
-n Increment |
프로세스의 nice 값에 더할 수입니다. -20~20의 10진 정수만 쓸 수 있습니다. 양수는 우선순위를 낮추고, 음수는 알맞은 권한이 필요하며 우선순위를 높입니다. |
-p |
모든 ID를 부호 없는 정수 프로세스 ID로 해석합니다. 다른 플래그가 없으면 기본입니다. |
-u |
모든 ID를 사용자 이름이나 숫자 사용자 ID로 해석합니다. |
영어 원문
-g— Interprets all IDs as unsigned decimal integer process group IDs.-nIncrement — Specifies the number to add to the nice value of the process. The value of Increment can only be a decimal integer from -20 to 20. Positive increment values cause a lower nice value. Negative increment values require appropriate privileges and cause a higher nice value.-p— Interprets all IDs as unsigned integer process IDs. The -p flag is the default if you specify no other flags.-u— Interprets all IDs as user name or numerical user IDs.
종료 상태
| 값 | 뜻 |
|---|---|
| 0 | 잘 끝났습니다. |
| 0보다 큼 | 오류가 났습니다. |
영어 원문
This command returns the following exit values:
- 0 — Successful completion
>0— An error occurred.
예제
- 프로세스 ID 987과 32의 스케줄링 우선순위를 낮춥니다.
renice -n 5 -p 987 32
- 프로세스 그룹 ID 324와 76의 스케줄링 우선순위를 높입니다(알맞은 권한이 있을 때).
renice -n -4 -g 324 76
- 숫자 사용자 ID 8과 사용자
sas의 스케줄링 우선순위를 낮춥니다.
renice -n 4 -u 8 sas
영어 원문
To alter the system scheduling priority so that process IDs 987 and 32 have lower scheduling priorities, enter:
renice -n 5 -p 987 32To alter the system scheduling priority so that group IDs 324 and 76 have higher scheduling priorities (if the user has the appropriate privileges to do so), enter:
renice -n -4 -g 324 76To alter the system scheduling priority so that numeric user ID 8 and user
sashave lower scheduling priorities, enter:renice -n 4 -u 8 sas
파일
| 파일 | 설명 |
|---|---|
/usr/sbin/renice |
renice 명령이 들어 있습니다. |
/etc/passwd |
사용자 이름을 사용자 ID로 대응시킵니다. |
관련 명령어: nice
영어 원문
- /usr/sbin/renice — Contains the renice command.
- /etc/passwd — Maps user names to user IDs.
Related reference:
- nice Command
Related information:
- getpriority command,setpriority command
- Processes command
- Shells command
- Controlling contention for the microprocessor
리눅스(GNU)와 다른 점
| 항목 | AIX 5.3·6.1 | 리눅스 renice(util-linux) |
|---|---|---|
| 값의 범위 | 문서상 -20~20 | -20~19 |
| 옛 형식 | 문서는 -n만 설명 |
renice 우선순위 -p PID 형식도 받음 |
| 일반 사용자 | 낮추기만 가능 | 같음(RLIMIT_NICE로 허용될 때 예외) |