Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Why buffer contents can be influenced by EMIT or TYPE?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 48 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Zbiggy  
View profile  
 More options Feb 13, 9:17 am
Newsgroups: comp.lang.forth
From: Zbiggy <zbigniew2011REM...@gmail.REMOVE.com>
Date: 13 Feb 2012 15:17:02 +0100
Local: Mon, Feb 13 2012 9:17 am
Subject: Why buffer contents can be influenced by EMIT or TYPE?
There is a statement in "Starting Forth":

"...system will copy block 1 of the currently open file into one of the system
buffers. BLOCK also leaves on the stack the address of the beginning of the
buffer (1024 bytes, remember) that it used. The contents of this buffer are
guaranteed to stay valid until you execute a word from the set of procedures
with `multitasking impact', like EMIT or TYPE".

1. Actually, why EMIT, which simply outputs a character on the screen, should
affect contents of any buffer prepared to hold block contents?

2. How one should understand this "multitasking impact" exactly?

3. What are the words with "multitasking impact"? And which of the words
have such impact (but EMIT and TYPE)?

--
Forth is a preserver of health (Hippocrates)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Haley  
View profile  
 More options Feb 13, 9:49 am
Newsgroups: comp.lang.forth
From: Andrew Haley <andre...@littlepinkcloud.invalid>
Date: Mon, 13 Feb 2012 08:49:41 -0600
Local: Mon, Feb 13 2012 9:49 am
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?

Zbiggy <zbigniew2011REM...@gmail.remove.com> wrote:
> There is a statement in "Starting Forth":

> "...system will copy block 1 of the currently open file into one of the system
> buffers. BLOCK also leaves on the stack the address of the beginning of the
> buffer (1024 bytes, remember) that it used. The contents of this buffer are
> guaranteed to stay valid until you execute a word from the set of procedures
> with `multitasking impact', like EMIT or TYPE".

> 1. Actually, why EMIT, which simply outputs a character on the screen, should
> affect contents of any buffer prepared to hold block contents?

Because EMIT might block waiting to send a character to the device, so
this is an opportunity to switch to another task, if there is one.
That other task might call BLOCK and invalidate the buffer.

> 2. How one should understand this "multitasking impact" exactly?

See section C.6:
http://forth.sourceforge.net/std/dpans/dpansc.htm#C.6

> 3. What are the words with "multitasking impact"? And which of the words
> have such impact (but EMIT and TYPE)?

They're in the list http://forth.sourceforge.net/std/dpans/dpans7.htm#7.3.3

Andrew.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brad  
View profile  
 More options Feb 13, 9:56 am
Newsgroups: comp.lang.forth
From: Brad <hwfw...@gmail.com>
Date: Mon, 13 Feb 2012 06:56:17 -0800 (PST)
Local: Mon, Feb 13 2012 9:56 am
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
On Feb 13, 7:17 am, Zbiggy <zbigniew2011REM...@gmail.REMOVE.com>
wrote:

> 2. How one should understand this "multitasking impact" exactly?

Any word that calls PAUSE. Usually I/O words. Perhaps in some Forths
tasks share buffers. I'm not sure this applies to modern Forths, since
sharing buffers to save memory is no longer necessary. If you even use
buffers (most people use only files).

> --
> Forth is a preserver of health (Hippocrates)

It didn't work out that way for Jeff. Maybe the wrong dialect?

-Brad


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Haley  
View profile  
 More options Feb 13, 11:26 am
Newsgroups: comp.lang.forth
From: Andrew Haley <andre...@littlepinkcloud.invalid>
Date: Mon, 13 Feb 2012 10:26:24 -0600
Local: Mon, Feb 13 2012 11:26 am
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?

Brad <hwfw...@gmail.com> wrote:
> On Feb 13, 7:17?am, Zbiggy <zbigniew2011REM...@gmail.REMOVE.com>
> wrote:
>> 2. How one should understand this "multitasking impact" exactly?

> Any word that calls PAUSE. Usually I/O words. Perhaps in some Forths
> tasks share buffers.

In all of them: it's not just about space saving, it's about
correctness.  You don't want tasks with different opinions about the
contents of a particular block.

Andrew.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brad  
View profile  
 More options Feb 13, 11:51 am
