emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/10] introduce systhread layer


From: Ken Raeburn
Subject: Re: [PATCH 03/10] introduce systhread layer
Date: Mon, 13 Aug 2012 06:21:24 -0400

> 
> On 8/9/2012 12:38 PM, Tom Tromey wrote:
>> This introduces the low-level system threading support.  It also adds
>> the global lock.  The low-level support is a bit over-eager, in that
>> even at the end of the present series, it will not all be used.  I
>> think thiat is ok since I plan to use it all eventually.
>> 
>> I've only implemented the pthreads-based version.  I think it should
>> be relatively clear how to port this to other systems, though.
>> 
>> I'd also like to do a "no threads" port that will turn most things
>> into no-ops, and have thread-creation fail.  I was thinking perhaps
>> I'd make a future (provide 'threads) conditional on threads actually
>> working.  Thoughts on this?

Unless there's a platform where the support isn't possible, I'd suggest not 
doing this last bit, so that Emacs code (both Lisp and C) can assume threads 
are available.  Otherwise, either you can't use threads at all in the release, 
which means that code won't be exercised very well, or you write code that has 
to cope with both modes (which may simply mean crippling some features when 
threads aren't available, and ensuring that the rest of the code still works 
properly without those features), and probably only really gets tested well in 
the mode where threads are available.

What benefit do you think providing this "no threads" port would have?

On Aug 9, 2012, at 21:39, Daniel Colascione wrote:
> If threads don't execute simultaneously anyway (and if I understand your 
> design
> correctly, the global lock ensures they don't), then it might be worthwhile to
> also support a "green threads" implementation like GNU Pth or Windows fibers 
> in
> order to avoid OS-level context switch overhead.

Where every I/O operation needs to be rewritten to call some helper function 
that do the thread switching?  That sounds like a fine way to make the code 
really ugly. :-(  I think, too, we'd probably want support libraries (X11, 
image or sound processing, TLS, etc) to be able to do their thing (I/O, 
parsing, encryption) while another thread runs Lisp code, and if those 
libraries aren't written to use Pth or whatever, that won't happen.

I've worked on code where performance of the thread-switching support was a big 
deal.  I don't see Emacs falling into that category, at least not any time 
soon.  On the other hand, I do hope that people find more uses for thread 
support than occur to me right now, so….

Ken


reply via email to

[Prev in Thread] Current Thread [Next in Thread]