상세 컨텐츠

본문 제목

nice

Linux기본/명령어

by nowpassion 2008. 4. 30. 10:27

본문

http://en.wikipedia.org/wiki/Nice_%28Unix%29

nice (pronounced /ˈnaɪs/) is a command found on UNIX and other Unix-like operating systems such as Linux. nice directly maps to a kernel call of the same name. For a given process, it changes the priority in the kernel's scheduler. A niceness of −20 is the highest priority and 19 is the lowest priority. The default niceness for processes is inherited from its parent process, usually 0.
- nice(나이스)는 Unix와  Linux와 같은  Unix계통의 os에서 찾을 수 있는 명령어입니다. nice는 같은이름으로 커널 콜에 직접 맵핑되어 있습니다.  주어진 프로세스의 우선권은 나이스는 커널 스케줄러 안에서 변경합니다. -20의 niceness는 가장 높은 우선권이고 , 19는 가장 낮은 우선권입니다. 기본 niceness는 부모 프로세스에서 물려받으며 보통 0입니다.

nice becomes useful when several processes are demanding more resources than the CPU can provide. In this state, a higher priority process will get a larger chunk of the CPU time than a lower priority process. If the CPU can deliver more resources than the processes are requesting, then even the lowest priority process can get up to 99% of the CPU. Only the superuser (root) may set the niceness to a smaller (higher priority) value.
-nice는 몇몇프로세스가 CPU에서 제공하는 것보다 더많은 리소스를 요구할 때 유용해 질 것입니다. 이런 상태에서는 높은 우선권을 가진 프로세스가 더 많은 CPU 시간의 큰 청크를  가지게 될 것입니다. 만약 CPU가 프로세스가 요구하는 것보다 더 많은 리소스를 넘겨줄 수 있으면 그때 가장 낮은 우선순위를 가진 프로세스는 CPU의 99%까지 끌어올릴 수 있습니다. root 사용자만이 전의 프로세스보다 낮은 값(높은 우선순위)을 설정 할 수 있습니다.

There is also a renice command, which is used to change the priority of a process that is already running.
- renice 명령어도 있습니다. 이것은 프로세스가 실행 중 일때 우선순위를 바꾸는데 사용됩니다.

The exact mathematical effect of setting a particular niceness value for a process depends on the details of how the 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's priority. Thus a process run with nice +15 will receive 1/4 of the CPU time allocated to a normal-priority process: (20-15)/(20-0)=1/4. On the BSD 4.x scheduler, on the other hand, the ratio in the same example is about ten to one.
- 프로세스를 위한 부분적인 나이스 값을 설정하는 정확한 수학적인 효과는 UNIX에 구현된 스케줄러의 디테일에 달려있습니다. 일부 OS의 스케줄러는 더욱 발전적인 방향으로 OS에 들어가 있습니다. 예를 들어 CPU바운드들 같은 프로세스 위에 존재하는 대부분의 I/O 바운드 프로세스 같은 것을 선호하는 것입니다. 간단한 예로 간단한 single CPU 리눅스 시스템에서 각 프로세스가 CPU시간을 공유하는 것은 비례적으로 20-p가 될 것입니다.(p는 프로세스 우선순위 입니다.) 이런식으로 nice+15를 가진 프로세스 실행은 보통 우선순위 프로세스에 할당된 1/4시간을 가질 것입니다.  반면에 BSD 4.x 스케줄러에서는 거의 비슷할 것입니다

'Linux기본 > 명령어' 카테고리의 다른 글

grep  (0) 2008.04.30
su명령어  (0) 2008.04.30

관련글 더보기