With regards to linux blog entry posted last month about process scheduling prioritization, here's another way to schedule and modify real-time attributes of linux commands when launched or currently active application PIDs using linux command chrt.
In linux, all process runs with their own respective scheduling priorities and process attributes on every CPU cycle that simply affects how linux kernel sets CPU resources and process priorities to a particular PIDS. There are three categories of linux scheduling policies namely:
a. SCHED_OTHER - this is the default linux scheduling policy
b. SCHED_FIFO - stands for FIFO, first in first out policy scheme
c. SCHED_RR, or SCHED_BATCH - stand for linux round-robin schedule policy
This linux blog entry covers an alternative approach,besides from using nice and renice, on priority scheduling of linux process and threads. Process scheduling and application prioritization is a must to know specially on thousand server farms and/or enteprise world of linux computing.
Chrt man says:
Chrt sets or retrieves the real-time scheduling attributes of an existing PID or runs COMMAND with the given attributes. Both policy (one of SCHED_OTHER, SCHED_FIFO, SCHED_RR, or SCHED_BATCH) and priority can be set and retrieved.
Chrt linux command is installed by default installation. This process attribute linux tools is part of util-linux package. The util-linux package contains a large variety of low-level linux binaries that makes a Linux system to function steadily. Among others, util-linux contains the fdisk disk configuration tool and the user account and login programs.
How to install chrt and util-linux binary package?
INSTALLATION
============
# yum -y install util-linux
MORE CHRT USAGE
===============
Let's take for example, the PID of kswapd process
# ps axuw | grep kswapd0 | grep -v kswapd
returns
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
root 153 0.0 0.0 0 0 ? S< Sep10 0:01 [kswapd0]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are minimim and maximum priority value of these linux scheduling policies as shown below:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SCHED_OTHER min/max priority : 0/0
SCHED_FIFO min/max priority : 1/99
SCHED_RR min/max priority : 1/99
SCHED_BATCH min/max priority : 0/0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Let's make it work.
CHRT APPLICATION
-----------------
The process ID of kswapd swap daemon is 153 from the above case, to determine the scheduling policy for the currently running PID
# chrt -p 153
returns
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pid 153's current scheduling policy: SCHED_OTHER
pid 153's current scheduling priority: 0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Let us apply changing the priority attributes of Squid PID 5555 for example.
# chrt -p 5555
returns
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pid 5555's current scheduling policy: SCHED_OTHER
pid 5555's current scheduling priority: 0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Changing scheduling attribute of PID 5555 to 5 using chrt would be
# chrt -p 5 5555
CHRT VERIFICATION USAGE
-----------------------
# chrt -p 5555
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pid 5555's current scheduling policy: SCHED_OTHER
pid 5555's current scheduling priority: 5
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As mentioned above, chrt uses other linux scheduling policies. In order to use and change the other schedule process attributes' value, simply follow as shown below
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a. SCHED_OTHER
# chrt -p 5 5555
b. SCHED_FIFO
# chrt -p -f 5 5555
c. SCHED_RR, or SCHED_BATCH
# chrt -p -r 5 5555
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Make sure you verify the schedule priority attribute using chrt PID chrt verification method.
FINAL NOTE
-----------
At times, we would have an enteprise process being exectuted on non-busy hour of the day that consumes most of server resources, implementing linux priority scheduling and contolling application policy attributes would do the trick.
XCESS:
Well, am not inactive, just trying to do harder from my work around here.
Subscription
Categories
- HowTos (612)
- Linux Devices (40)
- Linux Diggs (620)
- Linux News (1541)
- Linux Videos (24)
Recent Posts
Blog Archive
-
▼
2007
(340)
-
▼
September
(58)
- Dear Linux SysAd Blog Readers
- Proactive monitoring from linux terminal
- deleting new lines and return line from text file
- Google chat setup using PSI howto
- PSI messenger - a truly promising open messaging a...
- Google chat setup using GAIM Pidgin howto
- Linux command line shell variables defined
- ls - displaying directory contents in many ways
- Control of alternative linux executables
- Searching using whereis linux command
- Witchy which linux command
- NeroLinux - diehard Nero burning software
- Google Sky - Explore and Rediscover the Sky
- Celestia - 3D Earth and Sky visualization
- Earth3D - real-time 3D Earth visualization
- GcStar - managing personal collection items
- DStat - resource statistics linux tool
- Bandwidth Monitor-NG - terminal-based interface ba...
- KNemo - KDE network interface monitoring tool
- EtherApe - graphical network activity monitoring tool
- Beauty of Math using Linux
- print leading/trailing lines before/after a matchi...
- Nagios Monitoring - install and generic setup howto
- ChRT- change real-time attribute process scheduling
- squeezed out multiple commented lines
- UNIX to DOS text file format converter
- totally squeezed out multiple blank lines
- squeezed multiple blank lines into single line
- fmt - simple optimal text formatter
- Linux backup powered by RDiff-Backup
- Linux Ping command explained
- read and display text file from terminal
- URLView - URL and email extractor
- TFTP server - setup and install howto
- NMap - Linux port scanning
- removing garbage characters from screen terminal
- invert string match using grep
- RDesktop - remote desktop howto
- Graveman on Linux - burn baby burn burn
- HTOP - interactive process viewer alternative
- Caching DNS server install howto
- BitTorrent - downloading large files made easy
- PHPAlbum - web photo album install howto
- MRTG graph creation with Cisco routers
- Tree view of directories and file listings from co...
- MAC address packet filtering using IPTables
- GTK-based GNOME Linux Tools
- Linux backups powered by RSnapShot
- MRTG tutorial, install and howtos
- FindSMB - view shared folders from network
- Squid - upgrade and install howto
- prompt and press a key between script lines
- Devede - DVD/VCD video authoring and creation tool
- display file and file system status
- determine file type
- GNOME GUI task scheduler install howto
- Linux backups powered by Rsync
- KPackage - GUI package administration and manageme...
-
▼
September
(58)
Friday, September 14, 2007
ChRT- change real-time attribute process scheduling
Subscribe to:
Post Comments (Atom)
ILoveTux - howtos and news | About | Contact | TOS | Policy
0 comments:
Post a Comment