newprint question:
In Unix, on a program with parents and some children: - how parents can alert children to efficiently some work ..?
- or do parents have to wait for the parents to do some work?
EDIT:
This program tries to make a complex calculation in parallel, I already share memory as a common workspace for updating results for all children and data transfers. In.
Now what do I need? Parents say "start" to all their children effectively ... (often called)
Thanks
Your ipc
tag says all this. You need to check inter-process communication:
- Shared Memory
- Semaphore.
- Pipes
- Signal
- Memory-mapped files
- Sockets.
There is no doubt that these are other possibilities but this is a good start.
How much depends on each of your use cases Efficient If you need to inform only one child to do something, the signal is probably what I use. If you need to move some more information between the procedures, then it is probably a good idea to meet the requirements.
One thing you would want to consider would be to use interoperability stuff completely and just use threads. At least in Linux, the yarn scheduler is the first class citizen. Older Unix may have distinguished user-mode threads, but this is not the case with Linux.
I have found that it is easy to do this and your information is shared automatically (keeping in mind), still keeping you protected with shared mutes. And so on)
There is another possibility that if you are already committed to shared memory, use the signals to assume that you have kept that memory segments separate for each child (and they know Are where they are), signaling is probably the fastest way to inform a group of children for parallel work.
If your children just wait for a 30-second timeout (for example) to work from time to time in a select
in the loop, Will promptly exit with EINTR
.
Comments
Post a Comment