From: HaiJun Zhang <netjune@outlook.com>
To: Eli Zaretskii <eliz@gnu.org>, arthur miller <arthur.miller@live.com>
Cc: "38807@debbugs.gnu.org" <38807@debbugs.gnu.org>,
"michael.albinus@gmx.de" <michael.albinus@gmx.de>
Subject: bug#38807: [Feature request]: Support lisp workers like web workers.
Date: Sat, 4 Jan 2020 14:41:58 +0800 [thread overview]
Message-ID: <PS1PR03MB360624E6E26B48D050E3CBA3B7220@PS1PR03MB3606.apcprd03.prod.outlook.com> (raw)
In-Reply-To: <VI1P194MB0429F49DDF16D1F3848B165D96230@VI1P194MB0429.EURP194.PROD.OUTLOOK.COM>
[-- Attachment #1: Type: text/plain, Size: 3908 bytes --]
Workers don’t have to be in dedicated native threads. It is decided by the lisp machine if they are run in a lisp machine.
在 2020年1月3日 +0800 PM10:11,arthur miller <arthur.miller@live.com>,写道:
> As a concept, I am not sure a thread is the best solution to implement for a high level scripting runtime as Emacs lisp. Thread is a relatively primitive concept and leaves a lot to applications programmer to decide and manage. In concurrent programming a thread is OK-ish concept, but it might not be the best for truly parallel problem solving.
>
> Creating more threads than there are physical cpus creates overhead that might eat up benefits of parallelism. It also forces a programmer to think in terms of machine, scheduling, synchronization etc. It can be more effective and more lisp-ish to think in terms of tasks and let the core manage the threads and scheduling on it's own.
>
> Tasks let us think about the work we wish to perform and not how to perform it. It lets runtime create number of worker threads and schedule them automatically instead of forcing programmers to join, synchronize etc
>
> As a concept a web worker is just a worker thread introduced as idea in various single threaded gui toolkits long ago. Java's Swing popularized worker threads heavily back in days, and I don't remember if MFC also made a deal of those before Swing or after.
>
> Anyway, these were just ordinary threads, doing some work, like populating big lists and similar, nothing special. However back in days threads were cheap. Everything run on one CPU, and threaded programming was mostly what we today call concurrent programming.
>
> Since Swing and Mfc were big things, we have got multi core CPUs as mainstream and threads have got much more expensive to create and communicate with. Java threads back at days where super cheap to create. I am not sure how expensive are posix threads on different cpus, but I know that win32 threads are quite expensive/slow. For a small work it might be more expensive to process it in separate thread.
>
> Tasks can be mapped on entire thread or put into a queue for physical threads to pick them up. Thus I think tasks might be more suited for say an input queue or render queue and similar.
>
> If I remember well, certain version of DirectX used to process input in separate thread, which they abandoned in some later version. However I stopped to work with dx years ago, before dx10 come out, so I don't know how they do nowadays.
>
>
> Skickat från min Samsung Galaxy-smartphone.
>
>
>
> -------- Originalmeddelande --------
> Från: HaiJun Zhang <netjune@outlook.com>
> Datum: 2020-01-03 04:36 (GMT+01:00)
> Till: Eli Zaretskii <eliz@gnu.org>
> Kopia: 38807@debbugs.gnu.org, michael.albinus@gmx.de
> Ämne: bug#38807: [Feature request]: Support lisp workers like web workers.
>
> 在 2020年1月2日 +0800 AM12:21,Eli Zaretskii <eliz@gnu.org>,写道:
> >
> > Then these threads cannot really run Lisp at all, nor even directly
> > affect Lisp data. So in effect you want to be able to run threads
> > that don't enter the Lisp interpreter, nor modify any Lisp data.
>
> For web worker, they have different contexts. The following is from MDN(https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers):
>
> workers run in another global context that is different from the current window. Thus, using the windowshortcut to get the current global scope (instead of self) within a Worker will return an error.
> The worker context is represented by a DedicatedWorkerGlobalScope object in the case of dedicated workers (standard workers that are utilized by a single script; shared workers use SharedWorkerGlobalScope). A dedicated worker is only accessible from the script that first spawned it, whereas shared workers can be accessed from multiple scripts.
>
[-- Attachment #2: Type: text/html, Size: 10885 bytes --]
next prev parent reply other threads:[~2020-01-04 6:41 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <aade4dc9-4992-4751-9706-9802389ff732@Spark>
2019-12-30 5:27 ` bug#38807: [Feature request]: Support lisp workers like web workers HaiJun Zhang
2019-12-30 15:23 ` Eli Zaretskii
2019-12-30 15:40 ` Dmitry Gutov
2019-12-30 16:26 ` Eli Zaretskii
2020-01-01 3:20 ` HaiJun Zhang
2020-01-01 3:37 ` Eli Zaretskii
2020-01-01 3:57 ` HaiJun Zhang
[not found] ` <39f1e59e-08db-4862-98db-c31c3bcbab06@Spark>
2020-01-01 4:02 ` HaiJun Zhang
2020-01-01 15:32 ` Eli Zaretskii
2020-01-03 2:05 ` HaiJun Zhang
2020-01-03 13:38 ` arthur miller
2020-01-04 5:59 ` HaiJun Zhang
2020-01-04 8:11 ` HaiJun Zhang
2020-01-04 9:07 ` Eli Zaretskii
2020-01-04 9:10 ` HaiJun Zhang
2020-01-01 3:06 ` HaiJun Zhang
2019-12-30 18:31 ` Michael Albinus
2019-12-30 19:19 ` Eli Zaretskii
2019-12-30 19:22 ` Eli Zaretskii
2019-12-31 0:40 ` HaiJun Zhang
2019-12-31 1:39 ` arthur miller
2020-01-01 3:47 ` HaiJun Zhang
2020-01-01 16:23 ` Eli Zaretskii
2020-01-03 3:45 ` HaiJun Zhang
2020-01-03 6:06 ` Eli Zaretskii
2020-01-04 5:47 ` HaiJun Zhang
2019-12-31 16:35 ` Eli Zaretskii
2020-01-01 2:59 ` HaiJun Zhang
2020-01-01 16:21 ` Eli Zaretskii
2020-01-03 3:18 ` HaiJun Zhang
2020-01-03 6:02 ` Eli Zaretskii
2020-01-04 5:26 ` HaiJun Zhang
2020-01-04 9:00 ` Eli Zaretskii
2020-03-21 2:24 ` HaiJun Zhang
2020-03-21 8:16 ` Eli Zaretskii
2020-03-22 1:12 ` HaiJun Zhang
2020-03-22 14:32 ` Eli Zaretskii
2020-03-24 4:22 ` HaiJun Zhang
2020-03-24 14:40 ` Eli Zaretskii
2020-03-26 13:37 ` HaiJun Zhang
2020-03-26 14:44 ` Eli Zaretskii
2020-03-26 18:14 ` Ivan Yonchovski
2020-03-29 2:41 ` HaiJun Zhang
2020-03-29 2:12 ` HaiJun Zhang
2020-03-25 16:44 ` Ivan Yonchovski
2020-03-25 17:05 ` Eli Zaretskii
2020-03-25 17:21 ` Ivan Yonchovski
2020-03-26 13:49 ` HaiJun Zhang
2020-01-04 5:55 ` HaiJun Zhang
2020-01-03 3:34 ` HaiJun Zhang
2020-01-03 14:10 ` arthur miller
2020-01-04 6:41 ` HaiJun Zhang [this message]
2020-01-01 3:16 ` HaiJun Zhang
2020-01-01 9:14 ` Michael Albinus
2020-01-03 2:52 ` HaiJun Zhang
2020-01-03 5:59 ` Eli Zaretskii
2020-01-04 5:19 ` HaiJun Zhang
2020-01-04 8:59 ` Eli Zaretskii
2020-01-04 9:33 ` HaiJun Zhang
2020-01-04 9:51 ` Eli Zaretskii
2020-01-06 5:08 ` HaiJun Zhang
2020-01-06 16:07 ` Eli Zaretskii
2020-01-01 14:52 ` arthur miller
2020-01-03 1:49 ` HaiJun Zhang
2020-01-03 13:35 ` arthur miller
2020-01-03 14:26 ` Eli Zaretskii
2020-01-03 15:14 ` arthur miller
2020-01-03 14:19 ` arthur miller
2020-01-03 14:39 ` Eli Zaretskii
2022-04-30 12:32 ` Lars Ingebrigtsen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PS1PR03MB360624E6E26B48D050E3CBA3B7220@PS1PR03MB3606.apcprd03.prod.outlook.com \
--to=netjune@outlook.com \
--cc=38807@debbugs.gnu.org \
--cc=arthur.miller@live.com \
--cc=eliz@gnu.org \
--cc=michael.albinus@gmx.de \
/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 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).