27 October 2009

GWUN

2030 AD. For the GWUN project sponsored by UN, 8700000 instances of the distributed GWUN clients are running busily on Linux Servers.

The global warming has already had a huge effect on the earth. And it seemed to be getting worse in the last 2 years. The poles were melting, sea-level rose, many countries have sub-merged in the sea and the life on earth was fast reducing.

The goal of the GWUN project is to compute the top reasons for global warming and the ways to protect life on earth. The scientists were eager to know the results. The situation was getting worser by the day. Huge corporations around the world sponsored more nodes for the project to speed it up. After busily computing for 27 months, the results were ready.

GWUN result: GWUN project machines were hosted at the Poles, to reduce the power consumption required for cooling those machines. Reducing power consumption was considered as a key factor to prevent global warming. But that released heat directly in the polar region of the earth. If the same amount of heat was released in an already warmer place, the earth's atmosphere would have managed to release/absorb the energy and the polar ice wouldn't have melted.

Beware of Glogle warming. Unknown preventive measures could be the real culprits.

24 August 2009

13 steps

I was using the stair-case instead of lift, whenever possible, in my office, for the past couple of weeks. I park my motorcycle in 0th floor and my office is in 6th floor. Each floor has 2 stretches of 13-steps each. Even though there are even number of steps(26) between 2 floors, it was split in to two stretches of odd number of steps(13).

The problem with odd -number of steps is that, if you don't watch your step, you would make the first step with your dominant leg(say right leg) at each stretch by one-step more than the other leg. That would burden that leg by 1-step at each stretch. There are 12 -stretches to the 6th floor. so 12 -steps more than the other leg. This can create an imbalance and knee problems! Does Vaasthu take care of these stuff?

ஆயிரத்தில் ஒருவன்

2009AD. இந்தியாவிலிருந்து ஐ.நா வின் கப்பலில் ஆயிரம் பேர் இலங்கையில் நிவாரண பணிகள் செய்வதற்காக செல்கின்றனர். அதில் கார்த்தி ஒருவன். கார்த்தி விஞ்ஞானி. ஆண்ட்ரியா ஒரு மருத்துவர். ரீமா சென் ஒரு பாதுகாப்பு அதிகாரி. ஆனால் வழியில் சுனாமி தாக்குகிறது. இவர்கள் மூன்று பேர் மட்டும் யாரும் இல்லாத தீவில் கரை ஒதுங்குகின்றனர்.

அங்கே இயற்கையில் உருவான டைம்-வார்ப்(Time-warp) பாறை ஒன்று உள்ளது. அதில் உள்ளே நுழைந்து அடுத்த பக்கம் வந்து பார்த்தால் காலம் கீ.பீ 209ஆம் ஆண்டில் சோழ மன்னனுக்கும்(பார்த்திபன்) ஒரு ராணிக்கும் இடையே போர் நடந்து கொண்டிருக்கிறது. இவர்கள் ஒளிந்திருந்து கவனிகின்றனர். போரில் தோற்கும் பார்த்திபன் மற்றும் அவரது 17 வீரர்கள் சிறை-இல அடைக்கப்படுகின்றனர். கார்த்தி அவர்களை காப்பாற்றி மீண்டும் அந்த டைம்-வார்ப் பாறையில் புகுந்து இக்காலத்திற்கு(2007 AD) திரும்புகின்றனர். மறுபடியும் இலங்கைக்கு அருகே உள்ள தீவில் திரிகின்றனர். அப்போது புலிகள் பயன்படுத்திய ஆயுத கிடங்கு ஒன்றை கண்டு பிடிக்கின்றனர். அவற்றை எடுத்து கொண்டு பார்த்திபன் மற்றும் 17 வீரர்கள் மீண்டும் கீ.பீ 208 செல்கின்றனர். இப்பொழுது மாடர்ன் weapon-களை கொண்டு போரை சுலபமாக வெல்கின்றனர். இதனை பார்த்துவிட்டு கார்த்தி/ரீமா/ஆண்ட்ரியா மீண்டும் தற்காலத்திற்கு(2008AD) வருகின்றனர். வந்து பார்த்தால்...

