all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Konstantin Kharlamov <hi-angel@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>, Tomas Hlavaty <tom@logand.com>
Cc: monnier@iro.umontreal.ca, jporterbugs@gmail.com,
	 karthikchikmagalur@gmail.com, emacs-devel@gnu.org
Subject: Re: continuation passing in Emacs vs. JUST-THIS-ONE
Date: Tue, 18 Apr 2023 13:35:42 +0300	[thread overview]
Message-ID: <819ba9e84aa843a60cf1113f0306ea62e94975df.camel@yandex.ru> (raw)
In-Reply-To: <834jpe9bb0.fsf@gnu.org>

On Tue, 2023-04-18 at 05:25 +0300, Eli Zaretskii wrote:
> > From: Tomas Hlavaty <tom@logand.com>
> > Cc: monnier@iro.umontreal.ca, jporterbugs@gmail.com,
> >         karthikchikmagalur@gmail.com, emacs-devel@gnu.org
> > Date: Mon, 17 Apr 2023 22:51:22 +0200
> >
> > On Wed 12 Apr 2023 at 09:13, Eli Zaretskii <eliz@gnu.org> wrote:
> > > Async subprocesses are currently the only feature in Emacs that
> > > provides an opportunity for writing asynchronous code.
> >
> > Do you not consider, for example, using implementations of async/await
> > using promisses and CPS rewriting "writing asynchronous code"?
> >
> > Do you not consider, for example, doing the same using callbacks as
> > "writing asynchronous code"?
>
> Not necessarily.
>
> > > > I do not know how useable threads in Emacs are at the moment,
> > > > but they are already there and the examples I tried worked well.
> > >
> > > If you think Lisp threads in Emacs allow asynchronous processing, you
> > > are mistaken: they don't.  Only one such thread can be running at any
> > > given time.
> >
> > The examples I wrote worked fine with threads.  The examples did not
> > require parallelism.  I do not think that what you suggest disqualifies
> > threads for "writing asynchronous code".
> >
> > It would be great to have better thread implementation, but that does
> > not seem to have anything to do with "writing asynchronous code".
> >
> > Here is what I understand under synchronous code:
> >
> >    (plus 1 2)
> >    returns 3 immediatelly
> >
> > Here is what I understand under asynchronous code:
> >
> >    (plus 1 2)
> >    returns something immediately
> >    and then some time later 3 appers in the *Message* buffer, for
> >    example
> >
> > How that is achieved is an implementation (possibly leaky) detail.
>
> In my book, asynchronous means parallel processing, not just delayed
> results.

The widely used definition is different though. A good summary is in this
StackOverflow answer¹:

> When you run something asynchronously it means it is non-blocking, you execute it
> without waiting for it to complete and carry on with other things. Parallelism
> means to run multiple things at the same time, in parallel. Parallelism works well
> when you can separate tasks into independent pieces of work.

If you want some Wikipedia links, they might sound a bit more confusing, but here's
what it says²:

> Asynchrony, in computer programming, refers to the occurrence of events independent
> of the main program flow and ways to deal with such events. These may be "outside"
> events such as the arrival of signals, or actions instigated by a program that take
> place concurrently with program execution, without the program blocking to wait for
> results.

And then "concurrency" article says³:

> The concept of concurrent computing is frequently confused with the related but
> distinct concept of parallel computing,[3][4] although both can be described as
> "multiple processes executing during the same period of time". In parallel
> computing, execution occurs at the same physical instant: for example, on separate
> processors of a multi-processor machine, with the goal of speeding up
> computations—parallel computing is impossible on a (one-core) single processor, as
> only one computation can occur at any instant (during any single clock cycle).[a]
> By contrast, concurrent computing consists of process lifetimes overlapping, but
> execution need not happen at the same instant.


1: https://stackoverflow.com/a/6133756/2388257
2: https://en.wikipedia.org/wiki/Asynchrony_(computer_programming)
3: https://en.wikipedia.org/wiki/Concurrent_computing




  parent reply	other threads:[~2023-04-18 10:35 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-11 12:53 continuation passing in Emacs vs. JUST-THIS-ONE Thomas Koch
2023-03-12  1:45 ` Jim Porter
2023-03-12  6:33   ` tomas
2023-03-14  6:39   ` Karthik Chikmagalur
2023-03-14 18:58     ` Jim Porter
2023-03-15 17:48       ` Stefan Monnier
2023-03-17  0:17         ` Tomas Hlavaty
2023-03-17  3:08           ` Stefan Monnier
2023-03-17  5:37             ` Jim Porter
2023-03-25 18:42             ` Tomas Hlavaty
2023-03-26 19:35               ` Tomas Hlavaty
2023-03-28  7:23                 ` Tomas Hlavaty
2023-03-29 19:00                 ` Stefan Monnier
2023-04-03  0:39                   ` Tomas Hlavaty
2023-04-03  1:44                     ` Emanuel Berg
2023-04-03  2:09                     ` Stefan Monnier
2023-04-03  4:03                       ` Po Lu
2023-04-03  4:51                         ` Jim Porter
2023-04-10 21:47                       ` Tomas Hlavaty
2023-04-11  2:53                         ` Stefan Monnier
2023-04-11 19:59                           ` Tomas Hlavaty
2023-04-11 20:22                             ` Stefan Monnier
2023-04-11 23:07                               ` Tomas Hlavaty
2023-04-12  6:13                                 ` Eli Zaretskii
2023-04-17 20:51                                   ` Tomas Hlavaty
2023-04-18  2:25                                     ` Eli Zaretskii
2023-04-18  5:01                                       ` Tomas Hlavaty
2023-04-18 10:35                                       ` Konstantin Kharlamov [this message]
2023-04-18 15:31                                         ` [External] : " Drew Adams
2023-03-29 18:47               ` Stefan Monnier
2023-04-17  3:46                 ` Lynn Winebarger
2023-04-17 19:50                   ` Stefan Monnier
2023-04-18  2:56                     ` Lynn Winebarger
2023-04-18  3:48                       ` Stefan Monnier
2023-04-22  2:48                         ` Lynn Winebarger
2023-04-18  6:19                     ` Jim Porter
2023-04-18  9:52                       ` Po Lu
2023-04-18 12:38                         ` Lynn Winebarger
2023-04-18 13:14                         ` Stefan Monnier
2023-04-19  0:28                           ` Basil L. Contovounesios
2023-04-19  2:59                             ` Stefan Monnier
2023-04-19 13:25                               ` [External] : " Drew Adams
2023-04-19 13:34                                 ` Robert Pluim
2023-04-19 14:19                                   ` Stefan Monnier
2023-04-21  1:33                                     ` Richard Stallman
2023-04-19  1:11                           ` Po Lu
2023-04-17 21:00                   ` Tomas Hlavaty
2023-03-14  3:58 ` Richard Stallman
2023-03-14  6:28   ` Jim Porter
2023-03-16 21:35 ` miha
2023-03-16 22:14   ` Jim Porter
2023-03-25 21:05 ` Tomas Hlavaty
2023-03-26 23:50 ` Tomas Hlavaty

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=819ba9e84aa843a60cf1113f0306ea62e94975df.camel@yandex.ru \
    --to=hi-angel@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jporterbugs@gmail.com \
    --cc=karthikchikmagalur@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=tom@logand.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.