Saturday, January 28, 2012

Why I Like Threads

To me, `Coding' has more to to with being an outstanding Animator  -- ensuring that my character's actions are in tune with the rules of Cartoon Physics --  than simply computing and passing results.



I am about 8 months in to earning by Master's Degree in Computer Engineering from SCU, and my favorite class this year, entitled "Operating Systems," has just hit Pay Dirt!

Within the required reading, Tannenbaum is explaining the broad concepts, to intricate detail (ala: ground-up-in-abstract... heh), concerning the topic of 'Threads.'

Background

Informally: the term threading is the use of rather simple, and therefore powerful, programming techniques and constructs to keep modern computers from working like Word 2.0. Back then, when you selected the "Save..." menu item, your computer completely froze until the disk was done being written to.

The reason your PC Jr. was unable to respond to outside stimuli had a lot to do with the inability of the [now] primitive microprocessors and software to handle the human equivalent* of drinking a sip of coffee and scratching an itch simultaneously.

Today, Computers can do this.  With technological advances comes the ability to execute thousands, or even millions, of separate chores at once... though not really**.

*I am not yet sure if science™ has yet resolved the question of whether an intelegent organism is actually capable of processing two things at once. Though, I do hear rumors that there is an ever-increasing number iPhones being damaged due to sudden deceleration in concert with auto accidents... so the jury is -- most certainly -- still out.

**I'm still not there, in the book...

My Revelation

Remember that old cartoon, where the pro- and antagonists are scrumming along, humorously slapping each other around, tit-for-tat, and there's the sound of a wheel of rubber gloves rhythmically striking a brick wall? Inevitably, they transfer the fight over the edge of a cliff, and the slapping continues... in free-fall.

That's what I now think of when I see pure threading constructs in programming: choreographed, perfect, comedic free-fall.

... and when I think of threadding in a Windows, I also hear that comic slapping sound.

The analogies

  • The free space we see our characters falling through is, in truth, contrived. On one level, the environment, and the characters, are provided to us by the animator. In threading, the Operating System is that free space. Both have significant and arbitrary power over the characters in question.
  • The physics of the cartoon is arbitrary, and can be modified for comic relief. So, too, with Operating Systems.
  • The Characters are, to the viewer's mind, set in their pattern of action. The only way to halt the fight is to stop the film. So too, with the threaded programs.
  • Once the animator has committed their subjects to film, there is no turning back: neither the audience, nor the animator has a way to change the outcome of the fight. So too, with threaded code.

1 comment:

Rose said...

Kitchen Plumbing is an essential component of any home, as it facilitates everyday activities such as cooking, cleaning, and food preparation. A well-designed and properly functioning kitchen plumbing system ensures the smooth operation of sinks, faucets, dishwashers, garbage disposals, and other kitchen fixtures.