Poisoned Wine

June 4th, 2006 admin

You are the Monarch of an Island and are about to have a festival tomorrow. The festival is the most important one you have ever had. You’ve got 1000 bottles of wine you were planning to open for the fiesta, but you find out that one of them is poisoned by some evil scoundrel. The actual poison exhibits no symptoms until somewhere around the 23rd hour, then results in sudden death. You have thousands of prisoners at your disposal.

1. What is the smallest number of prisoners you must have to drink from the bottles to find the poisoned bottle?
2. What is the smallest number of prisoners that you must sacrifice?
3. For the strong minded, what is the smallest number of prisoners if more than one bottle (say 2) is poisoned? Read More (pdf file)

Posted in Tidbits | No Comments »

The Kite Runner by Khaled Hosseini

June 3rd, 2006 admin

The Kite Runner - Cover Image “Reading this book, tears flow down unabated and without warning …”, Kavita had informed me. “But it is such a beautiful story”, she had added. I was looking for a window into the people and politics, culture and psyche of Afghanistan, and this book seemed to promise a mix of both a “beautiful story” and “a window”. I picked it up at Borders in Cary, NC, and as I normally do, started to read it over a weekend in the store. The next weekend, less than even halfway through the novel, I bought it.Though Afghanistan, its people and their ways add colour and concrete to the story, the main themes of the story are timeless and universal - the pleasure of friendship, the pain of squandering it, of coming to terms with one’s true self, of growing up, of sacrifice, of ideals, of living up to those ideals. Amir, the protagonist of the novel, grows up in the 60’s and early 70’s in Afghanistan, where he lives in a big house with his father, their servant Ali and Ali’s son Hassan. Amir finds unfailing and radiant loyalty and friendship in Hassan. “Baba”, as Amir calls his father, is the ideal human being in Amir’s eyes, as he grows up. Amir strives to live up to his father’s expectations. The story winds its way through Amir’s childhood, Hassan’s unquestioning friendship, Amir’s relation with his father and Ali, through political turmoil in Afghanistan, how it affects all the people Amir knows, Amir’s youth in the USA, and his search for something that he is desperately missing in life - an atonement for his sins which brings him back to his motherland and the final redemption. Amir helps us all grow up a little, as he discovers what he has lost along the way and what he has gained. The development of his morality and values, shaped by self-reflection and instinct, by scheming and by accident, is a wonderful mirror into our own values and how we pick them up.

The book is powerful and honest, even to the point of being brutal. The language caresses the story to flow from one evocative scene to the next. The scenes are so real, it is like watching a movie. This book could be and probably should be made into a movie. It does drive you to the verge of tears at places. A story that is powerful and haunting yet tender and very human.

Posted in Reviews | No Comments »

Siddhartha by Herman Hesse

May 21st, 2006 admin

Siddhartha Cover Image Siddhartha is the story of a young Brahmin boy, Siddhartha, and his personal quest for peace. In his early adulthood he discerns oncoming discontent. He realizes that the best intent and efforts on the part of his family, his pious father, his learned teachers, the glorious writings in all sacred books, would not be able to satisfy his search for meaning, his search for Brahman. The main doctrine in the book, which makes many critics call this book a harmonious blend of Eastern and Western Philosophies, is that true wisdom can not be taught. It exists, but has to be reached by each person by his or her own path.Siddhartha’s journey takes us through his mastery of Brahmin rituals early in his life, but which still leave him uncertain and wanting. Then he gives up his notion of self, and becomes a Samana. A wanderer. He learns to overcome the throes of hunger and thirst, the urge to speak, and practices patience. After several years of mastering the life of a Samana, he realizes that he has not yet found an answer to satisfy his sense of purpose in life. He meets Gotama, the Buddha, during that time and has a very interesting conversation, where he accepts graciously the greatness of the Buddha for achieving his end in life, but disagrees respectfully with the Buddha about the ability to impart wisdom through teachings of any kind. Buddha acknowledges Siddhartha’s point of view and lets him continue his search. This discussion between Siddhartha and the Buddha is a pivotal point in the book. The fact that Siddhartha shares the same first name and to some extent the same pangs of soul-searching as the Buddha, indicates that it is no coincidence that Herman Hesse chose to name the protagonist of this story so. He is really probably trying to say how the supposedly Western concepts of individualism and freedom of thought, were really not just tolerated by the Eastern philosophies as when the Buddha acknowledges Siddhartha’s personal quest, but indeed, are the origin of the Eastern philosophies. Gotama, before he became the Buddha (which literally means the Enlightened One), went through several experiences in life that left him unsatisfied and with a sense of purposeless rote, just as the experiences Siddhartha went through. The rituals, the mythology, the communal conformity and sense of peace in humble acceptance of fate that mark Eastern religions and philosophies, the author probably argues, only bring some order to an otherwise fierce sense of individualism, and an undercurrent of potentially chaotic search for one’s own religion.