இந்தியா உலகின் மிகபெரிய வல்லரசாக இருக்கிறது. இப்பொழுது நாம் பார்ப்பதை விட அறிவியல் மிகவும் முன்னேற்றம் அடைந்து இருக்கிறது! அமெரிக்காவில் லியோ-நார்டோ டி காப்ரியோ எனும் நடிகன் "10 incarnations " எனும் லோக்கல் மொழி படத்தில் நமது அதிபர் மன்மோகன் சிங்க் மாதிரி ஒரு ரோல் செய்கிறார். அமெரிக்காவில் உள்ள ஏழை மாணவர்கள், இந்தியாவிற்கு on-site வர துடித்து கொண்டு இருக்கின்றனர். office-க்கு, வேட்டி-துண்டுடன் formals-ல்தான் வர வேண்டுமா என இந்தியன்-embassy-il கேட்டு கொண்டு நிற்கின்றனர்.

மீண்டும் கார்த்தி அந்த டைம்-வார்ப் பாறைக்கு திரும்புகிறார். அதிலிருந்து வரும் காற்றின் கார்பன் வெளியீட்டை அளவிட்டு, future-க்கு செல்ல எந்த திசையில் செல்ல வேண்டும் என கணிக்கிறார். செல்கிறார். (முற்றும். கற்பனை: Nikanth, Sankarlal)

27 July 2009

ullae-veliyae: Live graphs for I/O, CPU...

Wrote a small utility to print live graphs of I/O per-process. Find more information here. As a bonus added graphs for CPU as well.

RPM can be found here: http://download.opensuse.org/repositories/home://nikanth/openSUSE_11.1/noarch/

08 July 2009

Atomic git

As I wrote in git-pull-mishap-and-git-clean, the problem with git is that, operations are non-atomic. For example, if a git-pull is interrupted, or fails due to lack of disk space or network problem, the resulting repository will be in an in between state. This is problematic. It would be nice if git operations are atomic, in this sense.

A solution could be to have the git repository inside another git repository. For example, have the linux-2.6.git repo inside another git repo, say git-o-git. When you do a pull in linux-2.6.git, and if it succeeds do a `git commit -a` in the outer git-o-git. If it fails for some reason, one can go back to previous version of linux-2.6.git repo by doing a `git clean -d -f` and `git checkout -f` in the outer git-o-git.

It should be possible to add wrapper scripts to `git` and do this auto magically. May be it could be called as git WC, as it is built on top of git porcelain, which is built on top of git plumbing commands. ;-)

Has anyone tried this already?

GIT pull mishap and git clean

When I was doing a `git pull` from a remote repo, I ran out of disk space, which resulted in errors like

Updating ce8a742..faf80d6
error: git checkout-index: unable to write file drivers/usb/gadget/s3c-hsotg.c
error: git checkout-index: unable to write file drivers/usb/gadget/u_audio.c
error: git checkout-index: unable to write file drivers/usb/gadget/u_audio.h


Freed some disk space and re-ran the `git-pull`. But it failed saying

$ git pull
Updating ce8a742..faf80d6
error: Untracked working tree file 'Documentation/ABI/testing/sysfs-bus-pci-devices-cciss' would be overwritten by merge.


Some of the files were created by the previous pull, but they are considered untracked files as the previous pull failed. `git pull -f` didnt help as git was reluctant to delete my untracked files.

Deleting huge list of files one by one was a pain. I was thinking of doing a git status to get the list of untracked files and deleting them. But Jony rescued me by telling me about `git clean` which can delete all the untracked files!

But I would really like to see a way to pull/checkout and over-write the untracked files, so that other untracked files, which will not be over-written, need not be deleted. Is there a way to do it?

17 June 2009

White ignored in India?

Four coloured tri-colour flag. (நான்கு வண்ண மூவர்ணக்கொடி)



