Do All, Pick One

Not too long ago, we had machines of different kinds -- each for a specific purpose. There were the big printing machines to print books, there were typewriters or "compact printing machines", cyclostyle machines for making copies, slide rules for doing calculations, files, ledgers, library "index" shelves, films, photo processing studio... one could go on and on.

Most of these have been replaced by one thing -- the computer.

Till the mid twentieth century, machines were always custom built for a specific purpose. But sometime in the late 1940s a new notion began to take root -- that of stored program computing. The main idea here is to go "meta" -- build one machine that could do act like several other machines, depending on what it is "told" to do.

This was not as novel as it sounds. Mathematicians had already been talking about going meta for several decades by that time. And indeed there were some machines which were "programmable". Textile looms for example.

But it was only with the advent of the "stored program computing machine" attributed to John von Neumann, the current day computer really took shape. Stored program computing has changed engineering so much so, that it was singularly responsible for the birth of an entirely new field: software.

Software is an intangible entity that we cannot see, touch, hear or feel in action. Yet, it controls our money, our entertainment, our knowledge and our lives.

So what makes a machine support software? You certainly cannot make your old bicycle (which is a machine) run a piece of C code. We also cannot make out room light and fan run code even though they run on electricity, just like a computer.

How does a computer "change its circuits" in response to what it is commanded to do? How does a machine that was wired to perform numerical computations, suddenly start showing a movie and do word processing?

The secret here is an extremely interesting and intriguing phenomenon, that we somehow seem to take for granted and never sit back and observe. This is what I call the "Do All, Pick One" algorithm.

The basic idea behind how a microprocessor can change its circuitry in response to its commands is based on this. The "rewiring" of circuitry takes place in the "Arithmetic and Logic Unit" (ALU) of a microprocessor. Each ALU is built to support a basic set of arithmetic operations like Add, Subtract, etc. and a basic set of logical operations like AND, OR, NOT, etc.

When a piece of instruction is loaded from memory into the processor, it is sent to a "decoder" that has one line each for every operation that is supported by the microprocessor. The decoder determines which operation is the instruction referring to, and switches on only that line (set it to logical 1) and switches all other lines off (set to logical 0).

Now comes the best part. The ALU meanwhile takes the data that needs to be processed and runs it through all the instructions in its instruction set! Each such execution gives out a result, which are then paired with the output lines of the decoder. Then, only that result is sent out, whose line has been switched on! Every other result is stopped in its tracks.

Hence, if your processor supports arithmetic operations like: ADD, SUBTRACT, MULTIPLY, LEFT-SHIFT and RIGHT-SHIFT; and your instructions ask the processor to perform an ADD, it actually performs all of the above! But only ADD is chosen to pass through the exit!

This neat little trick of "Do All, Pick One" enables the machine to become so flexible that it can now be "programmed" giving it such power that it sets serious directions of research, like asking "Can Machines Think" or will robots take over the world from us?

~*~*~*~*~*~*~

Whenever we think that we have invented something, nature would have invariably beat us to it by millions of years. And it is true of the "Do All, Pick One" algorithm too. Nature has been using this for eons and eons.

Machines of nature -- also called living beings, are built on principles very different from the machines that humans build. Ever notice that while we say "Don't reinvent the wheel" when it comes to machines, nature does not seem to use wheels at all? Animals don't run on wheels, they don't require highways, birds don't have engines and don't require runways. There are no turboprop birds and no jet birds. In fact, nature's pump -- the heart -- seems to be so strangely inefficient. It does not have a rotor or a jet. It works by the "primitive" method of contracting and expanding.

So what is happening here?

Well, nature's machines are not built from custom parts. Our building blocks are not components like spark plugs, crank shaft, etc. Look inside a womb when a new baby is being born, and it is definitely not the case that the organs, bones and limbs are built separately and assembled together. The entire baby is born right from inception! And it just "develops" and "grows". One fine day it grows big enough to come out of the womb, another fine day, it grows big enough to go to school and yet another fine day it grows big enough to ask for pocket money!

