Friday, January 29, 2010

Linux Process Prioritization

It can become annoying while waiting on your Linux system to complete a long process. Whatever the process might be you can help speed things along and give more cpu shares to your task. The top command lets you see the current processes running on your Linux machine. One of the columns you will see is the PR which stands for priority.

The lower the PR number the more cpu shares your process will get. The way to manipulate process priorities is with the nice and renice commands. For example, I have VirtualBox running an installation on my system. The top command is reporting alot of free cpu % because VirtualBox is getting it's resources capped due to the current priority.

sudo renice -20 pid

The pid will need to be the id of the process you are wanting to manipulate. In this case we are running renice and setting a priority of -20 (the lower the better) on our process id. Once complete our PR value changes from 20 to 0 and our NI value changes to -20. This dedicates more cpu power to our task and will hopefully cut down on the time it takes for our process to complete.

The same thing can be done to lower the importance of a process.

sudo renice 20 pid

The command above will raise the priority of the process matching our pid. The effect of raising the PR value will cause the process to get less system resources. This can be handy if your running a large task and want to use the system for other things at the same time.

Please note that nice and renice are common Linux/Unix tools however the syntax of the command is not always the same. The example above was from an Ubuntu system. On other distrobutions you might have to add flags such as -n or -p to make this command work. When in doubt check your manpages

man renice

Solaris 10 installation

After fighting with the shortcomings of OpenSolaris I have decided to install Solaris 10 inside of VirtualBox. Once the installation is complete I will have a running instance of Solaris 10 with a ZFS root file system. This virtual machine will be used to create future articles regarding the magical things you can do with Solaris.

The Solaris 10 installation is straight forward and much like any common Linux distrobution. You are asked a few questions about your system and then presented with an installation type. I chose the entire distrobution option in order to get a graphical desktop on this virtual machine. If this was a production system I would have selected the core installation option which is a much smaller package set. If you do choose the core option for your system you will have to add in additional packages from the installation media if you want to use features such as zones.

The downside to choosing the entire distrobution is the added packages that you most likely won't need or use. These packages then get inherited by zones when you create them. This adds to the package counts for your local zones when they are created. When it is time to perform system patching you will need to account for extra time on systems that have chosen the entire distrobution option. More packages will add to more patches that your system needs to stay up to date and secure. Just some things to think about if you are going to be serious about your Solaris system.

The ZFS root filesystem option must be chosen after booting from the installation media. You will need to specify 3 or 4 for your initial installation choice if you wish to select the ZFS filesystem later on during your system installation. Once completed I will have a virtual machine running Solaris 10 on x86_64 with ZFS. The traditional UFS filesystem will work fine but you will have to setup partitions (slices) for your system. With ZFS the entire disk is allocated to the root pool and can be divided on the fly later on using various system commands to create filesystems under the ZFS root along with other tasks such as applying partition limits.

Oracle now owns the rights to all things SUN. Even the SUN website now redirects to a page containing an oracle header. Oracle has stated they plan to continue investing in Solaris which will most likely "SPARC" growth of this operating system.

Saturday, January 16, 2010

China, Microsoft, and why you should be afraid

Google getting hacked in China has been all over the Internet this last week. There has been speculation that the Chinese government is the party responsible for hacking Google and up to 30 some firms operating in China.

The initial blame went to Adobe but upon further review it was revealed that the hackers gained access to these systems through a 0 day exploit in the Internet Explorer web browser.

First of all......... Google what are you doing using Internet Explorer at work???

Now we have got that out of the way lets take a look at this a little deeper.

The technology sector moves quick and forgets even faster. Had I not been an open source advocate for over 10 years I probably would have forgotten all about the headlines from 2003-2004 when Microsoft GAVE CHINA A COPY OF THE SOURCE CODE! This has been covered before but everyone in today's tech sector must have just forgot. This attack in China against Internet Explorer should not be a surprise by any means. It most likely took them a few years to review the code to find exploits such as the one that was used to compromise and monitor all of these systems.

This attack was noticed and tracked back to the source ( Chinese Government ). The best hacks are the ones which occur without being detected by the victim. How long would this have gone on if it was not discovered?

Other countries are recommending people get rid of Internet Explorer because it has so many security issues. With the code used for the attacks now available online combined with no fix from Microsoft, when will the rest of the world (specifically the United States) learn from these mistakes and leave Microsoft behind?

If this was insightful, click on our ads.