Wednesday, July 27, 2011

Concurrency issues in real life

"Non-determinism comes from parallel processing and mutability" (Martin Odersky)... true for information systems and real life also.
This was the tweet I posted on midnight of 27th July 2011 to my twitter followers, while watching this video: O'Reilly OSCON Java 2011, Martin Odersky, "Working Hard to Keep It Simple".
I immediately thought that this phrase is a compressed dose of a great portion of wisdom. The art of information systems architecture and real life seem to have many things in common.

Real life could be multithreaded:

Thread 1: Health
I consider health to be the most important thing in our lives. And health depends of course of the conditions in the environment where we live. We live in a city and we prefer to spend some weekends and some holidays at the country side. We get sweat in the summer and we get cold in the winter interchangeably. The quality of the air we breathe and the water we drink is changing. And of course we need more regular physical exercising.

Thread 2: Family
Being a man, you know that your wife's character is more floating than you would expect. Living with another person always takes some tries to keep the moods in sync. Problems begin when one person is equiped with happiness while the other is seized by sadness.

Thread 3: Job
As a dangerously enormous part of our timeline, job significantly qualifies our lives. We may feel productive or we may feel stressed from a deadline. We may be satisfied of the subject, the conditions and the colleagues, or we may need a change of workplace, or even a change in our career.

Thread 4: Friends
Friends bring a great balance to our lives. Like family persons, friends are also persons who need to get and who can give sadness and happiness interchangeably.

Thread 5: Money
Since everything in life ended up to be needed to be measured somehow, we got money, and we got selling, buying, lenting and renting transactions. Sometimes, for some months, your salary is not enough to pay the bills. Some other times, unfortunately fewer, you may be surprised of the balance of your account, because you managed to spend less in that month.

And there are more than 5 "threads" in real life, all manageing:
a. mutable qualitative data as emotional states and
b. mutable quantitative data as money.
Unfortunately our brain is one "physical processor" with several "logical cores" but all of them have to use the same "shared memory"... So, all people have to deal with mutable data while processing threads in parallel.

Apparently, real life is naturally non-deterministic because it has to deal with parallel processing of mutable data. But, a software engineer should design information systems in a completely different way. An information system should be deterministic, so, it has to build a shield against parallel processing and mutable data.

Concluding, a deterministic information system allows the software engineer to:
1. take more time to take care of his health,
2. spend more time with his wife,
3. prepare better deliverables in time,
4. drink beers with his friends,
5. produce more in less time.