In article <
73c2da86-b581-4519...@googlegroups.com>,
Marcel Hendrix <
m...@iae.nl> wrote:
>I want to experiment with shared memory between iForth instantiations
>running on a multi-core CPU. On Windows, it is possible to share a memory-mapped file between programs. When a non-existing file name is given, the
>used system call defaults to an arbitrary memory buffer, exactly what is
>needed.
I have success in going the other direction. Starting Forth and then
forking the process. Naturally the dictionary space is shared (cutting
waste) and a piece of common space (if need be Gbytes)
Each Forth has it own private dictionary space to add definitions
to, so it is fully functional.
It is based on cooperation. Each Forth is supposed to not mess with
each others stack and other private parts.
This works on linux (although I have discovered a defect in the 64 bit forking
that I've worked around.)
The same compatible (!) system works on Windows 32, no need to align
Windows and Linux for a common API that will hard to come by.
That is the advantage of relying on Forth itself.
Thanks to the abysmal documentation of the Windows API's I have
not managed to run it on Windows 64. Mind you, it is supposed
to work the same way as on Windows32. The answers that you get
is that you should use the C++ compiler not the API.
(Same with Linux, "you should use the shared libraries, not the
system calls." Only C++/C compiler writers have the right to
use system calls.)
>First experiments are successful, I am able to pass text from one iForth
>to another with literally only a single line of code. However, after hours of
>debugging, it proves that the sharing is only possible when both iForth
>instances are run as an Administrator, which is somewhat understandable,
>but a nuisance.
Being root should have nothing to do with it. You are in for a
nasty ride.
>The MS example 'C' code ignores the problem, suggesting that
>default security measures do not prevent the idea from working.
>Does anybody know how to get around this problem (or lessen the OS
>default security level a notch)?
I had practical motivation to implement this multi tasking
for the parallel Meissel/Hedgehog inspired idea's of counting
primes. It worked.
What programs do you have in mind to accommodate with this extension?
>
>-marcel
Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge.
Don't sell the hide of the bear until you shot it.
Better one bird in the hand than ten in the air.