Reworking scheduler

darcs
slava 2006-06-15 02:58:17 +00:00
parent 23bc02dab6
commit b4bff0a33d
6 changed files with 66 additions and 59 deletions

View File

@ -1,52 +1,26 @@
- unix i/o: problems with passing f to syscalls
- if a primitive throws an error, :c doesn't show the call frame there
- "benchmark/help": without a yield UI runs out of memory
- x11 title bars are funny
+ httpd:
- outliners don't work
- browser responder doesn't work
- fix remaining HTML stream issues
- update for file style prop becoming presented <file>
- fix this:
[ 1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10 11 11 11 113 ] .
[ 1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10 11 11 11 113
]
- code walker & exceptions -- test and debug problems
- another i/o bug: on factorcode eventually all i/o times out
- bug in pound?
- factorcode httpd started using 99% CPU, but still received connections;
closing read-fds solved it
- if the listener is running a command when the image is saved, it
restores to an unresponsive gadget
- fix top level window positioning
- services do not launch if factor not running
- rollover is not updated on window focus changes
- amd64 crash
- x86 bootstrap intermittent crash
- get factor running on mac intel
- constant branch folding
- cocoa: starting the UI with +foo switches opens them as files
+ refactor style stack code so that nested styles are handled at a lower-level
- with-style & with-stream-style
- in HTML, we can nest div tags, etc
- prettyprinter's highlighting of non-leaves looks bad
- better line spacing in ui and html - related issue
+ fix compiled gc check
- there was a performance hit, investigate
- float boxing and overflow checks need a gc check too
+ io:
- unix i/o: problems with passing f to syscalls
- factorcode httpd started using 99% CPU, but still received connections;
closing read-fds solved it
- gdb triggers 'mutliple i/o ops on port' error
- better i/o scheduler - eg, yield in a loop starves i/o
- "localhost" 50 <client> won't fail
+ help:
- refactor style stack code so that nested styles are handled at a lower-level
- with-style & with-stream-style
- in HTML, we can nest div tags, etc
- automatically update help graph when adding/removing articles/words
- help search:
- edit distance algorithm
@ -55,6 +29,15 @@
+ ui:
- x11 title bars are funny
- cocoa: starting the UI with +foo switches opens them as files
- if the listener is running a command when the image is saved, it
restores to an unresponsive gadget
- fix top level window positioning
- services do not launch if factor not running
- prettyprinter's highlighting of non-leaves doesn't really work
- better line spacing in ui and html - related issue
- rollover is not updated on window focus changes
- fix listener scroll to
- { } H{ } [ ] tabular-output -- excess newline
- multiple listener-run-files is broken
@ -72,8 +55,6 @@
- only do clipping for certain gadgets
- use glRect
- use complex numbers instead of arrays for co-ordinates
- decrease minimum growable size from 50 to 4 or something, to reduce
memory consumption of a gadget with one child
- use vertex arrays
- use display lists
- reimplement tab completion
@ -85,6 +66,12 @@
+ compiler/ffi:
- fix compiled gc check
- there was a performance hit, investigate
- float boxing and overflow checks need a gc check too
- amd64 crash
- get factor running on mac intel
- constant branch folding
- type inference at branch merge points
- free up r11, r12 as a vreg on ppc
- float= on powerpc doesn't consider nans equal
@ -104,6 +91,13 @@
+ misc:
- fix this:
[ 1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10 11 11 11 113 ] .
[ 1 2 3 4 5 6 7 8 9 10 10 10 10 10 10 10 10 10 10 11 11 11 113
]
- code walker & exceptions -- test and debug problems
- slice: if sequence or seq start is changed, abstraction violation
- make 3.4 bits>double an error
- break: perhaps use current stdio to run break listener

View File

@ -157,7 +157,7 @@ ARTICLE: "threads" "Multitasking"
{ $subsection run-queue }
{ $subsection sleep-queue }
{ $subsection schedule-thread }
{ $subsection next-thread } ;
{ $subsection idle-thread } ;
ARTICLE: "continuations-internals" "Continuation implementation details"
"A continuation is simply a tuple holding the contents of the four stacks:"

