Commit 846320dd authored by csr21's avatar csr21
Browse files

Change PROCESS-BLOCK implementation from queue to poll, motivated by

Change PROCESS-BLOCK implementation from queue to poll, motivated by
significantly less shocking peformance characteristics

darcs-hash:20031111000003-ed5a3-934e23be2de603ac78093adbfeb5cfe2e2074254.gz
parent d013400e
-*- Text -*- -*- Text -*-
--- Changes in SBCL CLX 0.5.4, FILL ME IN AT RELEASE TIME ---
A change in the implementation of PROCESS-BLOCK and PROCESS-WAKEUP
under multithreaded SBCL. Previous versions used queues and condition
variables, but this seems to have undesireable performance
characteristics; the newer version uses a polling loop calling
sched_yield() inside, which is more resource-hungry but greatly
improves responsiveness.
--- Changes in SBCL CLX 0.5.3, Sat Sep 6 12:14:39 UTC 2003 --- --- Changes in SBCL CLX 0.5.3, Sat Sep 6 12:14:39 UTC 2003 ---
We allow a PIXMAP-DEPTH of 12 in clx.lisp, despite not having any We allow a PIXMAP-DEPTH of 12 in clx.lisp, despite not having any
......
...@@ -1151,9 +1151,31 @@ ...@@ -1151,9 +1151,31 @@
(apply predicate predicate-args)))) (apply predicate predicate-args))))
#+(and sbcl sb-thread) #+(and sbcl sb-thread)
(defvar *process-conditions* (make-hash-table)) (progn
(declaim (inline yield))
(defun yield ()
(declare (optimize speed (safety 0)))
(sb-alien:alien-funcall
(sb-alien:extern-alien "sched_yield" (function sb-alien:int)))
(values)))
#+(and sbcl sb-thread) #+(and sbcl sb-thread)
(defun process-block (whostate predicate &rest predicate-args)
(declare (ignore whostate))
(declare (type function predicate))
(loop
(when (apply predicate predicate-args)
(return))
(yield)))
;;; FIXME: the below implementation for threaded PROCESS-BLOCK using
;;; queues and condition variables might seem better, but in fact it
;;; turns out to make performance extremely suboptimal, at least as
;;; measured by McCLIM on linux 2.4 kernels. -- CSR, 2003-11-10
#+(or)
(defvar *process-conditions* (make-hash-table))
#+(or)
(defun process-block (whostate predicate &rest predicate-args) (defun process-block (whostate predicate &rest predicate-args)
(declare (ignore whostate)) (declare (ignore whostate))
(declare (type function predicate)) (declare (type function predicate))
...@@ -1212,6 +1234,10 @@ ...@@ -1212,6 +1234,10 @@
(mp:process-yield)) (mp:process-yield))
#+(and sb-thread sbcl) #+(and sb-thread sbcl)
(defun process-wakeup (process)
(declare (ignore process))
(yield))
#+(or)
(defun process-wakeup (process) (defun process-wakeup (process)
(declare (ignore process)) (declare (ignore process))
(destructuring-bind (lock . queue) (destructuring-bind (lock . queue)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment