Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #16806 > unrolled thread

multitasking Forth

Started byChris Hinsley <chris.hinsley@gmail.com>
First post2012-10-28 13:50 +0000
Last post2012-10-29 13:49 +0000
Articles 4 — 4 participants

Back to article view | Back to comp.lang.forth


Contents

  multitasking Forth Chris Hinsley <chris.hinsley@gmail.com> - 2012-10-28 13:50 +0000
    Re: multitasking Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-10-28 12:09 -0500
    Re: multitasking Forth "Elizabeth D. Rather" <erather@forth.com> - 2012-10-28 07:59 -1000
      Re: multitasking Forth stephenXXX@mpeforth.com (Stephen Pelc) - 2012-10-29 13:49 +0000

#16806 — multitasking Forth

FromChris Hinsley <chris.hinsley@gmail.com>
Date2012-10-28 13:50 +0000
Subjectmultitasking Forth
Message-ID<2012102813500973880-chrishinsley@gmailcom>
In a multitasking or multithreading Forth, does each thread have it's 
own dictionary ? Does the dictionary 'fork' at the point a new task is 
created ?

How is accsess to the dictionary mediated ? Can only the root thread 
create new words ?

How does FORGET and MARKER get handled if not ?

Chris

[toc] | [next] | [standalone]


#16810

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2012-10-28 12:09 -0500
Message-ID<0-idncbvF4VD-xDNnZ2dnUVZ8kmdnZ2d@supernews.com>
In reply to#16806
Chris Hinsley <chris.hinsley@gmail.com> wrote:
> In a multitasking or multithreading Forth, does each thread have it's 
> own dictionary ?

They can.  In Forth, Inc. terminology these are called TERMINAL and
BACKGROUND tsaks.

> Does the dictionary 'fork' at the point a new task is created ?

In a TERMINAL task, yes. 

> How is accsess to the dictionary mediated ? Can only the root thread 
> create new words ?

No, each TERMINAL task has its own dictionary, PAD, etc.

Andrew.

[toc] | [prev] | [next] | [standalone]


#16812

From"Elizabeth D. Rather" <erather@forth.com>
Date2012-10-28 07:59 -1000
Message-ID<0fOdnUuBRsgK7xDNnZ2dnUVZ_gudnZ2d@supernews.com>
In reply to#16806
On 10/28/12 3:50 AM, Chris Hinsley wrote:
> In a multitasking or multithreading Forth, does each thread have it's
> own dictionary ? Does the dictionary 'fork' at the point a new task is
> created ?
>
> How is accsess to the dictionary mediated ? Can only the root thread
> create new words ?
>
> How does FORGET and MARKER get handled if not ?

The model that FORTH, Inc. used for many years in polyFORTH and its 
predecessors featured a shared main dictionary with private dictionaries 
for certain tasks defined as "terminal" tasks. In the days of 
minicomputers (e.g. PDP-11) there could be many actual users, each with 
a "dumb" terminal. We had systems with 32 or more such users on a 
central CPU.

The original task was named OPERATOR, and it alone had the capability to 
add definitions to the root dictionary (in addition to having a private 
dictionary). Other terminal tasks' private dictionaries linked to that 
root dictionary, which contained general Forth words as well as shared 
portions of the application. Each task had "user variables" that 
controlled private dictionary allocation, search order, etc. FORGET 
could work only in the user's private dictionary space (this was 
pre-MARKER). EMPTY cleared the user dictionary, leaving the task 
connected to the top of the root dictionary.

Other tasks, called "background" tasks, had fewer user variables no 
provision for private definitions. They executed code in the shared 
thread, but had private user variables for stack pointers, etc.

Nowadays, we see a lot less need for private dictionaries, and 
SwiftForth does not support them. However, it still supports terminal 
tasks with independent I/O and user interface parameters.

Cheers,
Elizabeth

-- 
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

[toc] | [prev] | [next] | [standalone]


#16826

FromstephenXXX@mpeforth.com (Stephen Pelc)
Date2012-10-29 13:49 +0000
Message-ID<508e877c.68971458@192.168.0.50>
In reply to#16812
On Sun, 28 Oct 2012 07:59:50 -1000, "Elizabeth D. Rather"
<erather@forth.com> wrote:

>On 10/28/12 3:50 AM, Chris Hinsley wrote:
>> In a multitasking or multithreading Forth, does each thread have it's
>> own dictionary ? Does the dictionary 'fork' at the point a new task is
>> created ?

Back in the dim and distant, when "computers" were expensive, having
multiple users with compilation rights on one Forth system was common.
When "personal" computers became common, most Forth systems assumed a
single user but multiple threads. This has been the dominant model in
embedded systems for a long time. 

The only application when we really have to consider dictionary access
is when handling web servers that use the on-board Forth for
server-side scripting.

Stephen

-- 
Stephen Pelc, stephenXXX@mpeforth.com
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web