Is it because white is not considered as a colour?



No. The wheel is not considered!

It is composed of three colours with a meaning and a navy-blue wheel in the center. Mexico and Croatia also have tri-colour flags with more than 3 colours! See http://en.wikipedia.org/wiki/Tricolour

13 May 2009

Cloning multiple git repos

Many of the maintainers of linux-kernel maintain a git repository. I usually have clones of various such repositories.

For example I have clones of
Linus Torvalds's repo:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Block Maintainer, Jens Axboe's repo:
git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
...

If I do individual clones of all these repositories, it downloads and maintains duplicate copies of same objects wasting disk space, and network bandwidth.
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
git clone git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git

So I was looking for a way to share the common objects so that duplicate objects wont waste disk and network. And no surprise, git has a way to do that. Just that I was unaware of a simple option, "--reference".
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
git clone --reference linux-2.6/ git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git






Difference between cloning Jens' git with and without --reference to Linus's git.

# git clone git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
Initialized empty Git repository in /home/knikanth/labs-sw/linus/linux-2.6-block/.git/
remote: Counting objects: 1180249, done.
remote: Compressing objects: 100% (295444/295444), done.
remote: Total 1180249 (delta 984716), reused 1073684 (delta 878311)
Receiving objects: 100% (1180249/1180249), 289.32 MiB | 496 KiB/s, done.
Resolving deltas: 100% (984716/984716), done.
Checking out files: 100% (27842/27842), done.
# du -sh linux-2.6-block/
714M linux-2.6-block/


# git clone --reference linux-2.6/ git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
Initialized empty Git repository in /home/knikanth/labs-sw/linus/linux-2.6-block/.git/
remote: Counting objects: 111061, done.
remote: Compressing objects: 100% (19021/19021), done.
remote: Total 100463 (delta 84138), reused 95679 (delta 79959)
Receiving objects: 100% (100463/100463), 23.21 MiB | 1209 KiB/s, done.
Resolving deltas: 100% (84138/84138), completed with 8189 local objects.
Checking out files: 100% (27842/27842), done.
# du -sh linux-2.6-block/
468M linux-2.6-block/




--reference automatically sets up .git/objects/info/alternates to obtain objects from the reference repository. Now I wonder whether it is possible to have circular references, multiple references, etc.. The plural file name, "alternates" suggests it should be possible, but "git clone" ignores multiple --reference on the command line!

BTW git uses SHA-1 digests to identify objects. I wonder what is the chance of a SHA-1 collision and how git handles it? The SHA-1 digest has 40 Hex-digits == 160 bits.. So at most, only 2160 objects are possible. :-)

10 May 2009

Mother's day story

The story that disturbs me the most.

A monkey and its baby were caught in flood. The mother held its baby above the water level. Slowly the water level raised. Knee level, hip, chest, throat.. the monkey dropped its baby in the water and stood on top of it.

Thats why they are called monkeys.

14 April 2009

தமிழ் புத்தாண்டு நல்வாழ்த்துக்கள்

இந்த வருடம் முதல் தை முதல் தேதிதான் தமிழ் புத்தாண்டு. - வரலாற்றில் இடம் பெற துடிக்கும் கருணாநிதி

ஆனால் சித்திரை முதல் நாளும் அரசு விடுமுறை உண்டு. - வருடபிறப்பை மாற்றியது மக்களுக்கு தெரியாமல் அவர்களை பாதிக்காமல் பார்த்துக்கொள்ளும் கருணாநிதி

"சித்திரை முதல் நாள் சிறப்பு நிகழ்ச்சிகள்". - வருவாயை இழக்க விரும்பாத கலைஞர் தொலைக்காட்சி.

சன் டிவி: இரண்டு நாட்களுக்கு முன், "தமிழ் புத்தாண்டு சிறப்பு நிகழ்ச்சிகள்...". இன்று, "சன் தொலைக்காட்சி ஆண்டு விழா சிறப்பு நிகழ்ச்சிகள்..."

13 April 2009

