What limitations does the Python GIL place on multithreading? (with example)

I'm having trouble getting clarity on this.

I have a program, say, with three threads - A, B and C.

C is a 'hardware manager', A and B perform their own tasks using APScheduler for scheduling and as part of their routines, make requests of the hardware manager thread.

If I use a time.sleep() in thread C (sometimes necessary to wait on certain hardware-related things to complete), can other methods on thread C be called?

eg. 'A' asks 'C' to turn on a relay which powers a modem. The method incorporates a sleep(), so once it returns, 'A' can expect a network connection to be present. During this time though, 'B' might request a battery voltage reading from an ADC. Should I expect 'B' to be stuck waiting for the first method call to return?

Answers


OK, so practically speaking, I think the answer is that time.sleep() will yield to other waiting threads.

Perhaps other limitations or concerns will rear their heads in time, but at this stage, performance is not the issue, only concurrency.


Need Your Help

Tips on designing a .Net framework application

c# wpf silverlight

Can you please provide me with some tips/guidelines when architecting, designing and implementing a .net framework application, with the requirements given below:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.