Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #134104
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: multitasking vs multiple interpreters |
| Date | 2025-07-29 07:49 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2025Jul29.094901@mips.complang.tuwien.ac.at> (permalink) |
| References | <871pq0uppw.fsf@nightsong.com> |
Paul Rubin <no.email@nospam.invalid> writes:
>Question is how to multitask on a small embedded target. One way is the
>traditional cooperative multitasker with a shared dictionary plus task
>variables.
>
>Another way is time slicing multiple interpreters, each with its own
>data dictionary (all variables are task variables). There would be a
>shared read-only dictionary for code and constants, and a mailbox scheme
>for IPC.
>
>This question is more about shared vs non-shared than cooperative vs
>preemptive. The latter would be Erlang-style preemptive, i.e. avoiding
>most locking hazards by using mailboxes instead of memory sharing.
>
>Does anyone do it this way? Is the overhead substantial?
Gforth is not for small embedded systems, but anyway, the development
version does multi-tasking by mapping each task to a POSIX thread
(within one process), with the classical USER variable mechanism for
task-local variables, multiprocessing/preemption (coming from POSIX
threads), and an actor-like mechanism for communicating between tasks
and for synchronizing them (there are also other synchronizing
mechanisms). The messages that the actor-like mechanism delivers to
the mailbox of a task are xts that the receiving task executes. You
can read about that in https://net2o.de/gforth/Multitasker.html.
Concerning the idea of replicating all variables and buffers in each
task, that seemed too expensive in memory for Gforth, and I expect
that it is considered too expensive all the more for small embedded
targets. For Gforth we want to be able to support a huge number of
tasks (although the current implementation with one pthread per task
is probably too expensive for that, too, but a future implementation
can fix that), for a small embedded system you may only want to have a
few tasks, but even then you don't want to waste memory on replicating
buffers that are only used in one task. There is a reason why Forth
has both VARIABLE and USER.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2025 CFP: http://www.euroforth.org/ef25/cfp.html
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
multitasking vs multiple interpreters Paul Rubin <no.email@nospam.invalid> - 2025-07-28 11:36 -0700
Re: multitasking vs multiple interpreters albert@spenarnc.xs4all.nl - 2025-07-28 23:09 +0200
Re: multitasking vs multiple interpreters Paul Rubin <no.email@nospam.invalid> - 2025-07-28 20:32 -0700
Re: multitasking vs multiple interpreters minforth <minforth@gmx.net> - 2025-07-29 06:03 +0200
Re: multitasking vs multiple interpreters Ivan Shmakov <ivan@siamics.netREMOVE.invalid> - 2025-08-09 14:37 +0000
Re: multitasking vs multiple interpreters anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-07-29 07:49 +0000
Re: multitasking vs multiple interpreters albert@spenarnc.xs4all.nl - 2025-07-29 11:06 +0200
Re: multitasking vs multiple interpreters Paul Rubin <no.email@nospam.invalid> - 2025-07-29 15:06 -0700
Re: multitasking vs multiple interpreters Buzz McCool <buzz_mccool@yahoo.com> - 2025-08-11 10:12 -0700
Re: multitasking vs multiple interpreters anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2025-08-11 17:49 +0000
Re: multitasking vs multiple interpreters albert@spenarnc.xs4all.nl - 2025-08-12 13:14 +0200
Re: multitasking vs multiple interpreters Paul Rubin <no.email@nospam.invalid> - 2025-08-12 09:45 -0700
Re: multitasking vs multiple interpreters albert@spenarnc.xs4all.nl - 2025-08-13 11:23 +0200
Re: multitasking vs multiple interpreters Paul Rubin <no.email@nospam.invalid> - 2025-08-13 09:12 -0700
Re: multitasking vs multiple interpreters minforth <minforth@gmx.net> - 2025-08-13 13:55 +0200
Re: multitasking vs multiple interpreters Stephen Pelc <stephen@vfxforth.com> - 2025-08-14 09:43 +0000
csiph-web