If I'm writing a Python program that execute other two executables(C++) in a producer and consumer manner, what is the right lib to do? asyncio? multiprocessing?
The main execution thread or process is:
- monitoring status of producer and consumer processes.
- if one of them fails, terminate the other.
- if Ctrl-C is received, terminate both of them
- if both of them finishes, exit and report success.
The Producer:
- Keep generating data to a temp file. (that temp file might be a fifo from os.mkfifo()?)
The Consumer:
- Keep consuming the temp file
Both Producer and Consumer are CPU intensive, and they need to run in parallel. Ideally the intermediate temp file doesn't need to touch real storage and stay in memory. Otherwise performance is a big concern since the temp file is of size 10GB or so.