Linux Performance

Posted: November 14, 2008 by Narendra Shah in Linux Box
Tags: , ,

1. How to make things run faster?

This actually is not a problem. Most of the people who are new to Linux usually are surprised by the speed it works at. They love to find the machine responding faster and the decrease in system boot up and application launch response. But for enthusiasts it is never enough. They would always want to have a bit more. They would just push the machine to its extreme and thats what they rejoice in.

From another perspective, we may need our computer to do a particular job faster than other jobs. For example, one may want that the CD burning program is allocated more resources so that CD is not corrupted or one may like that Databases respond quicker.

For this to be accomplished, you need to run the program with a higher priority. In the Linux world, the term ‘niceness’ corresponds to priority. The second thing to be remembered is that a program with LESS niceness is more prior than others. The easier was to remember is that a person who is less nice to others will prefer HIS work before allowing his neighbors to use the resources. So a less nice process will ask for allocation of resources more towards itself than towards the other processes.

The niceness of a process in Linux will typically range from -20 (greatest priority) to +19 (least priority). So if you need to run a process with more priority, run it with less niceness. The easiest way to do this is as follows :

Code: Select all
# nice --adjustment=<niceness> COMMAND

This will run the COMMAND with the specified niceness. nice command is used to set priority of Process in linux. The thing to be noticed is that the nice command can be used only by the root. So you need to be the root before running it. However that would launch the process as root which is not desirable. So to make sure that the nice program is executable by all the users, run the following command as root:

Code: Select all
# chmod +s /usr/bin/nice

Now, an example for the nice command ca be as follows:

Code: Select all
#nice --adjustment=-15 vmware

Runs VMware with a much higher priority (-15) than the normal (0).

NOTE: Remember that you should not run any process with a niceness lower than -15 (without knowing what actually is done) as this may make other processes really slow depending on what the process does.

Let me discuss what benefits I get by using the above example:

Since I run my Windows OS with only one processor power allocated to it which is fairly OK in most of the cases where heavy multitasking is not required. But when I am doing some multitasking in the Virtual Machine but do not want to get my system slow which I use for downloading, copying files and listening to music at one time, I am at a loss. In this case, I run the VMware with a higher priority (and a lower niceness) so that all the power of the ONE processor goes to the Windows in virtual environment and makes it run faster (however multiple machines at one time will take away more power from both processors) and my real machine works at a fair speed as well.

So if you understand what your program does, you can very well run each and every program at a favorable speed.

NOTE: DO not be in the illusion that if you launch all the programs with a higher priority, all of them will run much fast. Niceness of a process is RELATIVE TO OTHER PROCESSES and hence only a few programs which are needed to be run faster can be launched with a lower niceness, not all of them.

 

I will add more performance hits over here as time goes.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s