From: Daniel Colascione <dan.colascione@gmail.com>
To: "Stephen J. Turnbull" <stephen@xemacs.org>
Cc: Tom Tromey <tromey@redhat.com>,
Lennart Borgman <lennart.borgman@gmail.com>,
rms@gnu.org, emacs-devel@gnu.org
Subject: Re: Patch for fields of `struct buffer'
Date: Tue, 01 Feb 2011 11:57:20 -0800 [thread overview]
Message-ID: <4D4865A0.8040903@gmail.com> (raw)
In-Reply-To: <87tygn3exw.fsf@uwakimon.sk.tsukuba.ac.jp>
[-- Attachment #1: Type: text/plain, Size: 3781 bytes --]
On 2/1/11 8:19 AM, Stephen J. Turnbull wrote:
> Lennart Borgman writes:
> > On Tue, Feb 1, 2011 at 1:10 PM, Stephen J. Turnbull <stephen@xemacs.org> wrote:
> > > Daniel Colascione writes:
> > >
> > > > The world is increasingly moving toward parallel processing,
> > >
> > > Since when does parallel processing == threads?
> >
> > I am a computer illiterate sometimes. Could you give us some hints
> > about the current status?
>
> Well, that's actually what I was asking Daniel. I'm not sure how
> illiterate you think you are, so please try not to be insulted if it's
> all too basic.
That's an excellent overview of the topic. Thanks for writing it, Stephan.
You're absolutely correct in that multiprocessing can also take provide
concurrency the ability to exploit SMP machines. But we've had it for
decades, and it doesn't seem to be used very much to solve some
persistent issues. Sure, flymake, flyspell, slime, M-x compile,
find-grep, and friends allow a lot of work to happen asynchronously. But
it's harder to use multiple processes to parallelize code written in
elisp, especially code that interacts with the user.
I actually prefer the shared-nothing multiprocessing approach in
general, but it's hard to take advantage of that in Emacs today, at
least for elisp. The startup time for a sub-Emacs (at least one that has
also processed user startup code) is high, we have no fork exposed to
elisp for easy data sharing, and there's no simple way to shuffle Lisp
data structures between the Emacs processes, though at least with prin1
and read, the last easier than it'd be in some other systems. You could
argue that bulk processing helpers should be written in something other
than elisp --- and in practice, they are --- but it complicates both
development and distribution.
Have you seen the Python multiprocessing module? It provides a simple,
elegant facilities to coordinate multiple communicating processes ---
things like queues and pipes. A similar approach would work fine for
Emacs as long as we're talking about bulk processing, e.g., parsing lots
of RFC2822 messages, or indexing hairy C++.
But for intricately coordinated work, it'd be a lot harder to allow
these multiple processes to effectively manipulate the same buffer or
communicate with the user: you'd have to either copy the whole thing,
which could be expensive for large buffers and which would have child
operate on stale data; you could provide a protocol for parent and child
to talk about buffers over IPC, but that would introduces complexity,
latency and coordination issues as well as a potentially large number of
context switches; or you could put the buffer in shared memory and
reintroduce some of the problems solved by multiprocessing as well as
run into issues some platforms have with cross-process synchronization
primitives. (ISTR a discussion of these options some time ago.)
We could have two concurrency systems: a cooperative threads system for
tasks inside an Emacs process that work closely with the user and that
share the work of fontifying buffers, and another, high-level facility
for offloading work to another Emacs process. This approach would solve
some problems, but it'd be complex, and I suspect a lot of CPU-intensive
code will nevertheless be run in the main Emacs process because it'd
hard to logically separate buffer-dependent and buffer-independent work
here.
Or, instead of that complexity, we can use shared-everything threads ---
which are inherently preemptive if they take advantage of hardware
concurrency --- and deal with the fallout as best we can; other systems
seem to manage. We could use locks and condition variables, or CSP, or
(my favorite) STM.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2011-02-01 19:57 UTC|newest]
Thread overview: 123+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-27 20:18 Patch for fields of `struct buffer' Tom Tromey
2011-01-28 7:37 ` Eli Zaretskii
2011-01-28 8:58 ` Tom Tromey
2011-01-28 9:29 ` Eli Zaretskii
2011-01-29 12:50 ` Eli Zaretskii
2011-01-29 13:33 ` Juanma Barranquero
2011-01-29 13:42 ` Eli Zaretskii
2011-02-02 18:17 ` Juanma Barranquero
2011-02-02 19:51 ` Eli Zaretskii
2011-01-28 14:55 ` Stefan Monnier
2011-01-28 17:38 ` Tom Tromey
2011-01-28 18:27 ` Stefan Monnier
2011-01-28 18:42 ` Tom Tromey
2011-01-28 20:04 ` Stefan Monnier
2011-01-28 17:23 ` Kim F. Storm
2011-01-28 17:36 ` Tom Tromey
2011-01-28 18:29 ` Stefan Monnier
2011-01-29 2:34 ` Miles Bader
2011-01-29 3:58 ` Stefan Monnier
2011-01-29 16:18 ` Richard Stallman
2011-01-30 20:23 ` Tom Tromey
2011-01-31 4:04 ` Stefan Monnier
2011-01-31 14:29 ` Tom Tromey
2011-01-31 15:22 ` Stefan Monnier
2011-01-31 15:30 ` Tom Tromey
2011-01-31 17:02 ` Stefan Monnier
2011-01-31 18:38 ` Tom Tromey
2011-01-31 20:03 ` Stefan Monnier
2011-01-31 20:00 ` Stefan Monnier
2011-01-31 20:05 ` Tom Tromey
2011-01-31 20:40 ` Stefan Monnier
2011-01-31 16:46 ` David De La Harpe Golden
2011-01-31 19:04 ` Tom Tromey
2011-01-31 22:08 ` David De La Harpe Golden
2011-02-01 10:54 ` Daniel Colascione
2011-02-07 2:34 ` Tom Tromey
2011-02-07 19:48 ` concurrency suggestions for Gnus (was: Patch for fields of `struct buffer') Ted Zlatanov
2011-02-08 4:31 ` concurrency suggestions for Gnus Miles Bader
2011-02-08 12:55 ` Andy Moreton
2011-02-08 12:55 ` Justin Lilly
2011-02-08 14:41 ` bloom filters (was: concurrency suggestions for Gnus) Ted Zlatanov
2011-02-08 15:15 ` Stephen J. Turnbull
2011-02-10 8:17 ` concurrency suggestions for Gnus Lars Ingebrigtsen
2011-02-01 15:43 ` Patch for fields of `struct buffer' Stefan Monnier
2011-02-01 16:28 ` Helmut Eller
2011-02-07 2:47 ` Tom Tromey
2011-02-07 2:44 ` Tom Tromey
2011-02-07 8:05 ` Helmut Eller
2011-02-07 19:23 ` Richard Stallman
2011-02-08 16:30 ` Tom Tromey
2011-02-08 16:26 ` Tom Tromey
2011-02-08 17:57 ` Helmut Eller
2011-02-11 21:59 ` Tom Tromey
2011-02-12 9:16 ` Helmut Eller
2011-02-08 21:10 ` Stefan Monnier
2011-01-31 19:38 ` Richard Stallman
2011-02-01 18:26 ` Tom Tromey
2011-02-01 19:28 ` Paul Eggert
2011-02-01 19:42 ` Tom Tromey
2011-02-09 10:16 ` Jim Meyering
2011-02-10 4:42 ` Miles Bader
2011-02-01 20:34 ` Andreas Schwab
2011-02-01 21:56 ` Tom Tromey
2011-02-01 21:59 ` Tom Tromey
2011-02-02 0:44 ` Paul Eggert
2011-02-02 3:49 ` Stefan Monnier
2011-02-02 16:26 ` Tom Tromey
2011-02-02 16:37 ` Stefan Monnier
2011-02-08 15:07 ` Tom Tromey
2011-02-08 21:02 ` Stefan Monnier
2011-02-08 21:08 ` Tom Tromey
2011-02-08 21:21 ` Tom Tromey
2011-02-09 21:32 ` Stefan Monnier
2011-02-08 21:58 ` Andreas Schwab
2011-02-01 22:21 ` Stefan Monnier
2011-02-08 16:38 ` Tom Tromey
2011-02-11 21:48 ` Tom Tromey
2011-02-12 2:25 ` Stefan Monnier
2011-01-31 19:37 ` Richard Stallman
2011-01-31 19:57 ` Tom Tromey
2011-02-01 2:42 ` Tom Tromey
2011-02-01 4:09 ` Eli Zaretskii
2011-02-01 16:40 ` Richard Stallman
2011-02-01 16:44 ` Tom Tromey
2011-02-02 2:42 ` Richard Stallman
2011-01-31 20:30 ` Stefan Monnier
2011-01-31 20:49 ` Tom Tromey
2011-01-31 21:54 ` Stefan Monnier
2011-02-13 19:01 ` Richard Stallman
2011-02-14 17:47 ` Stefan Monnier
2011-02-14 19:34 ` Lennart Borgman
2011-02-15 15:58 ` Richard Stallman
2011-02-15 20:41 ` Stefan Monnier
2011-02-01 16:39 ` Richard Stallman
2011-02-01 12:09 ` Stephen J. Turnbull
2011-02-02 2:41 ` Richard Stallman
2011-02-01 10:26 ` Daniel Colascione
2011-02-01 12:10 ` Stephen J. Turnbull
2011-02-01 14:23 ` Lennart Borgman
2011-02-01 16:19 ` Stephen J. Turnbull
2011-02-01 17:08 ` Lennart Borgman
2011-02-01 19:57 ` Daniel Colascione [this message]
2011-02-01 20:06 ` Daniel Colascione
2011-02-01 16:41 ` Richard Stallman
2011-02-01 16:51 ` Tom Tromey
2011-02-02 2:42 ` Richard Stallman
2011-02-02 4:16 ` Tom Tromey
2011-02-02 5:04 ` Stefan Monnier
2011-02-11 21:51 ` Tom Tromey
2011-02-12 23:28 ` Richard Stallman
2011-02-13 20:26 ` Installing `struct buffer' patch (Was: Patch for fields of `struct buffer') Tom Tromey
2011-02-14 16:42 ` Installing `struct buffer' patch Chong Yidong
2011-02-14 16:48 ` Tom Tromey
2011-02-14 16:52 ` Chong Yidong
2011-02-14 16:58 ` Tom Tromey
2011-02-14 17:36 ` Stefan Monnier
2011-02-15 15:50 ` Chong Yidong
2011-02-16 14:55 ` Tom Tromey
2011-02-15 15:57 ` Richard Stallman
2011-02-15 4:07 ` Glenn Morris
2011-02-15 14:28 ` Tom Tromey
2011-02-01 20:04 ` Patch for fields of `struct buffer' Daniel Colascione
2011-02-02 2:43 ` Richard Stallman
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=4D4865A0.8040903@gmail.com \
--to=dan.colascione@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=lennart.borgman@gmail.com \
--cc=rms@gnu.org \
--cc=stephen@xemacs.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.