Newsgroups: comp.lang.forth
From: Brad <hwfw...@gmail.com>
Date: Mon, 13 Feb 2012 08:51:32 -0800 (PST)
Local: Mon, Feb 13 2012 11:51 am
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
On Feb 13, 9:26 am, Andrew Haley <andre...@littlepinkcloud.invalid>
wrote:

> In all of them: it's not just about space saving, it's about
> correctness.  You don't want tasks with different opinions about the
> contents of a particular block.

I was going to say that embedded Forthers like me wouldn't use blocks,
but then it just occurred to me that blocks would be a great way for a
16-bit Forth to deal with large SPI flash.

-Brad


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Zbiggy  
View profile  
 More options Feb 13, 1:12 pm
Newsgroups: comp.lang.forth
From: Zbiggy <zbigniew2011REM...@gmail.REMOVE.com>
Date: 13 Feb 2012 19:12:47 +0100
Local: Mon, Feb 13 2012 1:12 pm
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?

In comp.lang.forth, Brad wrote:
> Any word that calls PAUSE. Usually I/O words. Perhaps in some Forths
> tasks share buffers. I'm not sure this applies to modern Forths, since
> sharing buffers to save memory is no longer necessary. If you even use
> buffers (most people use only files).

Thanks, Brad and Andrew. But I understand, that all this is related only
to multitasking-capable Forths, and the "simpler" ones are free of the
restriction (I mean: I don't have to worry that by executing EMIT sometimes
I can change assigned buffer's contents, by giving "green light" to another
task etc.)?

The mentioned restriction is strictly related to multitasking ability, right?

>> --
>> Forth is a preserver of health (Hippocrates)

> It didn't work out that way for Jeff. Maybe the wrong dialect?

Well, who knows? We're unable to find out, how long he would live _without_
Forth...
--
Forth is a preserver of health (Hippocrates)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Elizabeth D. Rather  
View profile  
 More options Feb 13, 1:23 pm
Newsgroups: comp.lang.forth
From: "Elizabeth D. Rather" <erat...@forth.com>
Date: Mon, 13 Feb 2012 08:23:19 -1000
Local: Mon, Feb 13 2012 1:23 pm
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
On 2/13/12 4:17 AM, Zbiggy wrote:

The other responses answer your question, but I'll provide a little more
background.

The classic Forth multitasker (originally developed by Chuck and still
in use in many native & embedded Forths) is "cooperative" -- a task
voluntarily relinquishes the CPU. One advantage of this is that there is
far less context to save and restore, so task switches are much faster
than with pre-emptive algorithms. Another advantage is that the
programmer knows when the program is doing something that may cause a
task switch.

The disadvantage is that a task may "hog" the CPU and prevent other
tasks from having timely access.  The compromise which makes the
cooperative algorithm work is that whenever a task performs an I/O
operation it must relinquish the CPU. This is brilliant because I/O
takes a long time, comparatively speaking, and in most applications
(especially control systems, for which Forth was originally designed)
there isn't a lot to do between I/O operations. So this makes very
efficient use of the CPU, making the majority of its cycles available
for doing real work.

One must take a broad view of what defines I/O: for example, writing a
character to a screen is I/O, even if the "screen" is in a local frame
buffer. And any drivers that the programmer adds must also follow the
rule. So long as everyone respects this rule, cooperative multitasking
is effortless and in over 30 years of application programming I don't
recall any problems.

There are several ways to implement this. One is the high-level word
PAUSE, which someone mentioned. PAUSE relinquishes the CPU for exactly
one pass through the task list. A more sophisticated way, appropriate in
an interrupt-driven system, is to deactivate the task when the I/O is
initiated, and let the interrupt driver that responds when the action is
completed set its status to be active again.

And Andrew makes an important point about BLOCK buffers: they must be
shared in a multitasking system, to avoid the possibility of multiple
copies of a block with different contents. Sound application design
avoids conflicts.  It's true that most modern Forths that run under a
host OS don't use BLOCK for disk I/O, but blocks are, indeed, quite
useful for managing flash or other mass storage.

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."
==================================================


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Elizabeth D. Rather  
View profile  
 More options Feb 13, 1:24 pm
Newsgroups: comp.lang.forth
From: "Elizabeth D. Rather" <erat...@forth.com>
Date: Mon, 13 Feb 2012 08:24:26 -1000
Local: Mon, Feb 13 2012 1:24 pm
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
On 2/13/12 8:12 AM, Zbiggy wrote:

