More than 100% CPU in top in Linux/Mac

If you are power linux/mac user you should have noticed at least once that top shows more than 100% CPU for a process. I also have seen this multiple times but always wondered how it can be. Here is an example of how my top looked when I started my java and was doing some number crunching.
Recently I did a bit of research and got to the bottom of this. So here is the reason for it. A process is said to be using 100% CPU if it uses a processor to the limit that processor goes ie it completely uses that CPU without giving any idle/free time for that CPU. Now consider the situation that we have a multi core CPU. What if the process has more than one thread ? Well if so there is a chance that the threads can be split between two cores. So if 100% is one CPU running at maximum power, then what is one CPU at maximum power and other using 10% of its computing power? Its 100% + 10% = 110%. That’s how the magical more than 100% CPU value comes in.

Continue reading “More than 100% CPU in top in Linux/Mac” »


, , , ,

No Comments

Auto Backup using Dropbox in Linux/Mac

I had some folders on my disk which I wanted to keep a copy online as a backup and for viewing from other places. Its not always possible to save all the essentials in the drop box folder itself to be auto backed up. Thus I wrote a very small script which does this for me. All it does is read all the folders which needs to be backed up from the text file “dropboxFolders.txt” and copy them to dropbox folder. The rest is done by dropbox scripts. Hence I expect the dropbox program to be running always in the background. So here is the script:

#!/bin/sh
foldersInfo="dropboxFolders.txt"
dropboxFolder="/home/<user>/Dropbox/"
while read line
do
from=`echo "$line" | cut -d":" -f1`
to=`echo "$line" | cut  -d":" -f2`
echo $from" to "$to
mkdir -p "$dropboxFolder$to"
cp -R "$from" "$dropboxFolder$to"
done <$foldersInfo

The file dropboxFolders.txt should be in the format :. Here is an example of the file:

/home/<user>/WorkingCode:WorkingCode

Continue reading “Auto Backup using Dropbox in Linux/Mac” »


, ,

No Comments

User Level Threads

User level threads is created for light weight threads. It needs to be controlled, context switched and swapped by the process. To the Operating System it is only one process without any threads. Here is one implementation of it:

Continue reading “User Level Threads” »


, , ,

No Comments

Cron a Django Program

One of the issue I faced while developing a website in Django was I always had a script which collects or data which is to be in the cron. But Django usually needs a lot of configurations and settings for the environment to run. So after some searches I got that django has an undocumented API of settings which we would use of the same. So here is a file which you could include for any file you would like to run as cron and this file would do the rest.

Continue reading “Cron a Django Program” »


, , , ,

No Comments

Service Engineer/System Administrator Interview Questions

This is not my code alone.  It was the group effort of Vivek Ram, Cijo George, Sandeep Unni and mine during our epic preparation for Yahoo!. I am just putting it open for others who would be looking for this information. Continue reading “Service Engineer/System Administrator Interview Questions” »


, , , , , ,

3 Comments

Operator Preference Grouping Order in C

Here is a compilation of how the preference of operators are Left to Right grouping or Right to Left grouping in C. Continue reading “Operator Preference Grouping Order in C” »


, , , , ,

No Comments

Ontology Linked Data

The following is a Assignment on Ontology and Linked Data and the evolution of data which lead to the use of ontology in web. Thanks to my teammates Bharath Gowda and Sravani Thota for working on the same. Continue reading “Ontology Linked Data” »


, ,

No Comments