1. IPC and Shared Memory blocks

I fired up Patrat's IPC client server demo using IPC.ew, and surprise-surprise, client is blocked (program flow is stopped) during the send msg process until server does some stuff and frees the handle.

And the server doesn't serve anything to anything, it just displays msgs from clients. The clients do not see each other's msgs.

Am i missing some important clues?

new topic     » topic index » view message » categorize

2. Re: IPC and Shared Memory blocks

Does anyone have a bi-directional data sharing memory, to which more than two separate processes can connect, and all can read what any of them write to the shared memory?

new topic     » goto parent     » topic index » view message » categorize

3. Re: IPC and Shared Memory blocks

The reason i think this is important enough thread to be bothering you with, is that i have found and implemented a way to extract variable names and their contents for sending to separate apps which act as plugins to the main app. It will share between apps written in Eu v3.1 and OE v4 and vice versa. You pick the vars to share with a little syntax candy when declaring them, and then your program can execute

foo = "bar" 

and instantly the separate plugin would know you assigned "bar" to foo. The plugin could crash, and the app would be safe otherwise. Or, you could terminate the plugin, edit it, re-launch it, and it's part of the main application again.

But i need someone who knows windoze events and shared memory, a la

-- Windows IPC (InterProcess Communication) Library 
-- Version 1.0 
-- Thomas Parslow (patrat) 
to do this sharing properly. I have various sharing channels happening, but it isn't proper, it's many memory pools. I need one shared memory handle (for now, maybe later, more handles and pools) that is bidirectional for all the code that uses it.

new topic     » goto parent     » topic index » view message » categorize

4. Re: IPC and Shared Memory blocks

While investigating something else entirely, I stumbled upon "Share Memory Between Processes" by Mario Steele/Jason Mirwald in the Archive.
No idea whether that might be of any use...

new topic     » goto parent     » topic index » view message » categorize

5. Re: IPC and Shared Memory blocks

katsmeow said...

Does anyone have a bi-directional data sharing memory, to which more than two separate processes can connect, and all can read what any of them write to the shared memory?

ZeroMQ supports IPC and makes this type of bi-directional communication pretty straightforward.

Edit: I just noticed this: http://api.zeromq.org/2-1:zmq-ipc

The inter-process transport is currently only implemented on operating systems that provide UNIX domain sockets. 

-Greg

new topic     » goto parent     » topic index » view message » categorize

6. Re: IPC and Shared Memory blocks

petelomax said...

While investigating something else entirely, I stumbled upon "Share Memory Between Processes" by Mario Steele/Jason Mirwald in the Archive.
No idea whether that might be of any use...

Version 1 and 2.1 Beta crash instantly with C_LONG undefined.

Version 3.3 crashes instantly with "Invalid argument type" on line 27 : xGetLastError = machine_func( 51, {kernel32, "GetLastError", {0}, C_ULONG})

But i agree, if they worked, the premise sounds great!

new topic     » goto parent     » topic index » view message » categorize

7. Re: IPC and Shared Memory blocks

ghaberek said...

Edit: I just noticed this: http://api.zeromq.org/2-1:zmq-ipc

The inter-process transport is currently only implemented on operating systems that provide UNIX domain sockets. 

-Greg

So no Windows support.

pic of Kat cussing loudly 

new topic     » goto parent     » topic index » view message » categorize

8. Re: IPC and Shared Memory blocks

katsmeow said...

Does anyone have a bi-directional data sharing memory, to which more than two separate processes can connect, and all can read what any of them write to the shared memory?

Alas, I developed a nix-only solution for Euphoria over a decade and a half ago. It would actually be really simple though to port it to Windoze under Eu 4.x (if someone could find the interest).

ghaberek said...

ZeroMQ supports IPC and makes this type of bi-directional communication pretty straightforward.

Edit: I just noticed this: http://api.zeromq.org/2-1:zmq-ipc

The inter-process transport is currently only implemented on operating systems that provide UNIX domain sockets. 

-Greg

Well, for Windoze users, there is still a way.