Siddhartha, tires of the Samana philosophy, for even the elder Samanas in his company are second-handers, unsure about what they are doing, often just ending up tormenting their selves and bodies, out of sheer practice, than any inherent conviction. He then enters the world of sensual pleasure - learning from the courtesan Kamala, the art of love, from a merchant, the art of trade, and from yet others, the art of gambling. The tries to find satisfaction in any of these. He does for a while, while the experiences are new and he is constantly learning something. But when he has learnt all that others could teach him, he realizes there is still more he is capable of learning, and nobody but he himself must learn it.

He leaves the company of all monetary, bodily, intellectual pleasures for they were short-lived. He would master the art and then there was nothing to prove beyond that. He is attracted to the life of a ferryman who lives alone in a small hut by the river, tending to his boat, ferrying people across the river and listening to the river. Siddhartha too joins Vasudeva, the ferryman, and learns to ferry people across the river and listening to the river. Vasudeva lives a simple, yet happy life, and claims that the river has taught him everything he knows. This excites Siddhartha. The river as a teacher, really implies one has to listen to one’s innermost voice. Vasudeva and Siddhartha practice listening to the river together, and realize the true essence of life. The link between the eternal and the fleeting, the omnipresence of the Brahman. Siddhartha realizes the love for his child from Kamala, his father’s love for him when Siddhartha left him to be a Samana, his attempts to be a Samana, a Brahmana, a merchant, his attempts to find the final truth, were all just parts of an endless stream of events, with no particular start nor end. The unity of it all, the eternal presence of it all, the continual struggle, yet the continual acceptance of the struggle, that was his final discovery. He ends his journey having attained his peace.

In some sense, the ending did not make as much of an impact on me as I would have expected from a book that is as famous as this. Yet, is that not the greatest accolade one can give this book? Think about it. What was Siddhartha’s final answer, need not be my final understanding. And if the book teaches anything, that would be the main lesson. And so searching for a satisfying answer after reading this book is contradicting the “teachings” of the book. Hence I leave it at that. You read it, keep an open mind, and maybe it will help you unlock a little door on your own personal quest.

Posted in Reviews | No Comments »

Life of Pi by Yann Martel

May 14th, 2006 admin

LifeOfPi Cover Image I usually do not read pure fiction, where the pure involves fiction without any after-effects. Fiction that ends when the book ends is not something that excites me. But what is a story if not fiction. Be it facts or ideas, they become so much more tangible when served with a soup of characters, with their quirks and their passions, with incidents that resonate with something that every person can participate in, with a story. A yarn pulled out of thin air may often last longer than a string pulled out of rigid, limited spool of the collective observation. It’s the same with newspapers. They become a boring, tiresome and apparently pointless jumble of facts, unless the editorial tries to show a subjective view-point that ties together the brutal reality that the other reports blandly serve up, into something that makes a story. The reporters job is to be objective and precise. The editor can then provide his commentary. Not his facts, but his commentary. His story.I usually do not read pure fiction. This book is purely fictional, but reveals much more than any number of factual observations can ever attempt to. This book is not pure fiction. The after-effect is strong. The book provides answers. The answers are everywhere in the book, but never is it provided in a direct, authoritative tone. The answers are provided by raising simple yet pertinent questions. The hero of the book, shows us the meaning of belief and the reason for belief.

