
The demon king who could think ten thoughts at once — and the science of parallel processing.
The King of Lanka
In the age before ages, when the gods still walked the earth and the boundary between heaven and the mortal world was thin as silk, there lived a king named Ravana.
He was not born a king. He was born a Brahmin — a scholar's son, grandson of Pulastya, one of the mind-born sons of Brahma the Creator. From his first breath, Ravana was brilliant. He learned to read before he could run. He memorised the four Vedas — thousands of verses — while other children were still learning to count. By the time he was a young man, he had mastered music so completely that he could make the strings of his veena weep or laugh at will.
But brilliance was not enough. Ravana wanted more. He wanted power over death itself.
The Penance
He went to the wilderness and performed tapasya — an act of focused meditation so intense it could bend the fabric of reality. For thousands of years, Ravana sat motionless under a burning sun, eating nothing, drinking nothing, his mind fixed on a single point. When even that was not enough, he cut off his own head as an offering to Brahma.
The head grew back. He cut it off again. And again. Ten times he severed his own head and offered it to the fire. Each time, a new head grew in its place — not a copy, but something different. Each head carried its own knowledge, its own perspective, its own voice.
Brahma, moved by the severity of this penance, appeared before Ravana and granted him a boon: near-immortality. No god, no demon, no celestial being could kill him. Ravana had become virtually indestructible.
Ten Heads, Ten Minds
Ravana's ten heads were not just decoration. The ancient texts describe each head as a centre of distinct knowledge. One head held mastery of the Vedas and scripture. Another held warfare and strategy. A third contained knowledge of music and the arts. Others governed astronomy, medicine, law, engineering, sorcery, politics, and philosophy.
Imagine it: ten streams of thought running simultaneously. While one head composed a verse of poetry, another was calculating the movement of the stars, a third was planning a military campaign, and a fourth was debating a point of law.
In modern terms, Ravana was a parallel processor — ten independent minds working at the same time on different problems. A normal person thinks one thought at a time, switching between tasks like a single musician playing one instrument. Ravana was an entire orchestra, each musician playing a different part, producing a symphony of thought.
This made him terrifying. In battle, one head could read an opponent's stance while another recalled the counter-move from ancient texts, while a third calculated the angle of attack, while a fourth issued commands to his army. His enemies faced not one strategist but ten, all sharing a single body.
The Flaw in Parallel
But here is what the story teaches, and what computer scientists would later rediscover: parallel processing has a bottleneck.
Ravana's ten heads could think independently, but they shared one heart. That heart was consumed by a single emotion — pride. When Ravana kidnapped Sita, it was not a decision made by ten heads reasoning carefully. It was an impulse driven by one uncontrolled desire that overrode all ten minds at once.
His heads could process in parallel, but his heart was a single point of failure. The greatest scholar of his age, the most powerful being in the three worlds, was undone not by a lack of intelligence but by the one thing that could not be parallelised: wisdom.
When Rama's arrow found its mark, it struck not a head but the heart — the single thread that connected all ten processors. Cut the shared resource, and the entire system collapses.
What Ravana Teaches Us About Brains and Computers
Your brain has eighty-six billion neurons, vastly more than Ravana's ten heads. Yet you cannot truly think two thoughts at once. You switch between tasks rapidly — so rapidly it feels simultaneous — but your conscious attention is a single thread. Your brain is massively parallel at the unconscious level (processing vision, heartbeat, balance, digestion all at once) but stubbornly serial at the level of deliberate thought.
Computers face the same challenge. A CPU processes instructions one at a time, incredibly fast but fundamentally serial. A GPU has thousands of tiny processors that work in parallel — brilliant for repetitive tasks like rendering every pixel on a screen, but useless for tasks that require step-by-step reasoning.
The most powerful systems combine both: serial reasoning for complex decisions, parallel processing for brute-force computation. Sound familiar? Ravana had ten heads for parallel expertise and one heart for unified purpose. The flaw was not in the architecture. The flaw was in the programming.
The end.
Choose your level. Everyone starts with the story — the code gets deeper as you go.
Here is a taste of what Level 1 looks like for this lesson:
import time, threading
def think(head_name, duration):
"""One of Ravana's heads working on a task."""
print(f" {head_name}: starting...")
time.sleep(duration)
print(f" {head_name}: done! ({duration}s)")
tasks = [("Vedas", 1), ("Music", 1), ("Strategy", 1), ("Astronomy", 1)]
# Serial: one head at a time
start = time.time()
print("=== Serial (one head) ===")
for name, dur in tasks:
think(name, dur)
serial_time = time.time() - start
# Parallel: all heads at once
start = time.time()
print("\n=== Parallel (Ravana's 10 heads) ===")
threads = [threading.Thread(target=think, args=(n, d)) for n, d in tasks]
for t in threads: t.start()
for t in threads: t.join()
parallel_time = time.time() - start
print(f"\nSerial: {serial_time:.1f}s | Parallel: {parallel_time:.1f}s")
print(f"Speedup: {serial_time/parallel_time:.1f}x")This is just the first of 6 coding exercises in Level 1. By Level 4, you will build: Build a Multi-Threaded Task Scheduler.
By Level 4, enrolled students build: Build a Multi-Threaded Task Scheduler
Free
Level 0: Listener
Stories, science concepts, diagrams, quizzes. No coding.
You are here
Level 0 is always free. Coding levels (1-4) are part of our 12-Month Curriculum.
How the brain processes information, why true multitasking is a myth, and how computers achieve what Ravana's ten heads symbolised.
The big idea: "Ravana's Ten Heads" teaches us about Neuroscience & Parallel Computing — and you don't need to write a single line of code to understand it.
Try this experiment right now. Count backwards from 20 to 1 out loud. Easy, right? Now try counting backwards from 20 while simultaneously reciting the alphabet forward. A, 20, B, 19, C, 18... Within a few seconds, you will stumble. Your brain cannot handle both streams at once.
This is not a personal failing. It is a fundamental limitation of human cognition called the attentional bottleneck. Your brain has billions of neurons working in parallel on thousands of tasks — keeping your heart beating, processing light hitting your retina, maintaining your balance, digesting your lunch. All happening simultaneously, all without your conscious awareness.
But conscious thought — the deliberate, focused kind — has a bandwidth of roughly one thing at a time. What feels like multitasking is actually rapid task-switching: your attention flicks from your phone to the conversation to the road and back again, hundreds of times per minute. Each switch costs time — psychologists call it a switch cost — and during the switch, you are processing neither task.
Ravana's ten heads are the fantasy of true parallel conscious thought. Imagine actually being able to compose music, solve equations, and plan strategy all at the same time — not switching between them, but genuinely doing all three simultaneously. Your brain cannot do this. But computers can, and that is why this story matters to science.
Check yourself: Next time you think you are "multitasking" — texting while listening to a teacher — notice the moments when you completely miss what was said. Those gaps are the switch costs. You were not doing two things. You were doing one thing, then the other, with tiny blackouts in between.
Key idea: Human "multitasking" is actually rapid task-switching with a time cost at each switch. Your conscious mind processes one thing at a time — like a single-threaded computer. Ravana's ten heads represent the dream of true parallel thought.
Your brain is made of approximately 86 billion neurons — specialised cells whose job is to send and receive electrical signals. A single neuron looks like a tree: it has dendrites (branches that receive signals from other neurons), a cell body (which processes the signals), and a long axon (a trunk that carries the signal forward to the next neuron).
When a neuron fires, an electrical pulse races down its axon at speeds of up to 120 metres per second — about 430 km/h. At the end of the axon, the signal reaches a tiny gap called a synapse. It cannot jump the gap electrically, so the neuron releases chemical messengers called neurotransmitters that float across and trigger the next neuron. Electrical signal becomes chemical signal becomes electrical signal again.
This relay system — electrical, chemical, electrical — takes time. Each synapse adds a delay of about 0.5 to 1 millisecond. Your reaction time (the time between seeing something and physically responding) involves a chain of perhaps 5-10 synaptic relays, plus the time for the signal to travel along the axons. Total: about 150 to 300 milliseconds, or roughly a fifth of a second.
That is why catching a ruler dropped without warning is hard: by the time the visual signal reaches your eyes, travels to your brain, gets processed, triggers a "grab" command, and that command reaches your hand muscles, the ruler has already fallen about 15-20 centimetres. You can measure your own reaction time with exactly this test — the distance the ruler falls tells you how long your brain took to respond.
Try the ruler test: Have a friend hold a 30 cm ruler vertically, with the 0 cm mark at the level of your open thumb and finger. Without warning, they drop it. You grab it as fast as you can. The centimetre mark where you catch it reveals your reaction time using the formula: t = √(2d/g), where d is distance in metres and g is 9.8 m/s².
Key idea: Neurons transmit signals electrically along axons (up to 120 m/s) and chemically across synapses. Each synapse adds a tiny delay. Your reaction time — about 200 milliseconds — is the sum of all these delays in a chain from eyes to brain to muscles.
Access all 130+ lessons, quizzes, interactive tools, and offline activities
Your computer's brain is called a **CPU** — Central Processing Unit. A typical CPU has 4 to 16 **cores**, and each core is extraordinarily fast — it c...
In the 1940s, scientists asked: if the brain can learn, can we build a machine that learns the same way? The result, decades later, is the **artificia...