Re: Writing a Windows Service in Common Lisp
- From: Kaz Kylheku <kkylheku@xxxxxxxxx>
- Date: Tue, 3 Feb 2009 23:49:07 +0000 (UTC)
On 2009-02-03, Pascal Costanza <pc@xxxxxxxxx> wrote:
Raffael Cavallaro wrote:
On 2009-02-02 19:55:49 -0500, Zach Beane <xach@xxxxxxxx> said:
Not true. Corman Lisp, Allegro Common Lisp, and LispWorks Common Lisp
all support threads on Windows.
Right, but with LispWorks for example only one thread can be running in
the lisp at a time. Others that are pure foreign calls might run
concurrently but you can't have two *lisp* threads running concurrently
on a multi core machine. So even though LispWorks uses native threads,
those native threads won't use multiple cores if those threads are
running lisp code.
LispWorks 6.0 will not only have removed that limitation, but will
actually introduce support for running threads on different cores.
To do that they will have to rethink their entire idiotic threading API.
Anyone who thinks that a PROCESS-WAIT function is a good idea, needs to go back
to at least the middle 1970's and read a few papers on concurrency.
How can you safely wait for a condition to become true, and be sure that it's
still true after you are done waiting, if you are not holding a lock, that is
atomically given up when you suspend, and re-acquired, and if you have not
re-tested that the condition is still true?
What they need to do is design a sane new multithreading API, and support the
old API as a backwards-compatibility layer on the new threading.
Threads participating using the old API can be routed to the acquisition of a
global mutex which will serialize them. The process-wait function can work
against that mutex: give up the mutex atomically to go to sleep, then
re-acquire the mutex and re-test the condition, possibly going back to sleep if
it's not true.
New-style thread can explicitly grab the mutex before entering any subsystem
based on the old-style threading. Or use some macro like
(mp:with-braindamaged-threading
(legacy-function))
The macro will acquire and release the necessary lock, with unwind protection.
.
- Follow-Ups:
- Re: Writing a Windows Service in Common Lisp
- From: Madhu
- Re: Writing a Windows Service in Common Lisp
- From: joswig@xxxxxxxxxxxxxxxxxxxxxxx
- Re: Writing a Windows Service in Common Lisp
- References:
- Re: Writing a Windows Service in Common Lisp
- From: MasterZiv
- Re: Writing a Windows Service in Common Lisp
- From: Zach Beane
- Re: Writing a Windows Service in Common Lisp
- From: Raffael Cavallaro
- Re: Writing a Windows Service in Common Lisp
- From: Pascal Costanza
- Re: Writing a Windows Service in Common Lisp
- Prev by Date: Re: about pushnew
- Next by Date: Re: Writing a Windows Service in Common Lisp
- Previous by thread: Re: Writing a Windows Service in Common Lisp
- Next by thread: Re: Writing a Windows Service in Common Lisp
- Index(es):
Relevant Pages
|