This book is difficult to categorize. I struggled to explain to my father over the phone tonight what this book is about. “Nanna, I finished reading this wonderful book called ‘The Life Of Pi’”. “OK, what it is about?”. “Well it is a fiction, a book on philosophy, on religion, on reason. Well it is a story of a kid in Pondicherry whose family decides to leave India due to Indira Gandhi’s imposition of The Emergency, and plan to settle in Canada. The father owns a zoo, so they decide to carry some of the animals along with them in a ship. The ship sinks and the kid alone survives, along with some other animals, most notably a Royal Bengal Tiger. The books relates the story of how the kid survives at sea for over 7 months. Well… but it is not really a book about just his survival.” I struggle. It a book about “our” struggle. It answers one very important question that beautifully ties together the world of philosophy, the world of religion, the world of science …“Why are we?”. These worlds are not really disjoint, and so it is no surprise that this one question can be grappled with from many angles. The answer science gives us is rather unsatisfying if not positively distressing. It essentially says we do not have much of a purpose other than to procreate and try to improve our species to survive in the changing environment. Life only strives to survive and expand, it says. You and I are mere cogs in this giant gear system, each one thinking it is special. That brings us to philosophy’s attempt to grapple with the purpose of our existence. The premise is that there must be some meaning to why we are. And finally religion’s attempt to provide an answer that satisfies the sense of purpose we all need to survive. To survive. We are all surviving, we are all struggling. Maybe not struggling in a ready visible way, but we are struggling to understand our place in time and space. More importantly, struggling to find the reason for our existence.

This book helps bring some direction to our search for that answer. The book’s colourful, evocative, vivid and sometimes gory images are like a dream. Sometimes too hard to believe, but at the same time very tangible. Even obvious. The story, through the hero, challenges some of the notions of faith. At the same time, the story, again through the hero, vehemently supports the notions of faith. The book claims that it will make you believe in God. It does. But it is not exactly what you might be led to believe when you read that line first…or even when you read it here. It will not just make you believe in God, but it will tell you why there is no way to live without believing. There is a memorable line in the book which I quote here. “It was my first clue that atheists are my brothers and sisters of a different faith,and every word they speak speaks of faith. Like me, they go as far as the legs of reason will carry them - and then they leap.” In another quote about agnostics, the book says “ Doubt is useful for a while. We must all pass through the garden of Gethsemane…But we must move on. To choose doubt as a philosophy of life is akin to chooseing immobility as a means of transportation”. The book builds its case very well. And in the shattering final few pages, forces you to see why belief is what keeps us all going in life. Belief not in any particular man, nor idol, not in any particular scripture or song, not in any particular house nor priest, but belief in that there has the be an answer. It cannot be chaos. The place given to the method of science is very high in the whole book. Every argument the hero makes is bolstered with enough scientific reasoning. But scientific reasoning only works to solve some of his more immediate problems. To solve his biggest problem, not how to survive, but why to survive, he had to go beyond.

Fiction, is nothing but mangling of the fact to bring out the essence of the message. There is a sentence in the book that says something to the same effect as the previous sentence, only it says it better. This is truly exemplified by this story. It was a heartening and rejuvenating read for me. There are three parts to the book. The first part is about Piscine Molitor Patel’s childhood in Pondicherry. His interactions with his parents, his brother, his teachers at school, the animals in his father’s zoo and the various religious faiths in secular India. This part was thrilling because I could relate to a lot of his childhood memories and a lot of the author’s very accurate observations about India. I have been to several Indian Coffee Houses in India and can vouch for the squareness of the tables, the high ceilings and the slow whilr of the ceiling fans hanging from long shafts. I can vouch for the heavenly transformation of leftover batter into an oothappam. The nostalgia got me hooked, but the second part about Pi’s struggle to survive for 227 days on a lifeboat, against and with Dennis Parker, the fully grown Royal Bengal Tiger, made me go on. The evocative, vivid language describes a near surreal experience. The third and final part, that wraps up the story at exactly the hundredth chapter, or rather opens in right up again, is the most riveting and honest. The story is rich, the writing and imagination mind blowing, but what worked for me most of all was that I could relate to Pi’s ideas about the true meaning of religion, and its indispensability.

Here are some memorable lines from the book.

“Father saw himself as part of New India – rich, modern and as secular as ice-cream.”

“I have heard nearly as much nonsense about zoos as I have about God and religion.” – Pi on why animals would prefer zoos compared to the wild.

“I was named after a swimming pool.” – Pi explaining how he came to be knows as Piscine Molitor Patel.

