all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ken Raeburn <raeburn@raeburn.org>
To: Daniel Colascione <dancol@dancol.org>
Cc: Tom Tromey <tromey@redhat.com>, Emacs discussions <emacs-devel@gnu.org>
Subject: Re: [PATCH 03/10] introduce systhread layer
Date: Mon, 13 Aug 2012 06:21:24 -0400	[thread overview]
Message-ID: <9C928EA6-6467-422C-842B-9EA7E37C2A91@raeburn.org> (raw)
In-Reply-To: <50246659.80200@dancol.org>

> 
> 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	other threads:[~2012-08-13 10:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-09 19:38 [PATCH 03/10] introduce systhread layer Tom Tromey
2012-08-10  1:39 ` Daniel Colascione
2012-08-13 10:21   ` Ken Raeburn [this message]
2012-08-13 13:21     ` Stefan Monnier
2012-08-13 14:22     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9C928EA6-6467-422C-842B-9EA7E37C2A91@raeburn.org \
    --to=raeburn@raeburn.org \
    --cc=dancol@dancol.org \
    --cc=emacs-devel@gnu.org \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.