Matt Birkholz [Sat, 20 Dec 2014 21:00:43 +0000 (14:00 -0700)]
smp: Wake io-waiter when necessary. Add io-waiter-registry...
...a copy of io-registry for io-waiter to block on while other threads
modify io-registry. Test io-registry in thread-timer-interrupt-
handler only when there is no io-waiter.
Matt Birkholz [Sat, 20 Dec 2014 16:15:03 +0000 (09:15 -0700)]
smp: Check for SIGCHLD in thread timer interrupt handler.
An idle thread might get a SIGCHLD, wake and run the thread timer
interrupt handler (since there is no subprocess-status-change
interrupt) and return to idle. If it is not the io-waiter, it does
not call test-select-registry nor otherwise notice the subprocess
status change.
Funnel all status change notifications through handle-subprocess-
status-change. It uses the last-global-tick variable to remember the
tick when threads blocking on status changes were last woken.
Matt Birkholz [Tue, 25 Nov 2014 15:46:15 +0000 (08:46 -0700)]
smp: unshare: UX trap_state and current_interruptable_extent.
Split the thread-local parts out of UX_initialize_trap_recovery into
UX_initialize_trap_state, and those of OS_initialize into
OS_initialize_processor.
Matt Birkholz [Sat, 20 Dec 2014 15:50:09 +0000 (08:50 -0700)]
smp: Initialize thread-local compiler_utilities.
Split the thread-local parts of compiler_initialize into
compiler_initialize_processor, those of compiler_reset into
compiler_reset_processor. Split the non-thread-local parts of
ASM_RESET_HOOK into ASM_INIT_HOOK, i.e. i386_reset_hook into
i386_init_hook. Call the _processor versions in co-processor startup
and SMP-GC-WAITs.
Add compiler_reset_p flag to processor_t so that load-band
(compiler_reset) can notify the other processors to load the new
compiler_utilities into their Registers slots.
Matt Birkholz [Sat, 20 Dec 2014 15:37:56 +0000 (08:37 -0700)]
smp: Synchronize initialized processors.
The main pthread must wait for the other processors to be initialized,
else the first GC waits forever for processors that cleared the
global-gc interrupt while initializing.
Matt Birkholz [Fri, 19 Dec 2014 23:53:42 +0000 (16:53 -0700)]
smp: Add configure option --enable-smp.
Arrange for multiple Scheme machines, "processors" (pthreads), to
share the heap. Each gets its own stack and "local" heap areas.
Gc-flips trace the stacks and evacuate the local heaps into the shared
heap. The dump-band primitive now works like half a gc-flip,
evacuating the local heaps and saving the shared heap to disk before
the primitive gc daemons can start consing in a local heap again.
Matt Birkholz [Fri, 19 Dec 2014 21:50:27 +0000 (14:50 -0700)]
smp: Punt "permanent" i/o thread events.
A "permanent" input channel in the system select registry will cause
the io-waiter to spin until a thread reads the available input.
Always removing an entry after its event is delivered allows the
io-waiter to block until the thread processes the event, reads the
available input, and blocks again.
Matt Birkholz [Fri, 19 Dec 2014 19:29:29 +0000 (12:29 -0700)]
smp: Accommodate multiple processors.
Keep the threads running on each processor in the current-threads
vector. Change the running list into a runnable list: the threads
that are runnable but not currently running on a processor.
Matt Birkholz [Wed, 5 Nov 2014 20:27:11 +0000 (13:27 -0700)]
smp: Clobber fluid-let and the (runtime state-space) package.
UNimplement fluid-let using dynamic-wind as a backward compatibility
kludge. Subsystems still using fluid-let, e.g. LIAR, must not be run
in multiple threads simultaneously. Fluid-let no longer provides
thread-local storage.
Replace the previously fluid-assigned bindings state-space:local and
(runtime dynamic)bindings with thread slots dynamic-point and
dynamic-environment. Split the initialization of (runtime thread)
into "low" and "high" procedures. The "low" procedure is applied
early in the bootstrap to create the initial thread, whose dynamic
state is needed later. Lose the error handling in wait-for-io; it
runs when there is no current thread, thus no way to bind-condition-
handler.
Replace the uniprocessor-only Hanson/Lamping state-spaces with
Scheme48's multiprocessing-friendly dynamic-points in a new package
(runtime wind).
Replace the fluid-let with its expansion into a dynamic-wind, which
works only if the bootstrap proceeds in one thread and thus
thread-local values for boot-inits are not needed.