all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: <tomas@tuxteam.de>
To: help-gnu-emacs@gnu.org
Subject: Re: try-this-for ?
Date: Thu, 18 Jan 2018 13:43:37 +0100	[thread overview]
Message-ID: <20180118124337.GC29536@tuxteam.de> (raw)
In-Reply-To: <86r2qn5qby.fsf@zoho.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Jan 18, 2018 at 01:00:49PM +0100, Emanuel Berg wrote:
> tomas wrote:
> 
> > Up to now, Emacs Lisp's model of concurrency
> > seems to be explicitly cooperative.
> 
> "seems to be explicitly" :) ?

(seems to be (explicitly cooperative))

With explicitly I meant that control is not
taken away behind a process's back, but the
process has to explicitly yield control.

> True concurrency isn't possible even for
> multicore architectures IIUC.

To a certain extent yes: the processors/cores have
to cooperate to access common resources (e.g. memory),
but as long as they are operating e.g. from local
cache they do run in parallel.

> The perceived concurrency, how does that work
> if it isn't Unix-style preemptive with
> priorities and a scheduler etc.?

As far as I know, the only (implicit) yield point
in Emacs is the event loop, but many things fit
in there: waiting for key events, waiting for file
descriptors to become readable/writable (e.g.
communicating with (operating system) subprocesses,
reacting to POSIX signals, the idle timer, etc.

> For example, with `list-processes', is that
> really all cooperative stuff handled by the
> idle timer?

Not really the idle timer: this one is (probably?)
triggered from the central event loop, as the others.

But the great Eli has answered that already in emacs
devel some moons ago [1]. Turns out that what I call
"event loop" is called the "input queue". If you have
a lengthy calculation and want the other things (user
input, but also file notifications, communication
via sockets, etc) to "keep running", you have to
explicitly (that's the "explicit" part in what I
labeled as "explicitly cooperative") give a chance
to this input queue to run from time to time.
Perhaps (sit-for 0) is your friend (it would
trigger a redisplay), perhaps something else.

Cheers

[1] https://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00922.html
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlpglnkACgkQBcgs9XrR2kbsIwCfXg9pI1PRDrdljTab+Tuf6VJU
/BcAn0IplpC0UqNCPzfcOqcpW0Nd7034
=+CsX
-----END PGP SIGNATURE-----



  parent reply	other threads:[~2018-01-18 12:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17 21:04 try-this-for ? Emanuel Berg
2018-01-17 23:50 ` John Mastro
2018-01-18  2:08 ` Bob Newell
     [not found] ` <mailman.7535.1516241346.27995.help-gnu-emacs@gnu.org>
2018-01-18  2:52   ` Emanuel Berg
     [not found] ` <mailman.7534.1516233062.27995.help-gnu-emacs@gnu.org>
2018-01-18  2:56   ` Emanuel Berg
2018-01-18  9:27     ` tomas
     [not found]     ` <mailman.7540.1516267658.27995.help-gnu-emacs@gnu.org>
2018-01-18 12:00       ` Emanuel Berg
2018-01-18 12:03         ` Emanuel Berg
2018-01-18 12:11           ` Emanuel Berg
2018-01-18 12:43         ` tomas [this message]
2018-01-18 15:14           ` Eli Zaretskii
2018-01-18 15:23             ` tomas
     [not found]         ` <mailman.7544.1516279427.27995.help-gnu-emacs@gnu.org>
2018-01-18 12:59           ` Emanuel Berg
2018-01-18 13:16             ` tomas
     [not found]             ` <mailman.7546.1516281409.27995.help-gnu-emacs@gnu.org>
2018-01-18 22:44               ` Emanuel Berg
2018-01-19  8:38                 ` tomas
     [not found]                 ` <mailman.7613.1516351115.27995.help-gnu-emacs@gnu.org>
2018-01-19  8:55                   ` Emanuel Berg
2018-01-19  9:25                     ` tomas
     [not found]                     ` <mailman.7614.1516353949.27995.help-gnu-emacs@gnu.org>
2018-01-19 10:47                       ` Emanuel Berg
2018-01-19 11:22                         ` tomas

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=20180118124337.GC29536@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=help-gnu-emacs@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.