If you're writing portable code that may run on a multitasked Forth you
should respect the rule.

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."
==================================================


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Zbiggy  
View profile  
 More options Feb 13, 2:02 pm
Newsgroups: comp.lang.forth
From: Zbiggy <zbigniew2011REM...@gmail.REMOVE.com>
Date: 13 Feb 2012 20:02:30 +0100
Local: Mon, Feb 13 2012 2:02 pm
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
In comp.lang.forth, Elizabeth D. Rather wrote:

> If you're writing portable code that may run on a multitasked Forth you
> should respect the rule.

Of course, but I had in mind the ability of blocks - mentioned in SF - which
I particularly like: to use it as kind of "swap partition" equivalent. It
seems, it should be used with much greater care, than I thought at first: we
don't want data "swapped" to blocks to get corrupted.

Or maybe it's not possible at all in multitasked environment - at least not
in the way similar to one, in which Linux uses its swap partitions/files:
actually, we cannot block I/O operations at all just to make sure, they won't
allow buffers affection. The machine would be unusable.
--
Forth is a preserver of health (Hippocrates)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Zbiggy  
View profile  
 More options Feb 13, 2:06 pm
Newsgroups: comp.lang.forth
From: Zbiggy <zbigniew2011REM...@gmail.REMOVE.com>
Date: 13 Feb 2012 20:06:16 +0100
Local: Mon, Feb 13 2012 2:06 pm
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
In comp.lang.forth, Elizabeth D. Rather wrote:

> One must take a broad view of what defines I/O: for example, writing a
> character to a screen is I/O, even if the "screen" is in a local frame
> buffer. And any drivers that the programmer adds must also follow the
> rule. So long as everyone respects this rule, cooperative multitasking
> is effortless and in over 30 years of application programming I don't
> recall any problems.

I'm afraid, I didn't completely understood: what you mean by writing, that
"cooperative multitasking is effortless"? What it was unable to do?
--
Forth is a preserver of health (Hippocrates)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Zbiggy  
View profile  
 More options Feb 13, 2:12 pm
Newsgroups: comp.lang.forth
From: Zbiggy <zbigniew2011REM...@gmail.REMOVE.com>
Date: 13 Feb 2012 20:12:18 +0100
Local: Mon, Feb 13 2012 2:12 pm
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?

In comp.lang.forth, Zbiggy wrote:
> I'm afraid, I didn't completely understood: what you mean by writing, that
> "cooperative multitasking is effortless"? What it was unable to do?

Did you mean perhaps, that by obeying the mentioned rule there wasn't any
problems with taking over entire CPU time?
--
Forth is a preserver of health (Hippocrates)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Elizabeth D. Rather  
View profile  
 More options Feb 13, 4:21 pm
Newsgroups: comp.lang.forth
From: "Elizabeth D. Rather" <erat...@forth.com>
Date: Mon, 13 Feb 2012 11:21:11 -1000
Local: Mon, Feb 13 2012 4:21 pm
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
On 2/13/12 9:12 AM, Zbiggy wrote:

> In comp.lang.forth, Zbiggy wrote:

>> I'm afraid, I didn't completely understood: what you mean by writing, that
>> "cooperative multitasking is effortless"? What it was unable to do?

> Did you mean perhaps, that by obeying the mentioned rule there wasn't any
> problems with taking over entire CPU time?

That's exactly what I mean: you don't have to *do* anything other than
respecting the rules to make everything work ok.

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."
==================================================


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Albert van der Horst  
View profile  
 More options Feb 13, 4:32 pm
Newsgroups: comp.lang.forth
From: Albert van der Horst <alb...@spenarnc.xs4all.nl>
Date: 13 Feb 2012 21:32:57 GMT
Local: Mon, Feb 13 2012 4:32 pm
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
In article <b6d4be14-a3dc-49f3-a90a-be9086b68...@18g2000yqe.googlegroups.com>,

Brad  <hwfw...@gmail.com> wrote:
>On Feb 13, 9:26=A0am, Andrew Haley <andre...@littlepinkcloud.invalid>
>wrote:
>> In all of them: it's not just about space saving, it's about
>> correctness. =A0You don't want tasks with different opinions about the
>> contents of a particular block.

>I was going to say that embedded Forthers like me wouldn't use blocks,
>but then it just occurred to me that blocks would be a great way for a
>16-bit Forth to deal with large SPI flash.

Or on chip flash for that matter.
My renesas ciforth takes advantage of a 1 Mbyte on chip flash
to store the library. Bottom line is that it behaves much like
a lina or wina system. It has renesas specific code to make a
turnkey, such that e.g. after reset it behaves as a clock
playing big ben at the hours.

See also renesas.html on my site below.

>-Brad

Groetjes Albert

--
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Rubin  
View profile  
 More options Feb 13, 5:06 pm
Newsgroups: comp.lang.forth
From: Paul Rubin <no.em...@nospam.invalid>
Date: Mon, 13 Feb 2012 14:06:51 -0800
Local: Mon, Feb 13 2012 5:06 pm
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?

Andrew Haley <andre...@littlepinkcloud.invalid> writes:
> In all of them: it's not just about space saving, it's about
> correctness.  You don't want tasks with different opinions about the
> contents of a particular block.

But that sounds pretty awful-- a task allocates a buffer and another
task can go and mess with it if you do a debugging print?  It sounds
like a potential source of bugs, given no obvious way to tell whether a
given word might have some i/o effect.  I'd have expected in a memory
constrained system, to just put a single task in charge of any buffers
on a particular file.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Elizabeth D. Rather  
View profile  
 More options Feb 13, 5:21 pm
Newsgroups: comp.lang.forth
From: "Elizabeth D. Rather" <erat...@forth.com>
Date: Mon, 13 Feb 2012 12:21:01 -1000
Local: Mon, Feb 13 2012 5:21 pm
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
On 2/13/12 12:06 PM, Paul Rubin wrote:

> Andrew Haley<andre...@littlepinkcloud.invalid>  writes:
>> In all of them: it's not just about space saving, it's about
>> correctness.  You don't want tasks with different opinions about the
>> contents of a particular block.

> But that sounds pretty awful-- a task allocates a buffer and another
> task can go and mess with it if you do a debugging print?  It sounds
> like a potential source of bugs, given no obvious way to tell whether a
> given word might have some i/o effect.  I'd have expected in a memory
> constrained system, to just put a single task in charge of any buffers
> on a particular file.

There's really a lot of design involved in the block management scheme,
really more than it's possible to summarize neatly here.  If you have
access to my Forth Programmer's Handbook (pdf included in SwiftForth
free eval) there's an extended discussion of multitasking, blocks and
buffers, and all that jazz.

