Affinity for processors

My old roommate comes visting yesterday and we have a technical discussion with exchange of technologies we’ve been experiencing.

So there is this taskset command on Linux which you can use to actually move a process to a particular CPU on your system. Thing is, these guys are using an OS called SixWind (also WindRiver) that is used to run on one out of the two cores on their machine. The other core is used to run other binaries which include their customized application and anything else that is needed. Essentially, the OS runs separately against the application helping maximum usage of resources.

Now I tried doing a taskset on my dual core CPU (in my lappy), for a process (a small executable having an infinite while loop). Turns out that the process at first instance doesn’t get allocated to the CPU. My roommate couldn’t figure out the anomaly here and left. I kept on to it cuz the possibilities were limitless. I kept on doing additional things, killing the process and experimenting with larger processes and real world applications – like Thunderbird and Firefox. Eventually, I figure out that it really won’t matter if I set the affinity of one process onto one CPU or the other. How it started to work was when I went into super user mode and started switching affinity for some of the k* processes. The whole thing crashed and I was glad.

I was more careful next time and started off with setting affinity for kswapd (which is seldom working). Then I wrote a bunch of programs (using some virtual memory code from here) and managed to see how kswapd was working very well on just cpu#1. There’s still some performance to be tested, but I guess that helped me in getting to a point where I could see that when I let Thunderbird compact folders and ran test programs, things were better than wehn there was no affinity.