new branch mozart-1-3-0-pthread

Denys Duchier Denys.Duchier at ps.uni-sb.de
Thu Sep 6 10:44:33 CEST 2001


pvr at info.ucl.ac.be (Peter Van Roy) writes:

> By 'system thread' do you mean 'Oz thread internal to the Mozart run-time
> system' or 'Operating system thread'?  The former is much preferable,
> if you can get away with it!

I mean the latter and they are intended for precisely those cases
where we cannot get away with an OZ thread, namely either (1)
potentially blocking system calls, or (2) slow/lengthy computations
(e.g. certain library calls for which you provide an Oz interface).
Both are problematic in our current system: system calls to "connect"
or "system" block the entire emulator and native wrappers for 3rd
party libraries often do the same _and_ gravely jeopardize scheduling
fairness among Oz threads (in some sense that I won't attempt to make
precise :-)

> There are some issues of asynchronous exception handling that show up
> here.  E.g., the synchronous fast step should return a variable that gets
> bound to 'normal' upon normal completion of the asynchronous slow step,
> or the exception, if the asynchronous slow step raises an exception.

What asynchronous exceptions?  If you are thinking "Oz exceptions",
forget it! the asynchronous step cannot even _look_ at Oz data
structures, much less invoke anything in the Oz runtime, and we don't
want a mutex safe-guarding every Oz heap access now, do we? :-)  Even
the possibility of merely holding on to an Oz value brings some
complexity since it needs to be seen by any potential concurrent
garbage collection (concurrent from the point of view of system
threads other than the main "emulator" one).

The asynchronous step executes straight C++ code.  All data that it
reads or mutates must have been setup synchronously prior to
initiating the asynchronous step.

You idea of an Oz variable to synchronize on is precisely what I do.
Binding of the variable occurs in the synchronous step that follows
the asynchronous one.

Cheers,

-- 
Dr. Denys Duchier			Denys.Duchier at ps.uni-sb.de
Forschungsbereich Programmiersysteme	(Programming Systems Lab)
Universitaet des Saarlandes, Geb. 45	http://www.ps.uni-sb.de/~duchier
Postfach 15 11 50			Phone: +49 681 302 5618
66041 Saarbruecken, Germany		Fax:   +49 681 302 5615
-
Please send submissions to hackers at mozart-oz.org
and administriva mail to hackers-request at mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.





More information about the mozart-hackers mailing list