0

I'm attempting to do some real-time (sort-of-ish) web-cam video processing. In order to both grab all the frames and process them, I'm running my frame grabber and image processor as two separate processes. In order to have them communicate I'm trying to decide between using python 2.7's multiprocessing.queue and multiprocessing.pipe.

I don't understand the difference between these two classes. One uses put and get to share data. The other uses send and receive. Is there a use-case where one would prefer on method over the other? Should I prefer one method over the other?

martineau
  • 119,623
  • 25
  • 170
  • 301
user1245262
  • 6,968
  • 8
  • 50
  • 77

1 Answers1

0

The multiprocessing.queue is First In First Out (FIFO) queue. You would use this for one-way communication. For example, your grabber process can put() frames onto the queue and the processing process can get() frames from the queue when it's ready to process them.

The multiprocessing.pipe is a 2-way channel and probably doesn't fit your use case. However, if you had 2 processes which were both sending and receiving data between each other you would use the two connection objects where process A sends() on one object and recieves() on the other object and process B does the inverse.

Micah Carrick
  • 9,967
  • 3
  • 31
  • 43