On Fri, 13 Feb 2015, Lewis Balentine wrote:
> On 02/13/2015 02:35 PM, Bruce Cunningham wrote:
> > Caveat,
> >
> > Thanks for the info.
> >
> > I'm a little concerned about using a "disk" based database because the disk 
> > is flash, which has a limited number of write cycles.  Even with 
> > wear-leveling, I would eventually kill parts of the flash.  I don't want 
> > these things dropping dead in the field after a year or so...
> >
> > I was considering something like named pipes, but I'm a little unclear 
> > about how Linux actually handles them.  I thought I saw a mention that they 
> > are managed via temporary files within the file system, and that would 
> > defeat the whole idea of not writing to disk.
> >
> > I know how to do interprocess communication in Windows, but not in Linux 
> > with Gambas.
> >
> > Bruce
> >
> > Bruce Cunningham
> > bcunning...@sportif.com
> >
> >
> Forgive me for poking my nose in where my profound ignorance indicates I 
> should not but ....
> 
> Would not a direct solution be:
> 1) Have the resident program ALLOC a section of ram
> 2) Save the address as part of a unique file name (i.e. ADRxxxxxx.ADR 
> where xxxxx is the address)
> 3) Pass the required parameters back and forth via shared memory.
> 4) Both programs would need to poll the shared memory for updates (some 
> bytes could be used for status).
> 
> http://gambaswiki.org/wiki/lang/alloc
> http://gambaswiki.org/wiki/lang/byte@
> http://gambaswiki.org/wiki/lang/integer@
> http://gambaswiki.org/wiki/lang/long@
> http://gambaswiki.org/wiki/lang/string@
> ... etc ...
> 

This is almost a solution. The only remaining problem is to actually share
the memory. If you allocate some memory in one process, another process
cannot see it. Indeed independent processes have distinct virtual address
spaces (unless they specifically arrange otherwise), so a pointer from one
process is of no use to another process. They live in (almost) entirely
different realms, address-space-wise.

Gambas does not include functionality to share memory, so you would be
doomed to use Extern, hack the interpreter or write a native component,
each of which requires some knowledge of C and Linux (or at least POSIX)
and *may* bother the other parts of the interpreter but I don't know, never
tried it.

A named pipe or a UNIX socket are easier ways here.

On Fri, 13 Feb 2015, T Lee Davidson wrote:
> Named pipes do indeed require a node on the file system.

While that's true, they only require a node on the *virtua* file system. No
physical disk is touched ever:

  $ man 7 fifo
  [...]
  When processes are exchanging data via the FIFO, the kernel passes all
  data internally without writing it to the filesystem.   Thus, the FIFO
  special file  has  no contents on the filesystem; the filesystem entry
  merely serves  as  a reference point  so that processes can access the
  pipe using a name in the filesystem.
  [...]

and luckily, Gambas has support for named pipes[0]. Or sockets[1]...

Regards,
Tobi

[0] http://gambaswiki.org/wiki/lang/pipe
[1] http://gambaswiki.org/wiki/comp/gb.net/

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to