implementing Dijkstra's guarded commands

Don Libes libes at cme-durer.ARPA
Thu Jul 14 13:38:26 AEST 1988


I am rendering an algorithm into C that was originally written using
Dijkstra's guarded commands.  I am wondering if there is a nice way of
writing the C so that the algorithm preserves the possibility for
parallel execution - should such a processor appear on my desk in the
near future.  Indeed, I've been specifically told that there is a high
likelihood that the code will be moved to a parallel environment.
Which one, however, is unknown at this time.

By "possibility", I mean "with minimal code rewriting".  For example,
a simplistic way is to ignore the potential for parallel execution and
just fixedly serialize the statements.  But this is obviously not in
the spirit of what I am asking.

I am prepared to accept that this is entirely out of the realm of C.
After all, it seems as though many people are barely able to come to
terms with the idea of a compiler rearranging operands in an
expression.  Now, I'm asking about rearranging statements in a
subroutine.

Yes, I realize this is a very difficult problem.  For example,
parallel execution of guards containing functions with side-effects
would be awful.  (Fortunately, I don't believe I have to worry about
that particular problem.)

Anyway, I have never heard of any such conventions.  Even if they are
just personal (i.e., used only by yourself), I would be interested in
hearing about them.  Pointers to literature gratefully accepted, also.

Don Libes          cme-durer.arpa      ...!uunet!cme-durer!libes



More information about the Comp.lang.c mailing list