Old Love
No, I am not talking about Eric Clapton’s song or Jeffery Archer’s senti short story.
I am refering to Number Theory, a subject which I have liked and aced since my high school upto my engineering. We had Number Theory and Cryptography as an elective and it was one of the most challenging papers I have written till date. And the most interesting one too.
But sadly for the past two years, I have been out of touch.
So, this friday when I was at Sapna book house , and I couldn’t help noticing this book.

Bought it off and am going through the book now. Brings back the sweet old memories of the well-lit room in the 8th Block hostel room, with Shuaib crumpled on the bed going through the faded xerox material, Vaiju on the floor, me on the table and Madhu on the other bed, all of us trying to solve some assignment problem on primitive roots. And the excitement when one of us found a solution or even understood a complicated theorem. And the pride in explaining how the thing works!
Ah, well! Those were the days ![]()
Cause and Effect
While working on idle power management, I used vaidy’s klog based patches to profile an idle system to obtain stats such as:
* The time when a cpu enters into the tickless idle mode
* The various interrupts that bring the cpu out of idle state.
* The timers that expire in this interval and cause a wake up.
* The tasks that demand/ or are made to be wake up on the idle cpu.
* The time when the cpu comes out of the tickless idle mode and starts executing the tasks.
While observing the task wakeup instrumentation data, I noticed that the wakeup statistics for kondemand appeared pretty strange. For the uninitiated, kondemand is a kernel thread that belongs to the ondemand governor of cpufreq subsystem, which changes the p-states of the system, based on the utilization statistics. Thus it’s something that helps in power management.
root@llm43 tests]# ps aux | grep kondemand | head -4
root 1143 0.0 0.0 0 0 ? S< 09:21 0:00 [kondemand/0]
root 1145 0.0 0.0 0 0 ? S< 09:21 0:00 [kondemand/1]
root 1146 0.0 0.0 0 0 ? S< 09:21 0:00 [kondemand/2]
root 1147 0.0 0.0 0 0 ? S< 09:21 0:00 [kondemand/3]
From the file wakeups.txt, an output of my profiling experiment,
pid cpu nr_wakeups
————————–
1143 0 468
1145 1 279
1146 2 78
1147 3 68
Couple of things bothered me here.
- The unusually high number of wakeups on CPU0 and CPU1. kondemand was wakeing up approximately at the rate of 4 time and 2 times respectively on these cpu’s over a observation idle period of 120 seconds.
- The difference in the number of wakeups by kondemand on the different CPUs.
Bewildered, I fired a mail to Venki asking for possible explanations.
And I started looking at the code. Now, the number of times the kondemand thread is supposed to check for a change in the frequency is determined by this sysfs tunable called sampling_rate. It was set to 256000us on my system. Which accounted for the unusually high number of wakeups on the CPUs.
But I was still confused. The sampling_rate is a global tunable which maps to the variable dbs_tuners_ins.sampling rate, which is common to all the kondemand threads. Then why the different wakeup rates on different CPUs?
Venki replied to my original query reminding me that kondemand uses deferrable timers! That explained everything.
Deferrable timers, behave normally on a busy system. But on a idle system, when are about to decide when should we wake up next inorder to service the next timer in the list, we skip any deferrable timer we encounter.Thus, a deferrable timer on an idle cpu would expire when the next nearest *hard* timer would expire.
So, the reason why CPU0 and CPU1 were having such high number of wake ups on an idle system can be accounted to the fact the expiry of some other timer like the ehci_watchdog would trigger the expiry of kondemand timer, and along with it the wakeup of the kondemand thread! And depending on the number of timers that are queued on different CPUs, we have the corresponding number of wakeups of kondemand thread!
So, what I was thinking to be the major cause for wakeups in the kernel, turned out to be an effect of the expiring timers queued by a totally unrelated subsystem, thus confirming the old wisdom of mathematical logic: “If two events occur one after the other, it doesn’t necessarily imply that one is the cause for the other”
OLS Paper and BOFS proposal Selected!
Opening Mood: Hungry..
Opening song: Hamesha tum ko chaaya - Devdas
Got the official mail today morning. The “Power Aware Scheduler” Birds of Feathers Session Proposal that I had submitted for this year’s Ottawa Linux Symposium has been accepted. The rest of the BOFS can be found –> here
A couple of days back, Vaidy got confirmation that the paper “Energy-aware task and interrupt management in Linux” of which I am a co-author, has been selected! So it’s great news on the work front!!
The rest of the papers for this year’s OLS can be found –> here
OT, it has been a pretty silent day in my mailbox. I was wondering if everyone decided to take a mass-vacation or something! Only later I came to know that vger.kernel.org is down.
With only a few weeks left to turn in the paper, we should start writing soon! The data is pretty much there with the many experiments that Vaidy has been running for quite some time now.
And me, I am have started using qgit to track the CFS development from it’s inception to it’s present magnificent form! The latest qgit-4 which uses qt-4 looks pretty cool! Much better than the earlier 1.5.5 version
Until next time,
Ciao!
Closing Song: Laree Chooti - Xulfi, Ek-Chaalis ki last local
Closing Mood: Really hungry!
FOSS.in Day 5 (The Last Day)
Opening Mood: Good Morning.
Opening Song: Boondein - Silk Route
The last and final Day of FOSS.in had some really interesting talks.
I missed the talk by Andrew Cowie, since we reached the venue pretty late. However, I managed to catch the next talk by Ulrich Drepper, the person whose article on Memory management I thought was brilliant. The talk was on “Contributing to Linux Runtime”. One of the interesting things that Ulrich mentioned was that he is looking for a new malloc implementation, one which is NUMA aware. This would really be a nice thing to work on, but I hope even applications understand the concept of NUMA so that they don’t move the threads around from one node to another.
After the lunch, we had Rusty’s talk on Talloc. Talloc stands for Tridge-Allocator, or Tree-Allocator is a hierarchial memory allocator which can be a really useful thing to prevents memory leaks owing to the programmer’s forgetfulness. There were about 150 people in a hall whose capacity was 120. I sneaked into the projector room to catch that talk and got into the hall only for the Q & A session ( I won one of those caramello koalas!). You can find the Talloc details here –> http://talloc.samba.org/
I chose to attend Amit Shah’s KVM talk over Thomas’s Real-time talk. I was hoping to see some meaty details about the KVM way of doing virtualization. But unfortunately most people in the audience had problems visualizing virtualization in the first place. So it ended up as a demo session. I guess, since the code is available, I will have to just go over it.
The concluding ceremony had “Rusty and a Merry Band of FOSS hackers” (Doesn’t that remind you of some rebel group in some corner of the Sherwood forest?) talking to the audience and sharing their experiences with open source. He showed us how easy it was for anyone to go ahead and contribute to open source projects, by asking one of the volunteers to come over and send a Documentation patch for lguest. You can find that here –> http://lkml.org/lkml/2007/12/8/49
I had to leave early to help prepare for Sunday’s barbecue. That however is another story for some other time
Closing Song: Village Damsel - Indian Ocean.
Closing Mood: Power Aware!
Repressed and Rebels
Opening Mood: Good Morning, and I’m still grumpy
Opening Song: None.
I saw him at the coffee house yesterday. It’s been more than a year since we last met. He hasn’t changed a bit. Dressed in a loose T-shirt and a pair of faded jeans, he looked casual as ever. He saw me and the next moment, he was at my table. So typical of him, I thought!
“Wassup dude! Howz life? How’s that Linux thing of yours goin on?” , he asked.
I told him about my work, and the interesting stuff that was happening there. He listened to all of it with great interest.
“So, it’s not t O(1) anymore, eh?! Nice. Will check that out sometime.” He said.
I asked him about his work, and life.
“Going on! I am enjoying it. Nothing to do with what we studied back in college. But doing good.”
I felt happy for him. Finally the chap had found something which has managed to hold his attention for this long. Good for him!
“I’ll be quitting next week. There’s this other cool thing I read about the other day. Will be working on it!”
I guess he loved the expression on my face, when he said that. Because he gave me that wicked smile.I asked him if he had any definite plan about this other thing.
“Nope! It’s still in a very nascent stage. Will fiddle with it for a while.”
I really couldn’t believe it!
This is one of those people who has real potential to change the world. Instead of realizing it, here he was “Wandering! Yup, that I am. And I like it. I feel extremely light.”
Fear of the C-word?, I asked him.
“Not at all! It’s just the futility of commitment. I don’t see the point in it. Simply cannot understand how can I make a promise to accomplish something, when there may be thousands of interesting things on the way. I can’t just ‘let-go’ of these things. I will be interested in stopping and having a look around. And may be, one of these things’ll drive me on a different path, which may never meet the first one. And, I don’t wanna keep anyone waiting for me!”
I gave a puzzled look that demanded further explanation.
“Dude, I don’t want to be defined by some one thing that I do in life. I’ve seen it happen before. You show your interest in something, and people around you create an image, associating you with that thing. And in course of time, you yourself accept that image, and feed it further. One fine day, when you discover something else which is “fun”, the same people tell you that the “fun” thing doesn’t fit your image or it’s extrapolations. And thus, you automatically become a member of the society’s “Repressed or Rebels Club”. The moment you let something define you, you are enslaved by an obligation to do well in that. Sometimes it happens without your knowledge. And you start thinking - ‘But this is what I wanted to do all the while! So I should be happy.’ Just that my idea of happiness isn’t preceded by conditionals.”
I started laughing. I understood what he was talking about. I got up. This meeting was over.
He was still sitting there, smiling.
I paid our bill, picked up my stuff, plugged in my iPod and bid him adieu. Led Zep’s voice filled my brain.
Stairway to the heaven. Man, people sure *do* wanna buy that thing! I started walking back home.
Yes there are two paths you can go by, but in the long run.
There’s still time to change the road you’re on.
Closing Song: None.
Closing Mood: Wide awake.
IIITB
Opening Mood: Chillout and relaxed. NZ cruising along against Canada.
Opening Song: Dooba Dooba - Silk Route
Time: 9:15 P.M, 22nd March 2007.
I visited Indian Institute Of Information Technology Bangalore (IIITB) today to deliver a lecture on “Kernel Synchronization Primitives”. This being my first official technical lecture, I was quite anxious asto how it would turn out. Turned out to be pretty good. But more on that later.
The IIITB campus is situated in Electronics City, a prominent IT tech-park in Bangalore. That’s quite a distance from the place where I stay. So I had to start pretty early in the morning. I travelled to Madivala Bus stand, where I boarded the 8 A.M 356C Volvo bus. I thought it might take me an hour or so to reach Electronic City through the busy and dusty Hosur Road. But to my surprise, the volvo reached Electronic City at 8:30. That was pretty early since my lecture was scheduled at 10.AM. So much for all the cautious advice given by my office folks.
Anyway, IIITB is just a ten minute walk from the main entrance to Electronic City. As I entered the campus, the security guard stopped me. I guess he mistook me for a student without an ID! Gah! I had to explain, that I was here to deliver a lecture and not to attend one
At the reception I found Babita, a 2nd Semester student was waiting for me. I was led into a conference room, where I spent some time checking my mails and chatting with the students. Surprisingly, even IIITB has the static IP scheme. I don’t realize why universities prefer static IP addresses instead of opting for DHCP. First at NITK and now IIITB.
I was escorted to the lecture hall at 9:45. And I must admit, I am very much impressed with the design of the hall. Around 120 students can be accomodated in the lecture hall. They have a control room from which all the projectors and the microphones can be controlled. There were five screens in total. Two of them were projecting my Thinkpad screen. There was a SmartBoard which really impressed me. Hats off to the inventor, whoever it is.
It’s nothing more tha a big touchscreen board connected to a laptop using a USB cable. The laptop has to run the Smartnotes software, whose image was projected on the touch screen. So you write anything on the touch screen, it transmits the points of contact over the USB cable into the laptop, and the SmartNotes software maps the point of contact onto the laptop screen, thereby actually “drawing” what you drew on the touchscreen. And that’s projected back on the touchscreen, giving the effect that you’re actually drawing something on the touchscreen! A very neat concept if you ask me. There’s more to it. You need not erase everytime you have filled up the screen. You just click to go to a new page! The students don’t need to take down the notes as each of “pages” on the screen can be saved as a jpeg/pdf file and mailed to the students. That’s one smart use of technology as a teaching aid.
I started the talk at 10:00 A.M sharp and the hall was pretty much filled up. I hope it wasn’t due to the attendence constraints because of which I used to attend most of the seminars in my college days! At 11, we took a 10 minute break and the second part of the lecture went upto 12:15. I know, I know, I overshot but this is Synchronization - a topic on which I can go on and on for hours. I could find quite a few interested faces among the crowd. And there were a few interesting queries as well.
I am extremely glad that Dr.Shrisha Rao, my host at IIITB is organising talks by the industry folks on the subjects which the students are currently studying. This would definitely give them an insight into the relavence of what they learn in computer science theory.
By the way, after the lecture got over, the students gave me a cool IIITB T-shirt as a memento. Now, how cool is that?!
I am looking forward to more such opportunities. After all, as the great VishwaKnuth once said, “Kutching is my birthright”
Closing Song: O Sanam - Lucky Ali.
Closing Mood: NZ could have done better. But not bad.