“The first time I went to an Indian restaurant in Canada I used my fingers. The waiter looked at me critically and said, “Fresh off the boat, are you?” I blanched. My fingers, which a second before had been taste buds savouring the food a little ahead of my mouth, became dirty under his gaze. They froze like criminals caught in the act. I didn’t dare lick them. I wiped them guiltily on my napkin…I picked up the knife and fork. I had hardly ever used such instruments. My hands trembled. My sambar lost its taste.” – what a magnificient example of Yann Martel’s ability to get into Pi’s mind.

“I was more afraid that in a few words thrown out he might destroy something that I loved. What if his words had the effect of polio on me? What a terrible disease that must be if it could kill God in man.” – Pi’s interactions with Mr. Satish Kumar, his science teacher.

“It was my first clue that atheists are my brothers and sisters of a different faith, and every word they speak speaks of faith. Like me, they go as far as legs of reason will carry them - and then they leap.”

“Very few castaways can claim to have survived so long at sea as Mr. Patel, and none in the company of an adult Bengal tiger.” – from Mr. Okamoto’s report on Pi’s ordeal.

Posted in Reviews | No Comments »

Undefine me

May 7th, 2006 admin

Does anyone truly know me?
Will anyone ever do?
Will anyone ever care enough
to look beyond what they see,
beyond that which is relvealed
or even beyond what is apparent,
beyond what words can define or defend,
beyond what actions can show.

What I truly mean
can not be said,
for words and thoughts will fail
miserably at best,
to capture intent and inclinations.
The mere attempt, the mere defence
is so sad.

Silence. Quiet. Calm.
The only way to know it
is by not trying, not defining,
not attempting, not defending,
not showing, not struggling with it.
The only way to know it
is to believe.
The truth will then come to you…
softly, silently, undefinably,
yet with the grace of a butterfly,
with the calming reassurance of cool monsoon winds.

(Anil Krishna, May 7th, 2006)

Posted in Poetry | No Comments »

Cycles per Instruction and its components

April 30th, 2006 admin

Cycles per Instruction is one way to evaluate the microarchitecture’s effect on a processor’s performance. Performance also depends on what constitutes a cycle (frequency of the machine) and what constitutes an instruction (the architecture of the machine). Interestingly, the ratio of these two, i.e. Cycles per Instruction, tells us about something other than those two factors. CPI tells us how many cycles, at the given frequency, the machine takes to chomp down instructions of the given architecture. In other words CPI tells us about the microarchitectural robustness of a design. It tells us, given a certain cycle period (frequency) and a certain group of instructions (architecture), how many cycles does it take to execute an “average” instruction. The “average” instruction depends on the workload (the program) being run through the processor. And therefore, when quoting CPI’s the workload to which that CPI applies is also quoted. The smaller the CPI the better performing a computer system is, all other factors such as the frequency and architecture remaining the same. Of course, other factors such as area, complexity and power must be considered, in addition to performance and the definition of “better” changes accordingly.

CPI is affected by several factors. Architects and designers often need to know where to start when trying to improve performance by making microarchtectural changes. The overall CPI has to be broken into components and the component that is contributing the largest is usually attacked first, since improvement in that design component could potentially reduce the CPI by the largest amount. I will come back to this point again with an example, shortly. For this write-up I will break the CPI into two main components. The “core” component and the “memory-nest” component. The core component deals with all the microarchitectural decision within the processing unit, which in modern microprocessors includes several pipelines (superscalar machines), each with several stages and associated logic - instruction fetch, decode, issue, register access, execute, write-back etc. The memory-nest component deals with getting appropriate instructions and data from the memory. Several levels of caching is provided to take advantage of certain properties seen in programs. These properties are spatial-locality (if a certain memory location is used, something nearby will be used soon) and temporal locality (if a certain memory location is used, it will likely be used again). To keep the data close at hand, and to avoid the potentially hundreds of processor cycles worth of time to go to the memory every time a new instruction or data is needed, instructions and data are stored in caches. There are some great resources on the web and in books which talk about caches in more detail. For this write-up it suffices to say that caches usually are arranged in a hierarchy. Level 1 is the smallest cache but is the fastest to access and is called the L1Cache. Level 2 cache is bigger than the Level 1 cache but because it is bigger and is usually only accessed after it it known that the instruction or data the core was looking for was not available in the L1Cache, it is slower. It is called the L2Cache. Usually the hierarchy has 2-3 levels of caching.

