-
Notifications
You must be signed in to change notification settings - Fork 0
Problems & Solutions
For when we are asked "what are the technical challenges" or when we write a report / presentation.
Camera and webserver ran on a worker thread separate from the main thread initially. The assumption was that because it was on the worker thread, it could run in parallel with the main thread and we would gain performance due to task division. With Python this wasn't the case due to the Global Interpret Lock (GIL). The GIL is a global mutex that Python uses that prevents two threads from actually executing simultaneously even though they may be on different CPU cores. This means that video decoding is happening for a period of time, then the main thread is executing, then the video decoding - not ideal and leads to extreme slowdowns.
Python provides a module called multiprocessing
that allows spawning of child processes. So instead of Python handling multithreading, the operating systems scheduler is used to truly parallelize the application, allowing for faster video decoding since we are not waiting on the main process anymore.