🔔 🔔 🔔 Duyuru: 24. Yılımıza özel indirimler sizleri bekliyor ! Kampanya Kodu : TDATA2024 | Detaylı bilgi için tıklayınız.

nice and renice command usages


nice and renice command usages


Nice Command

Linux nice command is Run Process With Modified Scheduling Priority ( nicenesses ). With the help of Nice command in Linux you can set process priority. If you give a process a higher priority, then Kernel will allocate more cpu time to that process.

By default when a programe is launched in Linux, it gets launched with the priority of ’0′. However you can change the priority of your programes by either of the following methods.

You can launch a programe with your required priority. Or you can also change the priority of an already running process.

Process priority values range from -20 to 19. A process with the nice value of -20 is considered to be on top of the priority. And a process with nice value of 19 is considered to be low on the priority list.

You can use ps -al, top and various command to check priority. The column that starts with “NI” shows the nice value(priority of the process). You can clearly see that most of them has got a ’0′ priority.

PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
31102 nobody    16   0  269m  22m  10m R  2.0  0.6   0:04.44 /usr/local/apache/bin/httpd -k start -DSSL
27956 root      15   0 12884 1268  832 R  1.0  0.0   2:53.60 top -c
22384 mysql      5 -10 2830m 204m 3864 S  0.7  5.2 372:40.00 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/serv.med1med
1 root      15   0 10368  584  552 S  0.0  0.0   0:03.09 init [3]
2 root      RT  -5     0    0    0 S  0.0  0.0   0:06.15 [migration/0]
3 root      34  19     0    0    0 S  0.0  0.0   0:00.28 [ksoftirqd/0]
4 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 [watchdog/0]

For example

nice -10 <command name> Will set a process with the priority of “10″.

Renice Command

In order to change the priority of an already running process you can use “renice” command.

Suppose you see that your machine is running slow due to some lengthy process(which is not a required process at the moment), then you can reduce the priority of that process with the help of renice command. And also increase the priority of your required process at the moment.

renice command is very much similar to the nice command( interms of options in priority), however it does differ slightly in terms of parameters. You can give username,groupname etc in renice command as a parameter.

Examples:

renice 15 -p 20380 (this will set the priority of process id no 20380 to 15)

renice -17 -p 24132 -u mysql (this will set the priority of the process id 24132 to -17)

renice 11 -u cpanel,nobody -g testuser (this will set all process owned by “cpanel”,”nobody” and also the group “testuser” to 11)

 

Bu cevap yeterince yardımcı oldu mu?

Diğer Dökümanlar


  • cPanel security settings checklist

    You always use cpanel recommended Security Settings to avoid hacking and other suspicious activity. These  cPanel Server Hardening & Security tips will help prevent from hacking. cPanel...

  • sendmail Not running with correct effective GID

    Wed Sep 04 04:11:11 2014] [error] [client 11.44.33.22] sendmail: Not running with correct effective GID.  Is sendmail binary setgid mailtrap?, It may be the problem with your sendmail binary...

  • How to enable NAT behind the cpanel ?

    Most of webhosting providers currently used NAT service for their users. When you install cPanel & WHM, the installer will detect whether your server is on a NAT-configured network. If the...

  • Unable to allocate memory for pool

    Warning: Unknown: Unable to allocate memory for pool. in Unknown on line 0 APC or Alternative PHP Cache (APC) is a free and open opcode cache for PHP. APC allows for caching of opcode generated...

  • Install FFmpeg, Mplayer, Mencoder, MP4Box, Flvtool2

    You can use the following tutorial to install ffmpeg and other video modules in your centos server. FFmpeg is an audio/video conversion tool. It includes libavcodec, the leading open source codec...

Powered by WHMCompleteSolution