ஒவ்வொரு செயலுக்கும் பலன் உண்டு - நியுட்டனின் மூன்றாம் விதி

ஒவ்வொரு செயலுக்கும் பலன் உண்டு

நம்மில் பலர் நாம் ஒரு விஷயம் நடந்தால் நன்றாக இருக்கும் என நினைத்தாலும், அது நடக்காது என நினைத்து நமக்கு பிடிக்காத விஷயங்களுக்கு துணை போய் கொண்டு இருக்கிறோம்.

உதாரணத்துக்கு தேர்தலில் நமக்கு ஒரு சுயேச்சை வேட்பாளரை பிடித்து இருந்தாலும் அவர் வெற்றிபெற வாய்பே இல்லை என நாமே தவறாக முடிவு செய்து, நாம் அவருக்கு வாக்களிப்பது வீண் எனவும் முடிவு செய்து, நமக்கு பிடிகாதவராய் இருப்பினும், வெற்றி வாய்ப்பு அதிகம் என நினைக்கும் நபர்களில் நமக்கு ஓரளவுக்கு பிடித்த அல்லது பிடிகாதவர்களிலேயே ஓரளவுக்கு பரவாயில்லை என நினைக்கும் நபருக்கு வாக்களிக்கிறோம். இல்லை வாக்களிகாமலேயே இருந்து விடுகிறோம். இதனால் உண்மையில் நாம் விரும்பிய சுயேட்சையே பலருக்கு பிடித்தவராக இருப்பினும் அவர் நமது பிரதிநிதியாக தேர்ந்தெடுக்கப்பட வாய்பே இல்லாமல் போய்விடுகிறது.

இத்தகைய தவறினை நாம் உடனடியாக நிறுத்த வேண்டும். அவர் இந்த தேர்தலில் வெற்றி பெற முடியாமல் போனாலும் அவர் பெரும் சில வாக்குகள் இவ்வாறு வெற்றி பெற வாய்ப்பில்லை என நினைத்து வேறு நபர்களுக்கு வாக்களித்தவர்கள் அடுத்த தேர்தலிலாவுது திருத்திக்கொள்ள உதவும். இந்த தேர்தலில் வெற்றிபெறாவிட்டாலும் அடுத்த தேர்தலில் அவர் வெற்றி பெற உதவும்.

எனவே தயவு செய்து உங்களுக்கு பிடித்தவர்களுக்கு வாக்களியுங்கள். வாக்களியுங்கள்.

01 April 2009

Type checking macros

#define to_cpumask(bitmap)                                              \
((struct cpumask *)(1 ? (bitmap) \
: (void *)sizeof(__check_is_bitmap(bitmap))))
static inline int __check_is_bitmap(const unsigned long *bitmap)
{
return 1;
}


The above macro is nothing but just
#define to_cpumask(bitmap) (struct cpumask *)(bitmap)

But it also does a compile-time checking that the parameter passed is of type
(const unsigned long *). If it is defined as an function all these ugly magic is not
needed. But a function cannot be used as a static initializer. Try declaring a variable,
static int a = printf("ok");
and one would get an error, "Initializer element is not constant".

I really wonder whether gcc might one day optimize out your type-checking call to the unused
function in tha above macro?! A solution could be providing an official gcc extension to assert types?!
Also the above code compiles fine without sizeof constification as well i.e., just return a void * from the
__check_is_bitmap() and remove the sizeof and casting.

I found the above code in the linux kernel. See http://lkml.org/lkml/2009/3/25/22
for the discussion. Even the ubiquitous printf, printk or any vararg code does not check for types. So
I wonder whether kernel developers need such tricky^Wugly code just for type checking, given that
the callers would likely read the definition of the macro as well. It is not a closed api.

Any other project uses such type-checking macros?

10 March 2009

Leanux - Running Linux on FAT just for fun

Most of the flash devices assume that fat is the only file-system. And there are plenty of electronic devices that run linux on fat. So just to know what it is to run linux on vfat, I tried it myself.

