
Chapter 4. Tuning the operating system 105
Draft Document for Review May 4, 2007 11:35 am 4285ch04.fm
file system provides an interface to the running kernel that may be used for monitoring
purposes and for changing kernel settings on the fly.
To view the current kernel configuration, choose a kernel parameter in the /proc/sys
directory and use the cat command on the respective file. In Example 4-5 we parse the
system for its current memory overcommit strategy. The output 0 tells us that the system will
always check for available memory before granting an application a memory allocation
request. To change this default behavior we can use the echo command and supply it with the
new value, 1 in the case of our example (1 meaning that the kernel will grant every memory
allocation without checking whether the allocation can be satisfied).
Example 4-5 Changing kernel parameters via the proc file system
[root@linux vm]# cat overcommit_memory
0
[root@linux vm]# echo 1 > overcommit_memory
While the demonstrated way of using cat and echo to change kernel parameters is fast and
available on any system with the proc file system, it has two significant shortcomings.
The echo command does not perform any consistency check on the parameters.
All changes to the kernel are lost after a reboot of the system.
To overcome this, a utility called sysctl aids the administrator in changing kernel parameters.
In addition, Red Hat Enterprise Linux and Novell SUSE Enterprise Linux offer graphical
methods of modifying these sysctl parameters. Figure 4-5 on page 106 shows one of the user
interfaces.
Tip: By default, the kernel includes the necessary module to enable you to make changes
using sysctl without having to reboot. However, If you chose to remove this support
(during the operating system installation), then you will have to reboot Linux before the
change will take effect.