Skip to navigation
Analysis
Dick Pountain

How to build a computer smarter than a US president

Posted on 11 May 2010 at 11:01

Dick Pountain explains how to program an embedded processor to become more intelligent than Gerald Ford

Recently, I devoted this column to the revival of interest in parallel programming brought about by Intel’s multicore CPUs, and mentioned the Occam language tutorial that I once wrote for Inmos. Well, I received an email from Matt Jadud, assistant professor at Allegheny College in Meadville, Pennsylvania, who informs me that Occam not only isn’t dead, but that he and his colleagues use it to teach their students robotics, with great success.

Jadud and his group have written their own interpreter for a version of the language called occam-pi, which can be run from as little as 10KB of flash memory, and they’ve ported this onto a number of microcontroller chips including the 8-bit Hitachi H8/3292 used in the Mindstorms RCX programmable LEGO brick, and Atmel’s Atmega328 used in the Arduino control board, a product very popular with animatronic artists and hobbyists.

They said Gerald Ford was too dumb to walk and chew gum at the same time. Well, conventional computer programs are dumb that way too

Computers can be deployed in two quite different modes vis-à-vis the world. The first of these, and the most familiar, is where the computer builds a model of the outside world inside itself. This is most obvious in games, where you interact with those internal worlds via the screen, but spreadsheets and word processors equally mimic documents that would once have been scribbled with pen and ink on paper.

Embedded processing involves the exact reverse scenario, where a poor little computer has to interact with the big, cruel real world directly (through sensors, switches and motors) with little or no input from you. Maybe it’s controlling your washing machine, or your car engine, or a robot.

For this role you want a process-orientated language, one that concerns itself not with what exists but with what’s happening. Occam enables you to describe a problem in such a way that it could be computed by several different processors simultaneously, or by a single one imitating concurrency through time-sharing: it does that by abstracting the notion of communication between parallel processes.

Maybe some PC Pro readers are old enough to remember former US President Gerald Ford, of whom it was once cruelly said that he was too dumb to walk and chew gum at the same time. Well, conventional computer programs are dumb that way too, but not Occam.

To describe walking you might say something like:

PROC walk
WHILE walking
SEQ
left.foot.forward
right.foot.forward

To chew gum you might say:

PROC chew.gum
WHILE chewing
SEQ
grind.jaw.left
grind.jaw.right

Now we can emulate a smarter sort of president:

PROC smart.president
PAR
walk
chew.gum

SEQ simply means execute the following processes one after the other, while PAR means execute them at the same time. There’s another important construct called ALT, which says execute whichever of the following processes becomes ready first. Processes communicate values to each other through named channels rather than variables, and the receiving process waits patiently for the sender to send.

Occam was invented to be the lowest-level programming language for Inmos’ Transputer. Inmos failed to sell its model of communicating CPUs to the wider IT world because US firms at that time preferred the shared-memory model of concurrency, where CPUs communicate by writing to the same memory locations, with all the consequent problems over locking and integrity that still bedevil us today. However, Jadud’s group has demonstrated that you can implement Occam on many processor/communication combinations: it would look neat on a multicore Xeon with Intel’s new Light Peak fibre optics for channels, or equally on an Atom with USB 3.

But in the future, if we want to build truly smart computers we’ll need to combine the two modes of operation. Our brains maintain an internal model of the outside world even as our muscles and sensory organs propel us through it. To model that effectively, we need to look at adding Occam’s elegant model of concurrency to a powerful object-oriented language such as Ruby or even Java, in place of the clumsy and opaque tasking models currently used. Oh to be a comp-sci postgraduate with a private income.

Author: Dick Pountain

Subscribe to PC Pro magazine. We'll give you 3 issues for £1 plus a free gift - click here

From around the web

Be the first to comment this article

You need to Login or Register to comment.

(optional)

For more details about purchasing this feature and/or images for editorial usage, please contact Jasmine Samra on pictures@dennis.co.uk

advertisement

Latest News StoriesSubscribe to our RSS Feeds
Latest Blog Posts Subscribe to our RSS Feeds

advertisement

Sponsored Links
 
SEARCH
SIGN UP

Your email:

Your password:

remember me

advertisement


Hitwise Top 10 Website 2010
 
 

PCPro-Computing in the Real World Printed from www.pcpro.co.uk

Register to receive our regular email newsletter at http://www.pcpro.co.uk/registration.

The newsletter contains links to our latest PC news, product reviews, features and how-to guides, plus special offers and competitions.