How can I share data between a parent and forked child process in Haskell?

How could I deploy a child process using Haskell first?

Also, if pipes are an obvious solution to the issue of data exchange - is there any other way to do this other than using pipes? I am familiar with using shared memory segments in C (shmget, * shmat, shmdt and shmctl functions). Can Haskell imitate this? If so, how?

I would be very grateful for any help you could save.

I have to admit that I am very new to functional programming languages, especially when it comes to Haskell. So forgive me (and please correct me) if I say something stupid.

+5
source share
4 answers

Better yet, use software transactional memory, that is, TVars and TChannels.

Recommend the same book, a different chapter: http://book.realworldhaskell.org/read/software-transactional-memory.html

Here is a small example of this method in action: http://sequence.complete.org/node/257

+2
source

The OP asked about communication with the subprocess, not with the thread. Pipes are great for this. You can also call the C library function directly from Haskell if you want, although this can get complicated.

This question has a better answer: Is there any standard Haskell library related to the communication process?

+1
source
0

All Articles