From 3ef978ac77f7f3c8cfa0fcd3d860b40e27f73e85 Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Fri, 8 Nov 2019 23:40:10 +0800 Subject: [PATCH] Add comments --- src/communicator/MultiProcess.py | 7 ++----- src/communicator/MultiProcess_v2.py | 8 +++++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/communicator/MultiProcess.py b/src/communicator/MultiProcess.py index 2ab2d9b..5910673 100644 --- a/src/communicator/MultiProcess.py +++ b/src/communicator/MultiProcess.py @@ -15,11 +15,8 @@ log = Logger() ''' -Multithreading essentially refers to running multiple processes in parallel -Communications between Rpi and other devices involve a session, which means -the Rpi will be waiting for a trigger. Hence if single threaded, Rpi can only -do one thing at one time. With multhreading, Rpi can have multiple sessions -simultaneuously. Image Recognition will have to be run as a thread as well. +Multiprocess to use all available cores on the Rpi +Higher efficiency than multithreading ''' class MultiProcess: diff --git a/src/communicator/MultiProcess_v2.py b/src/communicator/MultiProcess_v2.py index 0216857..7b03204 100644 --- a/src/communicator/MultiProcess_v2.py +++ b/src/communicator/MultiProcess_v2.py @@ -12,6 +12,11 @@ log = Logger() +''' +New structure for multiprocessing to have only 2 queues +Image Recognition process to run in main program +''' + class MultiProcess: def __init__(self, verbose): log.info('Initializing Multiprocessing Communication') @@ -21,9 +26,6 @@ def __init__(self, verbose): self.pc = PC() self.detector = SymbolDetector() - # Just see if this makes the latency worse - # Otherwise try see if can do a mutex - # Essentially a separate process must be able to trigger the parent program self.msg_queue = Queue() self.img_queue = Queue()