ZeroMQ appears to support being built under cygwin ( https://github.com/zeromq/libzmq/blob/master/README.cygwin.md , http://stackoverflow.com/questions/21017296/how-to-build-zeromq-on-windows-with-cygwin ) and cygwin appears to support unix domain sockets ( https://cygwin.com/cygwin-ug-net/highlights.html , http://stackoverflow.com/questions/23086038/what-mechanism-is-used-by-msys-cygwin-to-emulate-unix-domain-sockets , https://cygwin.com/ml/cygwin/2003-05/msg00142.html )

So, one can in fact build a version of ZeroMQ, for Windoze, using cygwin, that supports unix domain sockets. A little bit of work perhaps, but nothing too difficult for an experienced C/C coder.

new topic     » goto parent     » topic index » view message » categorize

9. Re: IPC and Shared Memory blocks

jimcbrown said...
katsmeow said...

Does anyone have a bi-directional data sharing memory, to which more than two separate processes can connect, and all can read what any of them write to the shared memory?

Alas, I developed a nix-only solution for Euphoria over a decade and a half ago. It would actually be really simple though to port it to Windoze under Eu 4.x (if someone could find the interest).

If only such an interested person had that code. Oh, hmm, the windose msg code isn't in nix.

jimcbrown said...

So, one can in fact build a version of ZeroMQ, for Windoze, using cygwin, that supports unix domain sockets. A little bit of work perhaps, but nothing too difficult for an experienced C/C coder.

Alas, i am not that person. Rather than relying on a 3rd party solution, and given we already have a socks and http and irc solution, wouldn't it be better all the way around to have the IPC or the "Memory Sharing Library" working?

I did find a v3 version of the sharing lib that Jordah Ferguson released in 2002, which doesn't crash. It does not, however, have the windose msg passing wrapped to let processes know something happened and to look at the memory. That's all i know of it so far....

new topic     » goto parent     » topic index » view message » categorize

10. Re: IPC and Shared Memory blocks

jimcbrown said...

Alas, I developed a nix-only solution for Euphoria over a decade and a half ago. It would actually be really simple though to port it to Windoze under Eu 4.x (if someone could find the interest).

Just being curious, are you talking of pipeio?

new topic     » goto parent     » topic index » view message » categorize

11. Re: IPC and Shared Memory blocks

petelomax said...
jimcbrown said...

Alas, I developed a nix-only solution for Euphoria over a decade and a half ago. It would actually be really simple though to port it to Windoze under Eu 4.x (if someone could find the interest).

Just being curious, are you talking of pipeio?

But pipeio is not fully bidirectional?

Reusing the same memory would save de/allocating it as it's used, and not all interfacing needs to be bidirectional, but lets not close the door on it.

new topic     » goto parent     » topic index » view message » categorize

12. Re: IPC and Shared Memory blocks

petelomax said...
jimcbrown said...

Alas, I developed a nix-only solution for Euphoria over a decade and a half ago. It would actually be really simple though to port it to Windoze under Eu 4.x (if someone could find the interest).

Just being curious, are you talking of pipeio?

No, I was refering to my FakeThreads libraries:

http://openeuphoria.org/forum/m/47048.wc

http://openeuphoria.org/forum/m/72948.wc

http://openeuphoria.org/forum/m/27468.wc

It had three versions - a version using nix shared memory, a version using unix domain (file) sockets, and a version using TCP/IP. Back there Eu had no socket support so I had also wrapped a nix specific socket library.

But the last one should be easy to rewrite to use Eu4's sockets.

katsmeow said...

Oh, hmm, the windose msg code isn't in nix.

Edit (added): No, but the library used a notification system through TCP implemented through something akin to select() or poll(), making it multi-platform.

katsmeow said...

But pipeio is not fully bidirectional?

Actually, it is. The child process can read commands from stdin, and write commands to stdout. The parent process will have special file descriptors/handles to perform the other side of this communication.

I am not sure about the Windoze implementation, but on nix it's quite trivial to make it non-blocking.

new topic     » goto parent     » topic index » view message » categorize

13. Re: IPC and Shared Memory blocks

Ok, i have two programs bidirectionally sharing memory (sending Eu objects back and forth), using

Memory Sharing Library 
Version: 3.0 
Created by: Jason Mirwald and Mario Steele 
Modified by Jordah Ferguson to Share Euphoria Objects 
Modified by Kat 
but i still need to add the winmsg'ing to avoid polling the memory and etc. I am trying to figure out how it's done in
Windows IPC (InterProcess Communication) Library 
Version 1.0 
Thomas Parslow (patrat) 

EDIT: I'm stuck. Apparently,

while c_func(xGetMessage, {msg, NULL, NULL, NULL}) do 
 --  c_proc(xTranslateMessage, {msg}) 
 --  c_proc(xDispatchMessage, {msg}) 
end while 

must be looping constantly. But it isn't using any cpu. Makes no sense.

new topic     » goto parent     » topic index » view message » categorize

14. Re: IPC and Shared Memory blocks

Alllllrrrrighty, i got 3 identical apps running, each can send winmsgs to the other two, so that's almost solved. And 3 apps reading and writing to shared memory works too. And all of them can be started and shut down in any order.

So how many bytes long can a winmsg be?

And why does smta.ew smell like it is sending only one character of the actual msg at a time? Can't i send a whole url in one winmsg?

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu