Thursday, September 3, 2009

Memoirs Of An Almost-Techie (Part-3)

Webcomic courtesy xkcd.

Yes, life as an engineering student comes with more than its fair share of existential crisis. You start to apply programming paradigms to real-world scenarios. Just last week, I was trying to use an Operating Systems(ETCS-212) strategy of deadlock avoidance on a classic Catch-22 situation.

Person A needs to discuss a matter of prime importance with Person B. Sadly, for that matter to be valid, there is a certain prerequisite state-of-conditions. But if Person B is, somehow, made aware of the matter, he is sure to disturb the aforesaid state-of-conditions. Whereby, annulling the effects of the attempt and discussion.

The things to be considered here are the discussion of the matter between A and B, and the conditions for the matter to be valid must prevail.

A situation in which two probabilistic events exist, and the desirable outcome results from the confluence of these events, but there is zero probability of this happening as they are both mutually exclusive. Hence, a deadlock.

Now, Operating System Concepts by Silberschatz, Galvin and Gagne(the book I refer to for this particular subject) says that there are 4 necessary conditions for a deadlock to occur :
1. Mutual Exclusion : Both processes cannot happen at the same time.
2. Hold-and-wait : The interdependence of outcomes of the two processes.
3. No-preemption condition : One process cannot force the other into terminating, or forestalling operation.
4. Circular-wait condition : Interdependence of operation.

Proposed solution? Make sure that no more than 3 of these conditions exist simultaneously. So, yours truly did, spend a hell lot of time thinking of how to eradicate one of the four conditions, complete with the permutations and combinations that come along with it. Only to come to one conclusion.

Q.E.D. Engineers, are strange people. Really.
...................................................................................................
Solutions for the problem are more than welcome. Ones with logic derived from other fields of study would be particularly delightful.

15 comments:

JD said...

"You start to apply programming paradigms to real-world scenarios."

Happiness and thrill is seeing this line right in the beginning of a blog vaguely stumbled upon.

Elation is seeing that line preceded by an xkcd strip!

Strange, contended feeling-at-the-end-of-a-hectic-engineering-day is on hearing about engineers being strange people.

Honestly :)

Sherry Wasandi said...

Hello JD.
Thanks for dropping by. Glad you liked it.

Honestly.

Anushka said...

You are a VERY multi-faceted person :D But your about me did hint at me. Too bad no one ever takes those seriously :P

Clezevra said...

This should be so much fun! Or not, I suppose. But interesting nevertheless.

mgeek said...

And I used to envy all you engineering people ever since I had to spend a rainy afternoon with a half-dissected cadaver...

Antara said...

I brag to my engineering group of being able to apply ethical theories and communication models to my life, at the very least.

But, this sounds like fun.

Sherry Wasandi said...

@Death On Two Legs : That's a nice way of putting it! I think it's just more of the fact I find everything stagnating. So, I tend to dabble into a lot of things to beat the boredom.

@Clezevra : Though most won't agree with me, the one part of it that was fun was Manufacturing Processes. I learnt to weld, drill and operate an arc welding machine! And trust me, it's tres cool.

Also, thanks for visiting.

@mgeek: This makes me sound creepy, but that's the one reason I envy med-students. Not the rainy afternoon part. But yes, dissecting cadavers has got to be interesting. Hell, you get to hold a human brain in your hand!(Which is what one friend once gushed to me about as if she were talking about having bought a pair of Manolo Blahniks!

Sherry Wasandi said...

@Anty : Heh. You have competition!

But yes, applying engineering theories to your social life involves stretching your gray cells to the absolute limit of their tensile strength. But then, at least we have something to entertain ourselves with during lectures.

Lemon Girl said...

And journalism can at times involve reducing one's gray cells to nothingness for the sake of a social life. It's sad, really.

Sherry Wasandi said...

@Lemon Girl : I'm pretty darn sure that's the case everywhere.

Cerebral function and a social life are, by definition, also mutually exclusive.

Though that also depends on your definition of a social life.

Rene Lacoste said...

Engineering :P

Sherry Wasandi said...

Ha.

Engineering. IT.
The Great Indian Stereotype.

Anonymous said...

rochester http://gotuc.net/members/Polar-Heart-Rate-Monitors/default.aspx http://gotuc.net/members/Popcorn-Machines/default.aspx http://gotuc.net/members/Garage-Door-Openers/default.aspx http://gotuc.net/members/Area-Rugs/default.aspx http://gotuc.net/members/Omeprazole/default.aspx

Tushar said...

Whenever faced with a science/math puzzle, my reflex is to shout out to Wikipedia much like a infant to his Mum. Generally if my Wikipedian mother is in a beneficent mood she blesses with an answer. Here's Yours: http://en.wikipedia.org/wiki/Banker%27s_algorithm

From my sleepless nights with Galvin I ironically recall something called the 'sleeping barber algorithm' amongst many others which implemented mutual exclusion between processes by passing a mutex[wiki for details] token.

But implementing mutex isn't the brightest(optimal) approach here. Notice how the algorithm gets around that.

Well if the intention of the post was to arrive at the shining conclusion you did at the end. Contingent apologies for clearly missing it. :)

General note: I like what you've done to the place!

Sherry Wasandi said...

@Tushar: Good Sir, you have just jolted my gray cells out of a sabbatical. Given to sloth and a recently acquired taste for inactivity, they will whine and screech while I force-feed them the solution. Thank you.

Alas, the sleeping barber no longer resides in the aforesaid tome, having been replaced by the Dining Philosopher's Problem.
http://en.wikipedia.org/wiki/Dining_philosophers_problem

I am taking your cue here. :)