How do you do this?
- From: "Jeff Fox" <fox@xxxxxxxxxxxxxxxxxxx>
- Date: 23 Jun 2006 11:29:39 -0700
I am sure that different people do this simple thing
in different ways. I would be interested in how you do
it in your Forth product.
SwiftForth, VFX, gForth, bigForth, iForth, tforth, win32Forth,
aforth, eforth, notforth, thisforth, thatforth (maybe not newforth)
etc. can all talk to other computers on a network and
those other computers could also be running the
same Forth so that they can run programs in parallel.
Some already have facilites to do this and to
exchange messages and use semiphores, mutexs,
and channels. Some can just click on an html
link for instance and pull a document into the editor
from a remote location.
It is clearly completely trivial to have the programs
all pre-compiled and pre-loaded as part of the Forth
systems dictionaries so that one only has to send
a short message to a node to tell it to run any
Forth code already in the dictionary. And using
the network to load and launch a Forth should be easy.
And one could send Forth source code as a message and
get a system to evaluate it when there is a complete Forth
system on the end node.
My question is how would you deal with problem of
sending a program to a node that is not already on that
node and getting it to execute. As an example lets take a very
trivial Forth code example:
: DEMO ( n1 n2 -- n1 n2+n1 n2+n1 )
over + dup ;
Compile that code and produce a binary image
that is appropriate for the target Forth node that gets
it as a message. Then encapsulate it in some
way to make it suitable for transmission to
the other node, send it and have the other end
run it.
The other node should be in a low power or
sleep mode if possible. When it gets the message
it should get an interrupt or use some mechanism
to come out of low power sleep and process the
incoming message. The message should then
be executed and the worker processor should then
go back into low power mode and wait for the
next message.
Now I imagine that some optimziing compilers
complicate the problem, but basically it is a pretty
simple problem.
One could tokenize the definition of DEMO and
get its word count and make a list with a count
that would include ' over ' + ' dup ' exit
and the worker system could get the count
and read and execute each Forth word.
Then it whould send an ack back to the source
of the message and wait for another message.
But of course that would defeat some optimizers.
So one could also compile the code with optimization
and then count the code then send a counted binary
sequence in the message and have it get loaded and
executed by the worker system. This would let one take
advantage of their compiler optimization.
Do you think this is a simple problem or a hard problem?
How would you or do you do this in your system?
How much code will or does it take?
What are the code components and thier sizes?
How long does it take from the time that you begin
loading the message on one end until the worker
processor has completed the process and is
waiting for next command? (give units not just a number)
.
- Follow-Ups:
- Re: How do you do this?
- From: Stephen Pelc
- Re: How do you do this?
- From: Robert Patten
- Re: How do you do this?
- From: Dmitry Ponyatov
- Re: How do you do this?
- From: Trey Boudreau
- Re: How do you do this?
- From: Howerd Oakford
- Re: How do you do this?
- From: rdragomir
- Re: How do you do this?
- From: Alex McDonald
- Re: How do you do this?
- Prev by Date: Re: SEAforth Instruction Set
- Next by Date: Re: Can anyone build a seaforth computer ?
- Previous by thread: Header structure for intelligent COMPILE,
- Next by thread: Re: How do you do this?
- Index(es):
Relevant Pages
|
Loading