The openSUSE 11.1 installer wont allow you to partition the root as vfat. So I made 2 partitions, one ext3 and one vfat. Installed on ext3. Copied the whole partition to fat. I copied original files in place of symbolic links. Added vfat filesystem module to initrd . Modified grub boot from the fat partition with init=/bin/bash.

FAT's lack of support for posix file-permissions. was easy to overcome by mounting with all permissions to everyone, without users or noexec. It doesn't support symlinks, and special files. mknod will fail. But /dev is a tmpfs and it just copies the persistent files from /dev to the tmpfs on boot, instead of copying I created fresh device files in tmpfs. `mount` failed trying lock the file /etc/mtab. Mounting with -n worked. I guess plenty of things would fail if I try to run a proper desktop on FAT as it is.

I booted only to /bin/bash. When I tried doing a "exec init 1", it complained something like cannot remove /var/run/do_confirm. I didn't proceed further. This was a fun way to kill time while getting some insight of the booting process.

03 March 2009

Perceived Code-base quality

Recently one of my friend was re-orged from a open-source product to a proprietary project. He was complaining about the quality of the code-base, especially about using hard-coded paths and the likes.

I have also worked on different code-bases of different quality. And I feel that not being very confident about the quality helps at times. For example, say if you work on Linux Kernel and believe that the kernel code is of highest quality. When a bug is filed, you won't be confident of finding the bug in the kernel code. So one would look elsewhere like the setup or other layers or the application or wont even trust the bug-submitter.

Wouldn't a bug-hunter be happy and confident if he believes that there are lots of bugs in the code-forest to be hunted. But at the same time, if one is planning to do agriculture(more code changes, features, clean-ups etc...) in the same code-forest, one would be worried that his crops may be destroyed by some of those bugs lurking out there. But a software engineer should be a farmer who enjoys hunting as well.

Farmer + Hunter+... == Software Engineer. Happy code farming^Wcoding and bug-hunting.

p.s: Yes it is easy to hunt that single bug if the code-base is clean. But a bad code-base could be a nightmare for the hunter. He would be hunting various other bugs in search of one. But don't you like the thrill?

19 February 2009

Linux Nikanth News (2)

After I posted Linux Nikanth News, the next LWN weekly edition's kernel page has Andrew Mortans reply to me as part of the Quotes of the week.



I was at the receiving end from the master for not writing good patch description. And I do not seem to have learned from it! :(

p.s: Earlier by mistake all of my posts were syndicated in planetsuse. Now it has been changed to aggregate posts with a specific label. Hopefully this post wont show up anywhere else other than in my blog. If you are seeing this elsewhere, please leave a comment.

16 February 2009

Latest and greatest(untested)?!

Linus released
  • 2.6.24 on January 24th 2008,
  • 2.6.26 on July 13th, 2008, and
  • 2.6.27 on October 9 2008

Here is when it reached the users
  • Gentoo 2008.0 released on July 6, 2008 has linux 2.6.24 which was ~5.5 months old.

Distros used by power-users seems to be always running slightly older version compared to the distros aimed at the layman! Yeah, but power users^Wdevelopers use the unstable/development/factory/head version of their favourite distro and not the released stable. But Ubuntu stable(!) is based on debian unstable! And debian stable is so outdated. opensuse seems to be quiet the latest but not straight from the unstable development snapshot.

p.s: I use only opensuse regularly among these distros. So any mis-information and bias is likely. ;)

11 February 2009

Linux Nikanth News

I do not post many things related to computer science or what I do. So just to update some of my friends here are couple of LWN articles where I was mentioned.

I was mentioned for kreplace - hotpatching running kernel in Nov 24. And recently for the cgroup based oom killer controller Also note that both the projects were not merged in the Linus tree, at least not yet. ksplice is superior to kreplace and it seems to be on its way for inclusion, and user-space notification seems to be the preferred approach of oom killer control.

/me plans to blog more tech stuff soon

10 February 2009

War for wealth

