Is it too late for this?

I wanted to request that people comment on this as a potential RFC.  So,
without further regression:

=head1 TITLE

Logic Variables for Synchronization of Lightweight Threads

=head1 VERSION

  Maintainer: James Bowery <[EMAIL PROTECTED]>
  Date: 09 Nov 2000
  Version: 1
  Mailing List:
  Number: ???

=head1 ABSTRACT

Perl needs a threading model similar to Mozart (www.mozart-oz.org).
Mozart's logic variable synchronization of lightweight threads allows
creation of distributed programs with simple semantics and efficient
implementation.


=head1 DESCRIPTION

The Mozart threading model uses logic variables to create synchronization
between threads.  This can be viewed as automatic construction of dataflow
dependency graphs, or as what logic programming calls "AND-parallelism".
Either way, synchronization falls out of functional or relational dependency
inherent in the semantics of the program rather than being an additional
thing for the application programmer have to write and therefore possibly
write wrong.  Constraints may be added to logic variables consistent with
prior constraints but they may not be deconstrained once successfully
constrained.

Comparing Java to Mozart, a simple consumer-producer multithreaded
application running within:

The same processor:
               Java         Mozart
Execution time 17.6 seconds 3.9 seconds
Lines Code     108          28

Distributed processors:
               Java   Mozart
Execution time 1 hour 8.0 seconds
Lines Code     220    32

(See ref 1.)

=head1 IMPLEMENTATION

Mozart's threading model has been implemented for other languages (see ref
2).  is Mozart's "computation space" construct.  Computation spaces are
heirarchical collections of threads and logic variables.  Each thread and
each logic variable belongs to exactly one computation space.  When a logic
variable is introduced that is "local" to a thread, it spawns a new
computation space.  "local" as used herein has the same scoping as the Perl
"local" keyword:  upward visibilty and downward invisibility.  When a thread
attempts to add a binding (constraint) on a logic variable that is
inconsistent with prior bindings, the thread fails thus raising the
associated exception.  (See ref 3)

For simplicity of initial implementation, constraints could be limited to
simple single-assignment dataflow variables and later expanded to numeric
relations like >, < and != and might someday become as sophisticated as
performing regular expression algebra to determine consistentcy of adding
regular expression constraints to variables.

=head1 REFERENCES
  (1) "An Example of Programming in Mozart versus Java" by Per Brand
(http://www.sics.se/~perbrand/javaVSMozart/)
  (2) "Efficient Logic Variables for Distributed Computing" by Haridi, Van
Roy, Brand, Mehl, Scheidhauer and Smolka
http://www.mozart-oz.org/papers/abstracts/TOPLAS99.html
  (3) "Computation Spaces" from the Mozart documentation
http://www.mozart-oz.org/documentation/tutorial/node12.html#label65

Reply via email to