unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Multithreading, again and again
@ 2011-09-28  6:49 Dmitry Antipov
  2011-09-28  7:50 ` joakim
                   ` (4 more replies)
  0 siblings, 5 replies; 33+ messages in thread
From: Dmitry Antipov @ 2011-09-28  6:49 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2011-10-22 20:27 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-28  6:49 Multithreading, again and again Dmitry Antipov
2011-09-28  7:50 ` joakim
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).