Therefore, if the CPI component is mostly affected not by the design of the core itself, but because of the sizes or geometries of the caches, the designers would be better served by the information that the memory-nest, or more accurately, a certain level cache should be the first place to look for potential improvements, rather than the core. This brings us to the two main topics of this article. First, what quantities in the cache must be measured to help understand its effect on the CPI. Secondly, from these statistics collected on the caches, how do we build the overall CPI number.

Cache Statistics - What they are, what they mean

When modeling caches there are 4 statistics that are often talked about. These are all not completely independent, and are, therefore, easy to get confused about. The 4 main performance-realted statistics collected for a cache are:

MissesPerReference
HitsPerReference
MissesPerInstruction
HitsPerInstruction

MissesPerReference indicates the ratio of how many times, of all the times the cache was accessed, was the cache unable to provide the data requested. HitsPerReference is the complement. It is the ratio of how many times, out of all the times the cache was accessed, was the cache able to provide the data requested. The complementary nature of these quantities makes it necessary to only quote one number.

MissesPerReference + HitsPerReference = 1

MissesPerInstruction is not that straightforward. It is the ratio of how many times the accesses to the cache missed, out of all the “instructions in the workload”! This is a strange measure at first, and takes some getting used to. It’s the ratio if a design-dependent variable quantity - cache misses, to an unchanging quantity, the number of instructions in the workload. In the earlier measure of missesPerReference, the denominator, the number of references to the cache, was variable depending on what happened before this cache was reached by the instruction flow. The number of reference to this cache depends on how well the previous levels of cache did. HitsPerInstruction, similarly is the ratio of the number of hits in the cache to the total number of instructions in the workload. MissesPerInstructions and HitsPerInstruction do NOT add up to 1! They add up to the number of references made to the cache per instruction.

These 4 quantities are depicted by an example in Figure1.

Figure1

Why collect PerInstruction statistics

So the question is, “what is the reason we need these two ways of looking at a cache’s performance?”. Why doesn’t the simpler PerReference style of collecting stats suffice? The answer is that the PerReference numbers are great for designing the cache under study provided the number of references does not change, which implies, the design before the cache in study remains unchanged. The PerInstruction numbers are useful to get an idea of how much the cache under study is contributing to the overall CPI. We will shortly see how that overall CPI is calculated from the PerInstruction numbers. Before the PerReference numbers can be used to improve cache designs, the PerInstruction numbers must point out that it is worthwhile to go after a cache design because the cache is adding a big component to the CPI of the system. And we want to keep the CPI low as far as possible. That is why we want to keep track of the PerInstruction statistics.

How to breakdown overall CPI into components

There are two ways to break the overall CPI, or another way to look at it is, two way to build the overall CPI.
One way is to look at what fraction of instructions “pass through” each level (whether they hit or miss at that level is immaterial) in the hierarchy and add up the cycles they spend at each level. The idea is depicted in Figure 2.
The other way is to look at what fraction of instructions “finish at” each level (i.e. they hit) and add up the cycles those fractions take to finish their journey through the memory hierarchy. The idea is depicted in Figure 3.

Method 1: Breaking CPI into components for each level of the memory hierarchy an instruction passes through

Figure2

This method is often used to represent a CPI stack, which assigns a portion of the CPI to each level. This is very useful in figuring out which level of the cache to go after for improvements.

CPI = CoreComponent + L1Component + L2Component + L3Component + MemComponent

Here the overall CPI is reached by adding CPI contributions at each level of the memory hierarchy. Simulation models for the core often generate “infinite” CPIs. Infinite CPIs are used to keep the effect of the memory hierarchy separate from the effect of the core design, so separate teams can work on both models in parallel. The effect of the memory hierarchy on the CPI has to be added in to the “infinite” CPI to get the overall CPI.

infL1CPI = CoreComponent + L1Component
infL2CPI = CoreComponent + L2Component + L2Component
and so on.

The calculation of infL1CPI assumes the L1 always hits, but has the normal hit latency. So it is an infinitely large L1, but miraculously the directory lookup and array access takes time equal to a realistic sized L1.
The calculation of infL2CPI assumes the L2 always hits, but has the normal hit latency. The L1 is realistically modeled, the L2 is the infinite L2 with correct hit latency modeled.

