On Monday, 8 January 2024 07:52:04 EET Oğuzhan Gedikli wrote:
> Hello Jim,
> I am sending the code you see above that I wrote before as an example. If
> you enable the time.sleep(2) commands, you will see that the 'Total Switch
> Time' takes about 2.2 seconds (this is what I observed). This brings me to
> the point that if the processor had performed the operation serially it
> should have taken more than 4 seconds, but instead it took '2 + switch
> time'. In fact, if you look at it, the code is played in parallel. The
> problem starts here: When I comment on the time.sleep(2) commands, and
> leave only the switch commands, my observation is that it takes about 200
> ms and this process takes place serially. Somehow, the SDRs lock the
> processor and the other one does not start until the process of one is
> finished. I will try this without the 'Usb Hub', in fact, if you look, it
> can actually serialize the process.

Python multithreading does not have real parallelism. See this excellent 
presentation, pages 9 and 10: https://dabeaz.com/python/UnderstandingGIL.pdf
With Python you need multiprocessing to achieve true parallelism, however that 
introduces other problems like overhead and sharing state between interpreter 
instances.

Adrian





Reply via email to