Saturday, October 8, 2005

The multi-threaded brain

Research now shows that the brain is like a multiprocessor computer. In a multiprocessor machine, there are multiple processing unit with shared memory for communication. Each processing unit typically handles a 'thread' of control. The human brain is quite similar in architecture. Imagine the brain to be organized into multiple processing or functional units, each handling a separate function. Language processing, writing, auditory processing, image processing, emotional balance, aggression and fear are some of the functions. It also has a huge amount of short, medium and long term memory that is shared by all these areas in the brain.

It turns out that the brain can handle parallel tasks if these tasks are processed by different areas. For example, walking and chewing gum, listening to music and physical work, etc can be easily handled parallely. However, if we are talking on the phone and taking a note, we can't really concentrate on either, as both are handled by the language processing area in the brain.

So, the brain is a parallel processing engine where individual processing elements are inherently serial. Context switching between tasks, like reading and mathematics, is quite expensive for the brain, as both these tasks are handled by the same area, or processing element. It has been experimentally shown, that multitasking of similar tasks actually reduces efficiency by a considerable amount. Strangely enough, if the tasks are dissimilar, parallelizing them actually increases efficiency. Many students claim that listening to music helps them concentrate on their work (much to the annoyance of their parents).
This is now shown to hold water and is due to the fact that the background task actually serves to block out other distractions! In short it keeps the idle processing elements occupied which would otherwise jump to process every interruption.

Given these basic structural and functional properties of the brain, we can talk about the evolution that has taken place in the multitasking hardware. People from a generation or two back had a lot fewer interrupts to process. In contrast, this generation has an explosive number of interrupts coming in per unit time.
Hundreds of channels on cable, instant messaging, the internet in all it's glory, cell phones, IPods, super-complex video games and other human (and inhuman) distractions are available to us at the drop of a hat.

More research in this area of multitasking has shown that the current generation can actually multi-task with higher efficiency. My parents (and other members of that generation) can't even begin to imagine me simultaneously chatting with 4 friends, replying to email, talking on the phone (or listening to music), writing a design document and churning up some code. They completely lose their train of thought if they are interrupted. I (and other members of this generation) can multitask
all these tasks quite efficiency.

This implies that the brain has evolved from a serial, heavyweight process architecture to a time shared lightweight process (threading) architecture in a short time. Just as in computers, context switching for thought processes is very heavy, causing the brain to reel under the sudden load, in turn causing the train of thought to depart without you onboard! In contrast, threads of thought have very small switching time, allowing a plethora of similar tasks to be handled simultaneously by the brain. The interesting question here is -- What has changed in the brain in these last 2-3 decades?

Some years ago, brain experts thought that the brain can change only upto a certain age, after which it freezes and there is no further change. We now know that the brain is surprisingly plastic and can change at any age. However, changes are quick to take place in childhood, till early adulthood, after which it takes increasing effort to change the internal circuits of the brain. This explains why people today are more efficient at multitasking, and why the generation to come will be even more so.

This generation was exposed to a whole arsenal of distractions in their childhood, and the brain seems to have adapted its circuits to make task-switching lighter and more efficient. The coming generation will have even more distractions to handle, and will have better hardware support for even faster context-switching.

An open question today is how the brain actually handles the hyper-threading. The computer science answer to hyperthreading is the use of shared memory. This neat technique makes it possible for threads to reside in the same address space while having independent execution existences. Does the brain employ a similar strategy? Does it have a fast shared memory cache in each processing area specially to save state quickly when switching between thoughts? How does it use synchronization and locking on this memory to avoid hairy hazards and dangerous deadlocks? Do the neural pathways actually form parallel circuits? Or is it that the brain has a more sophisticated interrupt-controller-dispatcher circuitry? These are all unanswered questions, as of today.

Multitasking has become an essential part of our lives. Driving to work involves processing numerous interrupts. Watching the road, looking at road signs (and other attractions), flipping through the radio stations or CD tracks, talking on the cell-phone, using finger sign language, etc. Watching TV is a classic example of time-slicing. I can usually watch 3-5 shows simultaneously (at least till they didn't have synchronized commercial breaks!) and mentally switch between each story line quickly. My aunt on the other hand gets hopelessly confused and hates it when I switch back and forth! Of course, working on the computer with instant messengers popping up small windows, programs asking "Are you sure you want to format your hard drive?", email notifiers, Skype "ringing" and other applications adding their own "bells and whistles" to this digital cacophony is quite a concerto of distractions.

While multitasking is definitely improving our ability to make simultaneous progress with several tasks, we are also losing the art of sitting down and thinking through a single concept. Concentration on one task is now considered boring. We are going wide with a larger number of tasks but our ability of going deep is sinking deeper into oblivion. With this ability to multithread thoughts, we can cover a lot of ground but lose efficiency in each individual task.
As a result, Attention Deficit Disorder (ADD) cases are growing each year.

I would really like to finish this blog entry with a witty ending, but I have my Project Manager on the phone, 4 friends in the middle of a chat, 200 new emails in my inbox fighting for attention, a PowerPoint(TM) presentation under construction, the Season Finale of Friends and the series premiere of Whose Line is it Anyway?, my nose itching and my mom lecturing me on the virtues of concentration. That's one too many. My brain is now officially thrashing!

--Sandeep Ranade

Glossary

multi-threading:
A form of parallelism where multiple threads run concurrently and communicate via shared memory.
multiprocessor: A parallel computer in which the processors share an address space.
context switch:
A context switch is the computing process of storing and restoring the state of a CPU (the context) such that multiple processes can share a single CPU resource.
process:
A program that is running. Usually much more expensive than a thread
thread:
A thread is a processor activity in a process. The same process can have multiple threads. Those threads share the process address space and can therefore share data.
hazard:
In computer architecture, a hazard is a potential problem that can happen in a pipelined processor.
deadlock:
The condition in multithreaded systems in which two or more processes are blocked, each waiting for a lock held by the other.
interrupt:
a signal from a device which typically results in a context switch: that is, the processor sets aside what it's doing and does something else.
thrashing: An excessive amount of disk activity in a virtual memory system, to the point where the system is spending all its time swapping pages in and out of memory, and no time executing the application. Thrashing can be caused the swap file is too small, when there is insufficient memory or when too many applications are hogging system memory.

4 comments:

  1. Likhan far chaan vatle mhanun ek choota sa comment takla.....


    khoop sahi lihle ahes...

    tuza mitra

    abhijeet sane

    ReplyDelete
  2. Very interesting article. Thanks.

    ReplyDelete
  3. EK number lihilays rao!! Bhari..
    Your flourish in writing and thought expression (in most of ur blogs)REALLY fascinates me!

    Aniruddha Chitale

    ReplyDelete
  4. Interesting sir...
    Liked this thread out of the many threads i read (multitasked) on your blog.

    Manish prabhune

    ReplyDelete