Going back to
CPI = CoreComponent + L1Component + L2Component + L3Component + MemComponent
Say we have cache models for the L1,L2, L2 caches and the memory. So how do we get the L1Component, L2Component, L3Component and MemComponent, such that we can get the overall CPI for the system. This is where the hitsPerInstruction and missesPerInstruction numbers come in very handy.
L1Component = L1ReferencePerInstruction * L1Latency –(A1)
L2Component = L2ReferencesPerInstruction * (L2Latency - L1Latency) –(A2)
L2Component = L3ReferencesPerInstruction * (L3Latency - L2Latency) –(A3)
MemComponent = MemReferencePerInstruction * (MemLatency - L3Latency) –(A4)

Notice that each component is a product of the fraction of instructions that reference that level and the amount of time those instructions which reference that level are guaranteed to spend at that lavel. Two observations here:
1. the ReferencesPerInstruction at each level is the sum of hitsPerInstruction and missesPerInstruction for that level
2. an easy way to determine the common amount of extra time introduced by a level into the overall execution of an instruction is to find the difference between the time when an instruction hits at that level and one level before.

Method 2: Breaking CPI into components for each level of the memory hierarcy an instruction finishes at

Figure3

This method is often used when the aim is to simply calculate the overall CPI and we are not dealing with breaking the CPI into its CPI stack components.

CPI = CoreComponent + (L1HitsPerInstruction*L1Latency) + (L2HitsPerInstr*L2Latency) + (L3HitsPerInstr*L3Latency) + (MemHitsPerInstr*MemLatency) –(B)

Another way to say this is
CPI = Time spent by all instructions which do not have to even go to the L1Cache(s)
+ time spent by the fraction which hit L1 and face the L1Latency on top of the CoreComponent
+ time spent by the fraction which hit L2 and face the L2Latency on top of the CoreComponent
+ time spent by the fraction which hit L3 and face the L3Latency on top of the CoreComponent
+ time spent by the fraction which hit memory and face memory latency on top of the CoreComponent

Notice that each component looked at this way is the product of the fraction of instructions which hit in a particular level of the hierarchy and the time it takes to service those instructions.

CAVEAT: There is a distinct difference between the CoreComponent component in equations A and equation B. In equations A, CoreComponent applies to all the instructions, since all the instructions pass through the core. In equation B, the coreComponent applies to only those instructions which do not have to leave the core to access L1Cache (or caches, since Level 1 is usually broken into separate instruction and data caches). To simplify this, simulation models of the core often are tightly coupled with at least the L1cache or L1caches. There is a significant amount of overlap in accessing the caches, especially the level 1 cache and therefore the time spent in accessing one instruction or data granule might be able to hide the time to access another. This could adversely affect the CPI calculations. That is why this style of breaking up the CPI into its components and adding them up, only works as an estimate. A realistic CPI can only be realized by building in a more detailed understanding of the paralellism in a workload into the equations above, or by just creating a more accurate simulation model with the core model working hand-in-hand with the memory nest model. One way to make the above equations a little bit closer to reality is by only considering loads (i.e. both instructions and data loads) for the missesPerReference, hitsPerInstruction etc. Stores usually do not directly affect CPI since they are handled by mechanisms that are non-critical to CPI calculations.

Posted By: Anil Krishna at 2:30PM on Sunday, April 30th, 2006

Posted in Tutorials | No Comments »

Faith with no doubt vs failth only in doubt

April 23rd, 2006 admin

“If a man will begin in certainties he shall end in doubts; but if he will be content to begin in doubts he shall end in certainties.”
- Philosopher Francis Bacon, quoted in the Associated Press

The notion of faith evokes an immediate association with religion. Faith is considered integral to truly experiencing the joys of religion. Faith is the ability to overcome doubt. It is fueled by humility, obedience and trust. All these are virtues. I would like to argue in this article that every thing I said about faith applies to science, and arguably, more to science than religion!

Faith is integral to science. The big difference in science is that the faith is not placed in the end result. The faith is placed in the means to the end, the process of getting there, the method. Faith is placed only in the validity of doubt and methods to counter it. Doubt is the origin of science. This doubt, fueled by curiosity and bolstered by unyielding faith in the validity of doubting, eggs on the scientist to the end result. Which, of course, is open to doubt.

