I'm trying to write a python class utilizing parallel processing/threading for reading two serial ports(/dev/ttyS1 and /dev/ttyS2). Both of these ports are running at a 19200 baud rate and are constantly active. I used pySerial for this purpose.
Both of the read operations need to be run continuously and concurrently. I am wondering if should use the thread library or threading library or the multiprocessing library. I'm only worried because of the global interpreter lock which doesnt' give true threading ability for heavy IO operations. But if the global interpreter lock doesn't affect me then I will use the threading/thread module. However if it does then I would need to cross compile the python multiprocessing libraries because this is on an embedded system.
So my code would typically have thread1 or process1 = reading ttyS1 and writing to a buffer after performing some string operations on the read lines. thread2 or process2 = reading ttyS2 and writing to another buffer after performing some string operations on the read lines. Other functions etc These buffers are further utilized by other parts in the code.
Also does multiprocessing in python require multiple cores/cpus?
Thanks for reading!