Back then kings sacrificed lives for wealth in the name of war... The war for wealth continues... powerless front-line soldiers...

A stitch in time saves nine, but is it time? stitches before time reduces the value and beauty of the cloth... hmm.. it doesn't! As the current fad is to wear clothes full of stitches! The share-holders are asking for it :(

06 February 2009

Maths, Physics, Chemistry doubts

  1. There was a fire-emergency drill yesterday in my office and now I have a doubt, "What is the coldest possible flame? And how much heat does it produce and its temperature?" The flame froma welding equipment is definitely hotter than the flame from candle, So how to have a 1 square inch of visible flame with least amount of energy released. Will it be the material that can be ignited at a lowest temperature? hmm may be the material the material that would continue to burn in the lowest temperature... so what it is? How much is the temp?

  2. My roommate plays with Rubik cube a lot. And I saw an application that solves the rubik cube for your inputs. My question is what is the minimum no of faces required as input out of the total (9 x 6) 54 faces? Does the number change based on which faces?

  3. What is the largest number possible with two 9s? A question on a poster in my office.
  • 99
  • 9^9 (But isnt using operator allowed? But exponent can be written without operators as superscript i.e., 99)
  • 9!9! (But if you allow unary operators, I do not even need a second 9, i.e., ((9!)!)... == 9!!!!!!!!!!!!!
  • I think 99 could be the answer without any opertators, but I would say it is a number with base-googol or may be base-infinity ;) [In base-infinity 99 would mean 9*infinity+9]
Please tell me whatever you think could be the answer.

02 February 2009

dot dot dot...

Some random thoughts... don't think logically and connect them.
  • Killing oneself is a crime.
  • Protesting in public without permission and disturbing the public is a crime.
  • Giving money is either a form of encouragement and acknowledging one's good work. Or it can be an aid, in case some one was unluckily affected, not due to a mistake of his own, but say by a natural calamity.
  • M Karunanidhi gives 2 Lakh INR from people's money, to the person who committed suicide in front of a Government office to protest an issue in our neighboring country.
  • Several other people are trying to commit suicide after the first one successfully killed himself to show their protest for war in Srilanka.
  • Tamil Srilankans in Jafna are protesting against LTTE, not their Government.
  • Connect the dots is a kid's fun way to learn drawing, where they connect the dots to get the whole picture. Adults do not usually enjoy them.

30 January 2009

Bad ECOnomy

One of my friend was making a comment that, "I am buying a motorcycle when many people are getting pink slips.." Jokingly I commented, "It is said that, not spending during a bad economy would worsen the situation, and people should spend, which would make businesses prosper and economy would get better"

But this made me think about the prevalence of the pink-slip fear. I know some of my friends who are afraid of being laid-off and hence they work 24 hours doing almost 2+ person work a day, to make them valuable for the company. But the net effect is everyone does 2 people's work and the management would find that only half the number of people are enough. So they would cut the workforce!!! And most of the people who worked like a donkey to shield themselves from lay-off, would be laid-off...

Moral of the story: Prevention is better than cure, but make sure your prevention measures cannot be multiplied by a negative number.

27 January 2009

carom: one-sided game

One-sided game could mean something different in some games! In carom, it could mean that all the coins are all in one side of the board!

And yes, one-sided games in carom have high probability of becoming one-sided games! :)

26 January 2009

oneway - ஒரு வழிப்பாதை

one - ஒரு
way - வழி
way - பாதை

??

way = வழி
way = direction, path
வழி != direction

way = திசை
ஒரு திசை பாதை ?

?!

hmmm may be
இரு வழிப்பாதை = 2 -lane road
ஒரு வழிப்பாதை = single lane road??

Marriage ceremony

அந்த நாள் வரை யார் காலிலும் விழாதவர்களை, மாற்றி மாற்றி பலர் காலில் விழ செய்து... No one is independent என உணர்த்தும் நாள்

---
This was written on 26th Jan 2009, but was not published. It is still interesting after 10 months for me, when I read it today.

09 January 2009