Faith in religion does not stem from doubt. It stems from individual or collective notions. It often stems from an individual’s notion that is guided by what will appeal to collective notion, the masses. Religious faith asks one to give up ones prejudices. Coincidentally, science asks the exact same from its followers. Religion, though, makes up for your loss in giving up your own prejudices, by replacing it with communcal prejudices. Science leaves you high and dry. You have no easy replacement. That is the most crucial difference between the two approaches to knowledge. In one, you are handed a solution on a platter. In the other you are often handed an idea, a theory or a hypothesis, that is itself open to your scrutiy and validation and occasionally, you are handed nothing.

Why would one choose the scientific way, when it is ridden with potentially wrong solutions, laced with heavy doses of doubt, and provides no guarantees for any success? Would it not be easier to accept solutions which can be sufficient to lead a happy lifetime, with no double-guessing, no opportunity for pattern-less chaos, with no doubts? Unfortunately, though many solutions have been proposed often in the form of religions, the solutions have not been able to present a uniform set of answers that could completely anhilate doubt from all minds. And the problem is not with the solution provided by any religion. The problem is the attempt to provide such a solution. The very nature of how relegious ideas develop, make it hard to be communicated across all geographies and cultures. But even if there were only one religion, one set of solutions, that everyone in the world had attempted to put their faith in, it would still not work. And that is because, the attempt is to place faith in the solution. There is no way to verify or recreate the solution to satisfy one’s own curiosity. And that brings us to the heart of the matter. One’s own curiosity implies the notion of individuality. Every individual is different and capable of thinking for herself or himself. When a solution reached by one or, hypothetically, even a majority of the people is presented to “everyone”, there certainly will be someone whose individuality will not be truly satisfied with the solution. Uniform religion that provides ready solutions, therefore, will continue to be inadequate.

The alternative is to nurture this individuality - the inherent ability and, indeed, the urge, to doubt. There is no solution that is beyond any individual’s grasp. There is no requirement for collective faith to be placed in the solution. The faith is placed is the means, where the means only refer to doubt. The means do not refer to a particular approach to finding the answer. The faith is not placed in anything beyond the individually verifiable. And that often stops at the realization that the answer is either not available or not sufficient. With such a weak framework of guide rails, it could be argued that we will never get anywhere. But that is the kind of freedom that an individual craves for. The lack of guide rails is an opportunity, rather than a restriction. The downside is that it takes a lot more courage to truly follow the scientific method. There are no guarantees that you will ever get anywhere. The temptation to build rigid guide rails, to take you somewhere, is often overpowering. The temptation to get to an answer, before the battery runs out, that is, within a lifetime, is also another pitfall. Truth does not have such stipulations, and to dive into the vast expanse of science with all its half-baked solutions, caveats and sparse guide-rails takes tremendous courage and tremendous faith - faith, in your right to doubt - faith in fact, in nothing, except doubt itself.

Posted in Philosophy | No Comments »

Hinduism: Professor Kishor Trivedi’s observations

November 6th, 2005 admin

Professor Kishor Trivedi of Duke University has written a wonderful introduction to what Hinduism is. His astute observations help a novice see the difference between ritual practices and the crux of this way of life. He carefully guides us through the various facets of this often nebulous concept, stringing together the various words we associate with Hinduism, providing perspective and scope. In spite of the amount of information, he never loses the reader, because of the reassuring obviousness and simplicity of the ideas he presents. Though not the main theme of the article, he also places the role of religion in context. With near clinical accuracy and the ease of a seasoned mathematician, he reasons that the contradictions and friction between the various named religions of the world are a reflection on human shortcoming when trying to come to grips with the vastness of this concept. I took permission from Professor Trivedi to provide his article here.
Dr. Kishore Trivedi’s article on Hinduism

Posted in Information, Philosophy | No Comments »

Send More Money

October 19th, 2005 admin

My father asked me this question over the phone this weekend.

“A college going kid’s father, tired of his sons repeated requests for money throws him a challenge. He asks the son to solve a math puzzle, before expecting any more money from the dad. SEND + MORE = MONEY is a mathematical equality, where each letter is a unique numeral. What is the equality in numbers?”.

It turned out to be an immensely interesting puzzle. It has a unique solutions, the solution can be logically deduced, and it makes a sensible English phrase! That third point is something I am still not sure whether to be amazed by or not.