View File

@ -40,9 +40,6 @@ parser sequences sequences-internals words ;
"Not every word compiles, by design." print
terpri flush
"Building online help search index..." print flush
index-help
"Initializing native I/O..." print flush
"native-io" get [ init-io ] when
@ -61,6 +58,9 @@ parser sequences sequences-internals words ;
] when
] when
"Building online help search index..." print flush
index-help
[
boot
run-user-init

View File

@ -19,16 +19,23 @@ namespaces queues sequences vectors ;
: sleep-time ( sorted-queue -- ms )
dup empty? [ drop 1000 ] [ peek first millis [-] ] if ;
DEFER: next-thread
: do-sleep ( -- continuation )
sleep-queue* dup sleep-time dup zero?
[ drop pop second ] [ nip io-multiplex next-thread ] if ;
: next-thread ( -- continuation )
run-queue dup queue-empty? [ drop do-sleep ] [ deque ] if ;
: stop ( -- ) next-thread continue ;
! DEFER: next-thread
!
! : do-sleep ( -- continuation )
! sleep-queue* dup sleep-time dup zero?
! [ drop pop second ] [ nip io-multiplex next-thread ] if ;
!
! : next-thread ( -- continuation )
! run-queue dup queue-empty? [ drop do-sleep ] [ deque ] if ;
!
! : stop ( -- ) next-thread continue ;
!
! : init-threads ( -- )
! global [
! <queue> \ run-queue set
! V{ } clone \ sleep-queue set
! ] bind ;
: stop ( -- ) run-queue deque continue ;
: yield ( -- ) [ schedule-thread stop ] callcc0 ;
@ -44,8 +51,18 @@ DEFER: next-thread
try stop
] callcc0 drop ;
: (idle-thread) ( fast? -- )
#! If fast, then we don't sleep, just select()
sleep-queue* dup sleep-time dup zero?
[ drop pop second schedule-thread ]
[ nip 0 ? io-multiplex ] if ;
: idle-thread ( -- )
#! This thread is always running.
#! If run queue is not empty, we don't sleep.
run-queue queue-empty? (idle-thread) yield idle-thread ;
: init-threads ( -- )
global [
<queue> \ run-queue set
V{ } clone \ sleep-queue set
] bind ;
<queue> \ run-queue set-global
V{ } clone \ sleep-queue set-global
[ idle-thread ] in-thread ;

View File

@ -20,10 +20,6 @@ HELP: sleep-time "( vector -- ms )"
{ $values { "vector" "a sorted sleep queue" } { "ms" "a non-negative integer" } }
{ $description "Outputs the time until the next sleeping thread is scheduled to wake up, or -1 if there are no sleeping threads. The input must be a sorted sleep queue output by " { $link sleep-queue* } "." } ;
HELP: next-thread "( -- continuation )"
{ $values { "continuation" "a continuation" } }
{ $description "Outputs the next runnable thread. If there are no runnable threads, waits for a sleeping thread to wake up." } ;
HELP: stop "( -- )"
{ $description "Stops the current thread." } ;

View File

@ -116,7 +116,7 @@ GENERIC: task-container ( task -- vector )
: handle-fd ( task -- )
dup io-task-port touch-port dup do-io-task
[ pop-callback continue ] [ drop ] if ;
[ pop-callback schedule-thread ] [ drop ] if ;
: timeout? ( port -- ? )
port-cutoff dup zero? not swap millis < and ;
@ -125,7 +125,7 @@ GENERIC: task-container ( task -- vector )
[
nip dup io-task-port timeout? [
dup io-task-port "Timeout" swap report-error
nip pop-callback continue
nip pop-callback schedule-thread
] [
tuck io-task-fd swap bit-nth
[ handle-fd ] [ drop ] if