From 9b28f6ac7ad35a4061de179a3a1954c3bf6017bc Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sat, 13 Dec 2003 12:32:41 +0000 Subject: [PATCH] 0.8.6.37 Remove unnecessary #inclues from gencgc.c Update NEWS file and manual for futex and new fg/bg manipulation --- NEWS | 6 ++++ doc/beyond-ansi.xml | 92 ++++++++++++++++++++++++++++---------------------- src/runtime/gencgc.c | 5 --- version.lisp-expr | 2 +- 4 files changed, 58 insertions(+), 47 deletions(-) diff --git a/NEWS b/NEWS index 0362e29..a55d2f7 100644 --- a/NEWS +++ b/NEWS @@ -2196,6 +2196,12 @@ changes in sbcl-0.8.6 relative to sbcl-0.8.5: in some circumstances. changes in sbcl-0.8.7 relative to sbcl-0.8.6: + * When built with the :SB-FUTEX feature, threaded builds now take + advantage of the "fast userspace mutex" facility in Linux kernel 2.6 + for faster/more reliable mutex and condition variable support. + * Incompatible change (but one you probably shouldn't have been using + anyway): the interface and code for arbitrating between multiple + threads in the same user session has been redesigned. * bug fix: GET-SETF-EXPANSION no longer throws an internal type error when called without an explicit environment argument. (thanks to Nikodemus Siivola) diff --git a/doc/beyond-ansi.xml b/doc/beyond-ansi.xml index c05dcee..71f1bee 100644 --- a/doc/beyond-ansi.xml +++ b/doc/beyond-ansi.xml @@ -167,29 +167,6 @@ their documentation strings. are per-thread. -sb-ext:quit exits the current thread, not -necessarily the whole environment. The environment will be shut down -when the last thread exits. - - -Threads arbitrate between themselves for the user's attention. -A thread may be in one of three notional states: foreground, -background, or stopped. When a background process attempts to print a -repl prompt or to enter the debugger, it will stop and print a message -saying that it has stopped. The user at his leisure may switch to -that thread to find out what it needs. If a background thread enters -the debugger, selecting any restart will put it back into the -background before it resumes. - - -If the user has multiple views onto the same Lisp image (for -example, using multiple terminals, or a windowing system, or network -access) they are typically set up as multiple `sessions' such that each -view has its own collection of foreground/background/stopped threads. -sb-thread:make-listener-thread can be used to -start a new thread in its own `session'. - - Mutexes and condition variables are available for managing access to shared data: see @@ -204,6 +181,35 @@ managing access to shared data: see and poke around in their documentation strings. + +Sessions + +If the user has multiple views onto the same Lisp image (for +example, using multiple terminals, or a windowing system, or network +access) they are typically set up as multiple `sessions' such that +each view has its own collection of foreground/background/stopped +threads. A thread which wishes to create a new session can use the +sb-thread:with-new-session to remove itself from +the current session (which it shares with its parent and siblings) and +create a fresh one. See also +sb-thread:make-listener-thread. + +Within a single session, threads arbitrate between themselves +for the user's attention. A thread may be in one of three notional +states: foreground, background, or stopped. When a background process +attempts to print a repl prompt or to enter the debugger, it will stop +and print a message saying that it has stopped. The user at his +leisure may switch to that thread to find out what it needs. If a +background thread enters the debugger, selecting any restart will put +it back into the background before it resumes. Arbitration for the +input stream is managed by calls to +sb-thread:get-foreground (which may block) and +sb-thread:release-foreground. + +sb-ext:quit terminates all threads in the +current session, but leaves other sessions running + + Implementation (Linux x86) @@ -224,19 +230,25 @@ expects threading or creates new threads, and the thread library in question uses %fs in an incompatible way. -Threads waiting on queues (e.g. for locks or condition -variables) are put to sleep using sigtimedwait() -and woken with SIGCONT. - +There are two implementation mechanisms for queueing. If SBCL +was built on an NPTL-capable Linux system (2.6 or some vendor 2.4 +ports) with the :SB-FUTEX feature, queuing will be doneusing the +sys_futex() call. Otherwise it will fall back to +using sigtimedwait() to sleep and a signal +(SIG_DEQUEUE, one of the POSIX RT signals) to wake. &SBCL; at present will alway have at least two tasks running as seen from Linux: when the first process has done startup initialization (mapping files in place, installing signal handlers etc) it creates a new thread to run the Lisp startup and initial -listener. The original thread stays around to reap dead subthreads -and deallocate their resources (e.g. stacks) when they exit. +listener. The original thread stays around to reap it when it's dead +and deallocate its resources (e.g. stacks) when it exits. +It should be noted that the initial thread does less and less in +each new release of SBCL, and one day soon will probably go away +altogether. + Garbage collection is done with the existing Conservative Generational GC. Allocation is done in small (typically 8k) regions : each thread has its own region so this involves no stopping. However, @@ -261,15 +273,12 @@ on keyboard interrupt handling: pressing your terminal's intr key (typically Control-C) will interrupt all processes in the foreground process group, including Lisp threads that &SBCL; considers to be notionally `background'. This is undesirable, so background threads -are set to ignore the SIGINT signal. Arbitration for the input stream -is managed by locking on sb-thread::*session-lock* - +are set to ignore the SIGINT signal. -A thread can be created in a new Lisp 'session' (new terminal or -window) using sb-thread:make-listener-thread. -These sessions map directly onto POSIX sessions, so that pressing -Control-C in the wrong window will not interrupt them - this has been -found to be embarrassing. +sb-thread:make-listener-thread in addition +to creating a new Lisp session makes a new POSIX session, so that +pressing Control-C in one window will not interrupt another listener - +this has been found to be embarrassing. @@ -282,10 +291,11 @@ found to be embarrassing. sb-ext:*posix-argv*. The UNIX environment can be queried with the sb-ext:posix-getenv function. -The &SBCL; system can be terminated with sb-ext:quit, -optionally returning a specified numeric value to the calling Unix -process. The normal Unix idiom of terminating on end of file on input -is also supported. +The &SBCL; system can be terminated with +sb-ext:quit, (but see notes above about threads +and sessions) optionally returning a specified numeric value to the +calling Unix process. The normal Unix idiom of terminating on end of +file on input is also supported. diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index 3d14487..71ff11a 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -43,11 +43,6 @@ #include "genesis/weak-pointer.h" #include "genesis/simple-fun.h" -#ifdef LISP_FEATURE_SB_THREAD -#include -#include /* threading is presently linux-only */ -#endif - /* assembly language stub that executes trap_PendingInterrupt */ void do_pending_interrupt(void); diff --git a/version.lisp-expr b/version.lisp-expr index cd7aefc..59ec466 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.6.36" +"0.8.6.37" -- 1.7.10.4