Here is a sequence of steps I followed in my deduction of the solution

  S E N D
+ M O R E
---------
M O N E Y

The M has to be a 1, since the carry from adding S of SEND and M of MORE can be either a 0 or a 1, and in this case it is a 1 since we have M in MONEY to represent it. Another way to say the same thing is adding two numbers in the thousands can not give you twenty thousand or more. even 9999 + 9999 falls short of 20000 by 2.

  S E N D
+ 1 O R E
---------
1 O N E Y

S in SEND and 1 from 1ORE have to add to result in a carry since the whole existance of the 1 in 1ONEY depends on it. That is possible only if S is 9, there is no carry from the hundreds’ place (and therefore the O in MONEY is 0) or S is 8 and there is a carry of 1 from the hundreds’ place (in which case the O in MONEY is 0 again) or indeed the case that S is 9, and there is a carry of 1 from the hundreds’ place (and here the O in MONEY is 1). Since O can’t be 1, as M has wrested that privilege, the only two plausible choice is that S in SEND is 8 with a carry from the hundreds’ place or the S is 9 with no carry from the hundreds’ place. So, are we stuck? Which of these two to choose? Well, time to look a little into the future, by which I mean the hundreds place. One thing is certain, whether S is 9 with no carry or 8 with carry, the O in MONEY is 0. Therefore the O in MORE is 0 too! So looking at the hundreds’ place, E + 0 = N. That can’t be. There must be a carry from the tens’ place! So the hundreds’ place equation now reads, 1 + E + 0 = N. The question we are after is does 1+E give rise to a carry or not. Only way it can give rise to a carry is if E = 9. But then 1+E =10 and that means N = 0. That can’t be. O has gotten that privilege. So we do not know what E is but is certainly is not 9 (and not 0 or 1). So that means, since there is no carry over from the hundreds place S is 9.

  0 1
  9 E N D
+ 1 0 R E
---------
1 0 N E Y

N is one more than E. At first glance the values E can take are 2,3,4,5,6,7,8. Of these, 8 has to be ignored since then N would be 9. But 9 has already been assigned to another letter. Still the choices for E are too many. Looking at the tens’ place, N + R = E + 10 or 1 + N + R = E + 10 (if there is a carry from the ones’ place). The 10 in the above equation comes in because there is a carry from the tens’ to the hundres’ place for sure. Substituting E+1 for N, we get either E + 1 + R = E + 10, which implies R = 9 which is not possible, or that, 1 + E + 1 + R = E + 10, which leaves us with the information that R = 8 and equally importantly, that there is a carry from the ones’ to the tens’ place.

  0 1 1
  9 E N D
+ 1 0 8 E
---------
1 0 N E Y

Now we look at the ones’ place. D, E and Y have to be three amongst 2,3,4,5,6,7 since the others have been taken. The information that the ones’ place lends a carry to the tens’ place means D + E = Y + 10. Note than the ones’ place cannot have a carry from the tenths’ place. This implies that D and E have to add up to at least 12, since Y is, at a minimum, 2. The only ways of adding a pair from the remaining numbers to get 12 or more are 5+7 or 6+7. E is either 5,6 or 7. Now we fall back upon the hundreds’ place to bail us out of the dilemma. The hundreds’ place tells us that E + 1 = N. Therefore E cannot be 7, since then N would be 8. N cannot be 8 since 8 is taken by R. Since E cannot be 7, E is either 5 or 6. Either way, D is 7. Now, if E were 6, N, which is E + 1, would be 7. That is not possible since we just allocated 7 to D. So E is 5 and N is 6.

  0 1 1
  9 5 6 7
+ 1 0 8 5
---------
1 0 6 5 Y

Y is therefore 2. And the final solution is 9567 + 1085 = 10652

Posted in Tidbits | No Comments »

PseudoLRU Replacement Scheme

October 10th, 2005 admin

I am taking ECE521, a Computer Architecture course at NCSU and am thoroughly enjoying it. One of the topics that was touched upon in the class, and with which I later struggled for a few hours was how pseudoLRU replacement policy works . I could not find useful tutorials on the net and decided to write one for myself. Feel free to use it as is if you find it helpful, or let me know and I can send you the ppt version.

Posted in Tutorials | No Comments »