So what does it have to do with "Do all, Pick One"?

Machines of nature -- living beings -- are built by basic building blocks called "cells" -- each of which is a living being in itself. Recursive? Well, I think.. Maybe..

Each cell is an "autonomous agent" capable of not only doing a set of things, but also taking care of itself. That is, it is not just a processor with some arithmetic and logic capability; but it also has the requisite code to do what it takes to keep itself alive for as long as possible. It is a computing, self-regulating system capable of mechanical tasks and locomotion.

As part of their quest to keep themselves alive, cells collaborate and compete with one another. In this process of collaboration and competition, cells take on different roles. Some go on to become muscles. Some go on to become nerves. Some go on to become tissues. Some take care of the heart. Some take care of the brain. Some manages our legs. Some build bones and maintain them.

Not very different from a human society comprising of engineers, lawyers, doctors, accountants, artisans, painters, drivers, teachers, etc.

A cell, when it is born, is "multipotent". It has the capability to become anything, and it picks one. It can do all, but it picks one.

Go deeper inside a cell and into the genes and there is a "Do All, Pick One" game happening even there. Our genes contain certain "encodings" of our properties. Some properties are pretty clear and stable. Each human for example, should have a heart, lungs, liver, intestine, eyes, ears, tongue, etc. whose properties are fairly stable.

But certain other properties are not that stable. For instance, what "temperament" does a new born ought to have? Should the organism be optimized for physical tasks, artistic tasks, computational tasks, or what?

Well, guess what. Let's give everything to the organism. But have a circuitry to "choose one". This is what genes seem to say..

We have genes for a whole lot of our characteristics most of which are "suppressed" and only a few which are "expressed." When we are born, some choosing circuitry is created that determines which of the characteristics ought to be expressed and which ought to be suppressed. This choosing circuitry is determined by the signals given by the larger organism (the mother) in which all this is taking place. This gives credence to the folk wisdom that mothers who are expecting babies ought to be taken care of, both physically and emotionally. A stressed out mother gives implicit signals to the offspring to express characteristics relevant in high-stress situations, making the offspring have an overtly aggressive or defensive temperament.

Our basic circuitry for "pick one" is embedded in our firmware, so to speak, and most of us lead our entire lives blissfully unaware of its existence. Sometimes however, either due to external pressures or internal exploration, some of us discover characteristics within ourselves that we never knew existed in the first place! That is when we "discover ourselves" and come out saying "I never knew I had it in me" and so on..

At bigger scales, doing and picking that happens in the daily life of a diverse, democratic society is what makes them so resilient. And on places like Wikipedia, the doing (writing) and picking (editing and fighting it out on the discussion pages), is what helped create the world's largest encyclopedia without any contributor being paid anything.

While at the level of a microprocessor, the "picking" is a binary operation (either choose or discard), and higher levels of granularity, the "picking" operation is a matter of degree. For those who know Game Theory, it is somewhat like the difference between a pure strategy and a mixed strategy. But the basic algorithm is the same: Do All, Pick One (even if in the form of a probability distribution).

Comments

sandeep said…
So you are saying - "Jack of all - Master of One"
Well nature seems to work that way. But note that I'm not *prescribing* anything in this post.. Only observing this phenomenon to be at the core of any kind of flexible design..
Akilan said…
A little doubt: If processor actually executes all the instructions and then filters out result pertaining to only asked operation, then how come different operations take different times? Shouldn't all operations take same time which is the time of slowest instruction?
Different operations take different times because of the different number of cycles required to execute the entire operation.

The do-all-pick-one happens at the most fundamental level involving operations of the same kind. For instance, a binary and a unary operation cannot be computed with this method. All unary operations are computed together and one of them is chosen, as is the case with all binary operators.

Popular posts from this blog

Understanding Saturation and Stagnation

Fighting inner demons

The Web and Dharma