[plt-scheme] Using Scheme_Object * from another thread

From: Adam Wick (awick at cs.utah.edu)
Date: Wed May 25 13:04:20 EDT 2005

On May 25, 2005, at 9:22 AM, Hans Oesterholt-Dijkema wrote:
> Will this cause problems with mzscheme? (e.g. because schheme_malloc()/
> scheme_make_utf8_string() is not OS thread safe).

You will see intermittent failures in the 3m variants. I don't know the
non-3m code nearly as well, but I suspect you will see failures there,
as well.

In order to do this safely, you'd need to (a) completely block the 
Scheme
thread from allocating while your OS thread was running, (b) (most 
likely)
force a garbage collection immediately on starting the OS thread and 
(c) make
sure your OS thread isn't allocating enough memory such that it'll 
trigger a
collection after the collection in (b). I would suspect that enforcing 
these
would cost notably more than the savings you'll get from multithreading.



-Adam



Posted on the users mailing list.