On Oct 26, 2009, at 10:09 AM, Kristján Valur Jónsson wrote: > > >> -----Original Message----- >> From: python-dev-bounces+kristjan=ccpgames.com at python.org >> [mailto:python-dev-bounces+kristjan=ccpgames.com at python.org] On >> Behalf >> Of Sturla Molden >> time.sleep should generate a priority request to re-acquire the GIL; >> and >> so should all other blocking standard library functions with a time- >> out. > > I don't agree. You have to be very careful with priority. > time.sleep() does not promise to wake up in any timely manner, and > neither do the timeout functions. Rather, the timeout is a way to > prevent infinite wait. > > In my experience (from stackless python) using priority wakeup for > IO can result in very erratic scheduling when there is much IO going > on, every IO trumping another. You should stick to round robin > except for very special and carefully analysed cases. All the IO tasks can also go in their own round robin so that CPU time is correctly shared among all waiting IO tasks. IOW, to make sure that all IO tasks get a fair share *in relation to all other IO tasks*. Tasks can be put into the IO round robin when they "pull the IO alarm" so to speak, so there's no need to decide before-hand which task goes in which round robin pool. I'm not familiar with this particular code in Python, but I've used this in other systems for years to make sure that IO tasks don't starve the rest of the system and that the most "insistent" IO task doesn't starve all the others. S
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4