[Eager-future-devel] Hard-limit added to thread pool
Vladimir Sedach
vsedach at gmail.com
Thu Feb 11 10:22:39 UTC 2010
Hi Bill,
The main reason I forked Eager Future from PCall is this behavior -
the semantics of having SELECT multiplex on futures that are waiting
on external events is very different when you can always guarantee
that that future will get assigned to a thread vs. when you let it lie
around in a queue. There's really no (easy/sane) way to guarantee any
kind of fairness in the latter scenario. Note that your patch wouldn't
even provide FIFO ordering for waiting tasks - the task list is a
stack. The former approach assumes that the underlying thread
implementation will be "reasonably fair" and everything will be
alright.
Of course this leaves the burden of resource management to the
application. The idea is that the application code can include a
better approach to scheduling tasks than a PCall-style FIFO queue
would provide.
Vladimir
2010/2/9 Bill St. Clair <wws at clozure.com>:
> I decided I wanted a way to put an upper-limit on the number of threads
> created by the eager-future thread pool. Very simple change. Please
> integrate it.
>
> -Bill St. Clair
> wws at clozure.com
>
> $ darcs diff
> diff -rN old-eager-future/package.lisp new-eager-future/package.lisp
> 5c5,6
> < #:%thread-pool-soft-limit)
> ---
>> #:%thread-pool-soft-limit
>> #:%thread-pool-hard-limit)
> diff -rN old-eager-future/threads.lisp new-eager-future/threads.lisp
> 6a7
>> (hard-limit :accessor hard-limit :initform nil)
> 13a15
>> (define-symbol-macro %thread-pool-hard-limit (hard-limit *thread-pool*))
> 42c44,46
> < (if (= (free-thread-counter thread-pool) (length (tasks thread-pool)))
> ---
>> (if (and (= (free-thread-counter thread-pool) (length (tasks
> thread-pool)))
>> (or (null (hard-limit thread-pool))
>> (< (length (threads thread-pool)) (hard-limit
> thread-pool))))
>
>
> _______________________________________________
> Eager-future-devel mailing list
> Eager-future-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/eager-future-devel
>
More information about the eager-future-devel
mailing list