From: joakim@verona.se
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: Multithreading, again and again
Date: Wed, 28 Sep 2011 09:50:27 +0200 [thread overview]
Message-ID: <m3ty7xm7gc.fsf@chopper.vpn.verona.se> (raw)
In-Reply-To: <4E82C377.4040007@yandex.ru> (Dmitry Antipov's message of "Wed, 28 Sep 2011 10:49:27 +0400")
Dmitry Antipov <dmantipov@yandex.ru> writes:
> Hello all,
>
> this is an attempt to refresh the most important ideas everyone has about
> threads support in Emacs. Thanks in advance to all who spent their time
> thinking on answers. If someone thinks that I miss something important,
> notices and references to previous discussions around this topic are highly
> appreciated.
>
> 0. What we have, and where we go.
> What's the status of git://gitorious.org/emacs-mt/emacs-mt.git and
> http://bzr.savannah.gnu.org/r/emacs/concurrency? Whether there are
> plans for further development?
>
> 1. To thread or not to thread?
> Is there a consensus whether it's worth doing at all? If I don't miss
> something important from previous discussions (referenced from
> http://www.emacswiki.org/emacs/NoThreading, what a title), everyone
> agrees that some kind of threading is useful - but maybe someone has
> the votum separatum?
>
> 2. Hide them all!
> Should the threads be visible (may be created and managed) from Lisp,
> or they can just do some work orthogonal to it? If latter, which tasks may
> be implicitly threaded? Redisplay (one thread per frame)? Buffer/socket
> I/O? GC? Is it feasible to implement full implicit concurrency? For the
> rough example, with the Lisp engine as the pool of threads, where (eval
> FORM) just queues the FORM and then ask the pool to find a free thread
> and evaluate it?
>
> 3. Too big, too global.
> How to split/share/synchronize huge global state between threads?
> What should be thread-local? (I feel (current-buffer) should be
> global and max-lisp-eval-depth should be thread-local, but I suspect
> that there are much more controversial cases). Is it reasonable to
> have become-thread-local-on-write globals?
>
> 4. Say "thread"!
> What should be done in C to implement thread management in Lisp?
> I feel basically
>
> (let ((th (make-thread FUNCTION ARGS))) ...)
>
> should create thread object TH which represents running thread executing
> Lisp function FUNCTION with ARGS (like funcall, but within separate thread),
> and such thread object may be examined with stuff like (thread-running-p TH),
> canceled with (thread-cancel TH), asked for FUNCTION's return value with
> (thread-return TH), and so. But is this nothing more than adding some
> builtins? Will it require some more substantial language changes? What
> about old controversial topic on lexical vs. dynamic binding?
>
> 5. You and I.
> What synchronization primitives should be implemented? Atomic variables?
> Mutexes/semaphores? Barriers? Higher-level not-so-primitives like
> thread pools or multithreaded queues? Should some basic operations,
> like setq, be always atomic? Is it reasonable/feasible/useful to have
> special form like (with-atomic BODY...), where all BODY forms are evaluated
> atomically with respect to all other threads?
>
> 6. Under the cover.
> What other low-level changes are required for thread support?
> Basic structure of Lisp objects? Multiple stacks scanning for GC?
> Per-thread heaps for small objects?
>
> 7. Look around.
> Has someone an experience with development of multithreaded code for
> commercial Common Lisp implementations, most probably LispWorks and/or
> Allegro CL? If yes, can someone briefly explain pros and cons of their
> approach to multithreading?
>
> Dmitry
IMHO an interesting option is replacing the current Elisp implementation
with GNU Guile. The Guile-Emacs project is working on this. Guile
implements threads. That doesn't say anything about what the semantics
for threads should be in Elisp however. Guile-Emacs is IMHO the right
path for several reasons.
--
Joakim Verona
next prev parent reply other threads:[~2011-09-28 7:50 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-28 6:49 Multithreading, again and again Dmitry Antipov
2011-09-28 7:50 ` joakim [this message]
2011-09-28 7:55 ` Julien Danjou
2011-09-28 13:37 ` Stefan Monnier
2011-10-17 21:57 ` Juri Linkov
2011-10-18 1:18 ` Stefan Monnier
2011-10-19 15:18 ` Tom Tromey
2011-10-19 20:51 ` Dave Abrahams
2011-10-19 22:01 ` Stefan Monnier
2011-10-19 22:05 ` Dave Abrahams
2011-10-20 23:00 ` John Wiegley
2011-10-20 23:52 ` Dave Abrahams
2011-10-20 14:08 ` Richard Stallman
2011-10-20 1:12 ` SAKURAI Masashi
2011-10-20 17:09 ` Tom Tromey
2011-10-20 18:17 ` Stefan Monnier
2011-10-21 0:46 ` SAKURAI Masashi
2011-10-21 14:18 ` Nix
2011-10-21 14:48 ` Eli Zaretskii
2011-10-22 3:40 ` SAKURAI Masashi
2011-10-22 19:30 ` Tom Tromey
2011-10-22 20:27 ` Dave Abrahams
2011-10-18 8:24 ` Helmut Eller
2011-09-28 15:55 ` Helmut Eller
2011-10-19 15:14 ` Tom Tromey
2011-10-19 15:20 ` Tom Tromey
2011-10-19 18:30 ` Stefan Monnier
2011-10-19 19:00 ` Tom Tromey
2011-10-19 21:33 ` Stefan Monnier
2011-10-20 17:07 ` Tom Tromey
2011-10-20 18:33 ` Stefan Monnier
2011-10-20 20:54 ` Dave Abrahams
2011-10-20 20:57 ` 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=m3ty7xm7gc.fsf@chopper.vpn.verona.se \
--to=joakim@verona.se \
--cc=dmantipov@yandex.ru \
--cc=emacs-devel@gnu.org \
/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.