Briefly, buffers aren't "allocated". They are configured as a part of
the architecture of the system. They're always there. The disk
management system (which includes the word BLOCK, BUFFER, and the rest
of the machinery, makes a block in a buffer available to any task that
requests it. Actual reads and writes are transparent.

As for knowing "whether a given word might have some I/O effect," it's
really pretty obvious: you know when you accept input, display text,
read or write disk, or access any application-specific device, etc.,
don't you?

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."
==================================================


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
A. K.  
View profile  
 More options Feb 13, 6:08 pm
Newsgroups: comp.lang.forth
From: "A. K." <a...@nospam.org>
Date: Tue, 14 Feb 2012 00:08:16 +0100
Local: Mon, Feb 13 2012 6:08 pm
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
On 13.02.2012 19:23, Elizabeth D. Rather wrote:

> One must take a broad view of what defines I/O: for example, writing a
> character to a screen is I/O, even if the "screen" is in a local frame
> buffer. And any drivers that the programmer adds must also follow the
> rule. So long as everyone respects this rule, cooperative multitasking
> is effortless and in over 30 years of application programming I don't
> recall any problems.

Well... in a system with different task priority levels (eg PLCs) one
usually wants deterministic time behaviour and triggered emergency programs.

It can become quite fiddlish to do it with cooperative multitasking only.

But fortunately not all RT systems demand it. So generally you are right.

Andreas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Elizabeth D. Rather  
View profile  
 More options Feb 13, 6:16 pm
Newsgroups: comp.lang.forth
From: "Elizabeth D. Rather" <erat...@forth.com>
Date: Mon, 13 Feb 2012 13:16:34 -1000
Local: Mon, Feb 13 2012 6:16 pm
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
On 2/13/12 1:08 PM, A. K. wrote:

Depending on what response time you require, it's usually possible to
ensure adequate response. Actually, I only remember one occasion in
which we had to tweak the algorithm a bit, and that was 20+ years ago,
when processors were a lot slower than they are today. Guaranteeing
response times with a millisecond is no problem, and usually you can do
much better.

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."
==================================================


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Haley  
View profile  
 More options Feb 14, 5:36 am
Newsgroups: comp.lang.forth
From: Andrew Haley <andre...@littlepinkcloud.invalid>
Date: Tue, 14 Feb 2012 04:36:52 -0600
Local: Tues, Feb 14 2012 5:36 am
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?

In practice it's not a problem.  If you want an array on disk you can
do something like

xxx constant block#
: A@ ( index - n)   cells 1024 /mod  block# +  block + @ ;
: A! ( n index)   cells 1024 /mod  block# +  block + ! ;

Untested, but you get the idea.  BLOCK itself is very fast if the
block is in a buffer, so it's quite OK to call it from such a word.

Andrew.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Haley  
View profile  
 More options Feb 14, 5:49 am
Newsgroups: comp.lang.forth
From: Andrew Haley <andre...@littlepinkcloud.invalid>
Date: Tue, 14 Feb 2012 04:49:44 -0600
Local: Tues, Feb 14 2012 5:49 am
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?

The "trick", if you can call it one, is that the multi-tasker is so
lightweight that it has almost no overhead.  Deterministic behaviour
to guarantee strict response times can be achieved by doing things
that really need to be done immediately (i.e. microseconds) in an
interrupt routine and passing the rest to a task.  Because a task
switch is done on every I/O operation, the multi-tasker is running
very much faster than conventional time-sliced systems, perhaps
thousands of times faster.  A task switch is not much more expensive
than a call, and usually most tasks will be sleeping most of the time.
So, the time between an interrupt happening and the associated task
doing the work can be very short.  Millisecond response times are not
hard to do at all, and that was true even on the processors of twenty
years ago.

Andrew.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Albert van der Horst  
View profile  
 More options Feb 14, 8:13 am
Newsgroups: comp.lang.forth
From: Albert van der Horst <alb...@spenarnc.xs4all.nl>
Date: 14 Feb 2012 13:13:06 GMT
Local: Tues, Feb 14 2012 8:13 am
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
In article <slrnjjir92.ald.zbigniew2011REM...@Tichy.myhome.org>,

Zbiggy  <zbigniew2011REM...@gmail.REMOVE.com> wrote:
>In comp.lang.forth, Elizabeth D. Rather wrote:

>> If you're writing portable code that may run on a multitasked Forth you
>> should respect the rule.

>Of course, but I had in mind the ability of blocks - mentioned in SF - which
>I particularly like: to use it as kind of "swap partition" equivalent. It
>seems, it should be used with much greater care, than I thought at first: we
>don't want data "swapped" to blocks to get corrupted.

It is not too bad. Each time you use the BLOCK word, it is checked
whether the BLOCK is in memory.
E.g.
HEX 10 0 DO I #LINE * DUP BLOCK + #LINE TYPE CR LOOP

Don't do the BLOCK outside of the loop!

>Or maybe it's not possible at all in multitasked environment - at least not
>in the way similar to one, in which Linux uses its swap partitions/files:
>actually, we cannot block I/O operations at all just to make sure, they won't
>allow buffers affection. The machine would be unusable.

Groetjes Albert

--
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
A. K.  
View profile  
 More options Feb 14, 8:19 am
Newsgroups: comp.lang.forth
From: "A. K." <a...@nospam.org>
Date: Tue, 14 Feb 2012 14:19:57 +0100
Local: Tues, Feb 14 2012 8:19 am
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
On 14.02.2012 11:49, Andrew Haley wrote:

Yeah, you're right, of course.

However in some RT systems you need to implement a scheduler. It manages
interrupt handling priorities, monitors time slices, and kills blocked
tasks or stops tasks that do not behave nicely (eg that overuse their
assigned time contingent).

Then it's a bit more than PAUSE.  ;-)

And: cooperative multitasking offends against Murphy's law.  :-))

Andreas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Haley  
View profile  
 More options Feb 14, 8:39 am
Newsgroups: comp.lang.forth
From: Andrew Haley <andre...@littlepinkcloud.invalid>
Date: Tue, 14 Feb 2012 07:39:51 -0600
Local: Tues, Feb 14 2012 8:39 am
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
Albert van der Horst <alb...@spenarnc.xs4all.nl> wrote:

That won't work: you need to copy the line to e.g. PAD before calling
TYPE.  Forth, Inc have always included a word to do this.

Andrew.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Haley  
View profile  
 More options Feb 14, 8:52 am
Newsgroups: comp.lang.forth
From: Andrew Haley <andre...@littlepinkcloud.invalid>
Date: Tue, 14 Feb 2012 07:52:45 -0600
Local: Tues, Feb 14 2012 8:52 am
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?

A. K. <a...@nospam.org> wrote:
> However in some RT systems you need to implement a scheduler. It
> manages interrupt handling priorities, monitors time slices, and
> kills blocked tasks or stops tasks that do not behave nicely (eg
> that overuse their assigned time contingent).

I suspect that a lot of the heroic efforts made by systems with
priority schedulers really just compensate for the fact that they're
not fast enough.  Also, as soon as you have pre-emption you need a lot
of code to handle mutexes, semaphores, and so on, and this slows down
the system even more.

It's different, of course, if you are sharing a general-purpose
operating system with untrusted code, but that's a very different kind
of system.

> Then it's a bit more than PAUSE.  ;-)

> And: cooperative multitasking offends against Murphy's law.  :-))

I don't think so: if you have all that code that depends on priorities
to work correctly, you have a lot more that can go wrong.

Andrew.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
A. K.  
View profile  
 More options Feb 14, 9:33 am
Newsgroups: comp.lang.forth
From: "A. K." <a...@nospam.org>
Date: Tue, 14 Feb 2012 15:33:34 +0100
Local: Tues, Feb 14 2012 9:33 am
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?
On 14.02.2012 14:52, Andrew Haley wrote:

> A. K.<a...@nospam.org>  wrote:

>> However in some RT systems you need to implement a scheduler. It
>> manages interrupt handling priorities, monitors time slices, and
>> kills blocked tasks or stops tasks that do not behave nicely (eg
>> that overuse their assigned time contingent).

> I suspect that a lot of the heroic efforts made by systems with
> priority schedulers really just compensate for the fact that they're
> not fast enough.

Sad but true. But industry automation cannot afford to chase after every
hardware innovation of the semiconductor industry. Typical DCS life
spans are 15 years.

> Also, as soon as you have pre-emption you need a lot
> of code to handle mutexes, semaphores, and so on, and this slows down
> the system even more.

But whether you do this on top of a RTOS or as part of your Forth
application doesn't matter. You have to spend processor cycles on
managing RT events either way.

> It's different, of course, if you are sharing a general-purpose
> operating system with untrusted code, but that's a very different kind
> of system.

Why untrusted? Just because it's developed by others? How can you be
sure that your own code is bug-free?

Andreas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Haley  
View profile  
 More options Feb 14, 10:24 am
Newsgroups: comp.lang.forth
From: Andrew Haley <andre...@littlepinkcloud.invalid>
Date: Tue, 14 Feb 2012 09:24:48 -0600
Local: Tues, Feb 14 2012 10:24 am
Subject: Re: Why buffer contents can be influenced by EMIT or TYPE?

A. K. <a...@nospam.org> wrote:
> On 14.02.2012 14:52, Andrew Haley wrote:
>> A. K.<a...@nospam.org>  wrote:

>> Also, as soon as you have pre-emption you need a lot of code to
>> handle mutexes, semaphores, and so on, and this slows down the
>> system even more.

> But whether you do this on top of a RTOS or as part of your Forth
> application doesn't matter. You have to spend processor cycles on
> managing RT events either way.

Of course, but that's way different from doing things that are only
necessary because of the type of scheduler in use.

>> It's different, of course, if you are sharing a general-purpose
>> operating system with untrusted code, but that's a very different
>> kind of system.

> Why untrusted? Just because it's developed by others? How can you be
> sure that your own code is bug-free?

You can't, but pre-emption doesn't necessarily make the system as a
whole any more reliable.  If you end up with a system that is more
complex than it needs to be then there's more of it to go wrong.
Adding things like pre-emption for tasks that have run too long is
just sticking plaster.  Sure, it's always good to have a watchdog, and
this will trigger if any task runs too long, but that's really for
hardware failures.  It's a poor substitute for getting the software
right.

Andrew.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 48   Newer >
« Back to Discussions « Newer topic     Older topic »