Serialize use of the shared parts of the machine, and you are in
business. What could go wrong? :-}
-Fluid-let was an obstacle, but it was excised from the runtime system.
-The remaining uses can be kludged in an SMP-enabled world, e.g. by
-ensuring the compiler runs in one thread at a time.
-
-Without-interrupts has been used as a way to exclude other threads.
-It produced an atomic section. In an SMP-enabled world, running with
-timer interrupts masked guarantees only that the current thread will
-not be switched out -- it will keep running on the current processor.
-Threads on other processors will still be running, and may see
-intermediate, inconsisent states (depending on subsystem). The use of
-each such subsystem must be serialized/atomized somehow.
-
* Multiple Machines
The current implementation assumes multiple OS threads (pthreads) run
The OS process receives a timer interrupt (SIGALRM) regularly while
there are threads in the runnable queue, and whenever a thread would
-wake from sleep. The signal handler might run in any pthread(?), but
+wake from sleep. The signal handler might run in any pthread, but
is forwarded to the next processor in a ring of all processors.
Thus 2 processors are interrupted half as often with the same thread
timer interval. Four processors run uninterrupted for 4 times the
* Analyses
There are three major concerns when running multiple Scheme machines.
-The fluid-let form needed to be replaced. The use of without-
-interrupts reviewed because of the change of its behavior. And the
-variables of the microcode must be sorted between thread-local and
-shared, and the shared variables must protected from simultaneous,
-conflicting updates.
-** fluid-let
+ * Fluid-let is not properly implemented in SMP worlds.
+
+ * Microcode state variables need to be declared pthread-local.
+
+ * Without-interrupts no longer ensures a globally atomic section.
-The "fluid-let" form still exists in the runtime system. The command
-line
+** Fluid-Let
+
+The "fluid-let" form has already been replaced by let-fluids
+throughout the runtime system. The command line
cd src/runtime/ && grep -in '(fluid-let' *
-reveals the 4 remaining lines.
+produces 4 hits revealing 2 remaining uses.
pp.scm:66: (FLUID-LET . ,print-let-expression)
runtime.cbf:27:(fluid-let ((compiler:coalescing-constant-warnings? #f))
runtime.pkg:4838: (fluid-let :fluid-let)
runtime.sf:34:(fluid-let ((sf/default-syntax-table (->environment '(RUNTIME))))
-\f
-** microcode state
-The list of state variables used by the various modules of the
-microcode were found by applying nm to each module listed on the
-linker command line. Of 103 Unix .o files, 91 appear on the Unix link
-command line. The remaining 12 belong to the 7 microcode modules and
-./findprim.
+These are safe assuming runtime.sf/cbf are not loaded while another
+thread is running the scode-optimizer/compiler. Eventually LIAR and
+SF will be fluidized (parameterized?) and these two forms will be
+replaced by let-fluid combinations (parameterize syntax?).
+\f
+** Microcode State
+
+While many variables were declared pthread-local when the interpreter
+and garbage-collector were extended, a careful survey is needed to
+find and sort the remaining variables. Each must be declared
+pthread-local or shared. The shared variables should be read-only or
+protected from simultaneous, conflicting updates.
+
+The microcode's variables were found by applying nm to each module
+listed on the linker command line. Of 103 Unix .o files, 91 appear on
+the Unix link command line. The remaining 12 belong to the 7
+microcode modules and ./findprim.
nm --defined-only artutl.o avltree.o bkpt.o bignum.o bigprm.o bitstr.o boot.o char.o daemon.o debug.o dfloat.o error.o extern.o fasdump.o fasl.o fasload.o fixnum.o floenv.o flonum.o gcloop.o generic.o hooks.o hunk.o intern.o interp.o intprm.o list.o lookprm.o lookup.o memmag.o missing.o obstack.o option.o osscheme.o ostty.o outf.o prim.o primutl.o ptrvec.o purify.o purutl.o regex.o rgxprim.o step.o storage.o string.o syntax.o sysprim.o term.o transact.o utabmd.o utils.o vector.o wind.o prosenv.o prosfile.o prosfs.o prosio.o prosproc.o prospty.o prosterm.o prostty.o pruxsock.o prossmp.o intext.o pruxenv.o pruxfs.o pruxio.o ux.o uxctty.o uxenv.o uxfile.o uxfs.o uxio.o uxproc.o uxsig.o uxsock.o uxterm.o uxtop.o uxtrap.o uxtty.o uxutil.o cmpauxmd.o terminfo.o tterm.o pruxdld.o pruxffi.o cmpint.o cmpintmd.o comutl.o usrdef.o \
| grep -v '^[^ ]* [TtRr] '