Sunday, April 27, 2008

Knuth's recent interview

Andrew Binstock recently interviewed Knuth. I would highly recommend reading the interview. It was really sad to find out that Knuth has been diagnosed with Prostate Cancer, but here are some my favourite quotations from the interview

"The success of open source code is perhaps the only thing in the computer field that hasn’t surprised me during the past several decades. But it still hasn’t reached its full potential; I believe that open-source programs will begin to be completely dominant as the economy moves more and more from products towards services, and as more and more volunteers arise to improve the code

For example, open-source code can produce thousands of binaries, tuned perfectly to the configurations of individual users, whereas commercial software usually will exist in only a few versions. A generic binary executable file must include things like inefficient "sync" instructions that are totally inappropriate for many installations; such wastage goes away when the source code is highly configurable. This should be a huge win for open source.

Yet I think that a few programs, such as Adobe Photoshop, will always be superior to competitors like the Gimp—for some reason, I really don’t know why! I’m quite willing to pay good money for really good software, if I believe that it has been produced by the best programmers."

"I might as well flame a bit about my personal unhappiness with the current trend toward multicore architecture. To me, it looks more or less like the hardware designers have run out of ideas, and that they’re trying to pass the blame for the future demise of Moore’s Law to the software writers by giving us machines that work faster only on a few key benchmarks! I won’t be surprised at all if the whole multithreading idea turns out to be a flop, worse than the "Titanium" approach that was supposed to be so terrific—until it turned out that the wished-for compilers were basically impossible to write."

"The machine I use today has dual processors. I get to use them both only when I’m running two independent jobs at the same time; that’s nice, but it happens only a few minutes every week. If I had four processors, or eight, or more, I still wouldn’t be any better off, considering the kind of work I do—even though I’m using my computer almost every day during most of the day.

So why should I be so happy about the future that hardware vendors promise? They think a magic bullet will come along to make multicores speed up my kind of work; I think it’s a pipe dream. (No—that’s the wrong metaphor! "Pipelines" actually work for me, but threads don’t. Maybe the word I want is "bubble.") From the opposite point of view, I do grant that web browsing probably will get better with multicores"

"On a positive note, I’ve been pleased to discover that the conventions of CWEB are already standard equipment within preinstalled software such as Makefiles, when I get off-the-shelf Linux these days."

"I currently use Ubuntu Linux, on a standalone laptop—it has no Internet connection. I occasionally carry flash memory drives between this machine and the Macs that I use for network surfing and graphics; but I trust my family jewels only to Linux. Incidentally, with Linux I much prefer the keyboard focus that I can get with classic FVWM to the GNOME and KDE environments that other people seem to like better. To each his own."

"let me just say that almost everything I’ve ever heard associated with the term "extreme programming" sounds like exactly the wrong way to go...with one exception. The exception is the idea of working in teams and reading each other’s code. That idea is crucial, and it might even mask out all the terrible aspects of extreme programming that alarm me."

"I also must confess to a strong bias against the fashion for reusable code. To me, "re-editable code" is much, much better than an untouchable black box or toolkit. I could go on and on about this. If you’re totally convinced that reusable code is wonderful, I probably won’t be able to sway you anyway, but you’ll never convince me that reusable code isn’t mostly a menace."

Saturday, April 12, 2008

Atomic access

I was involved in a set of emails exchanged about per CPU data and atomic access. The argument was basically this

"If you access 64 bit data on a 32 bit machine, what part of the access is atomic?". One would assume that with per-CPU data, it is safe to read the data from a different CPU". The answer lies hidden in the processor architecture. Several RISC architectures require certain types of data to be aligned to specific boundaries (this in turn ensures that the access is atomic). Usually processor manuals suggest that data that is contained within a single cache line is likely to be fetched atomically. Ideally, it is recommended that the data be aligned to the boundary of it's size, so that access is atomic. To explain that further

16 bit data be aligned to a 16 bit boundary
32 bit data be aligned to a 32 bit boundary
64 bit data be aligned to a 64 bit boundary

So the next time you think of atomic access, data sizes, per CPU data, look at your processor manual and determine if the data needs to be protected when accessed from a different CPU.

Wednesday, April 02, 2008

RSS feed is fixed

The RSS feed has been changed to export full content instead of the earlier partial content. The blog should be easier and more fun to read with an RSS reader now.

Feeling left out of the software world

It seems to me that there is a hard barrier between the software development world and the systems programming world. I feel left out of the developments in software that have taken the world over. Agile/Lean programming, EJB, J2EE, .NET, .NET Remoting, JSP, JSTL, Web containers, EJB, MVC, Spring, OpenID, SSO, Indigo, WCF, WPF, Aspect Oriented Programming, Web services, CSS, XML, XSLT, XQuery, ADO, LINQ, AJAX, RSS, RDF, etc. are keywords I hear everyday from my other friends everyday and wonder where I've been while the world has been changing so dramatically?

In retrospect, I've been working on concepts that were quite well understood in the 60's and 70's - Virtualization, Resource Management, Processes, Threads, etc. Concurrency is very interesting, specially due to multi-core now being ubiquitous. My TODO list looks very dull - Python, Algorithms, Architecture of so and so processor, etc.

It seems like there is a hard barrier that prevents people stuck in systems from working in the layer above. I feel left and cut-out from the innovation in the application space. While, I am still finishing up on the basic design patterns, the world has already moved on to domain specific patterns. I do feel lost, but there is hope. Hope that someday, I'll take a look on the other side, where the grass seems greener; jump the fence; make sense of the new world; the world that seems to be moving at a rapid pace.

Ranking and Unranking permutations

I've been a big fan of Skiena's Algorithm Design Manual , I recently found my first edition of the book (although I own the third ed...