adam olsen kjbnfagmailcom tue mar 18 2008 129 stefan ring wrote company work last couple years created application server use customer projects embeds python project code written python quite resourcehungry several gb ram mysql databases 50100gb course multithreaded least originally hoped make utilize multiple processor cores know doesnt sit well python application runs heavy background calculations time python service multiple gui clients time also using python problem single background thread would increase response time client threads factor 10 usually led add dirty hack python core make switch threads frequently hack greatly improved response time gui clients also slowed background threads quite bit top would often show significantly less cpu usage 80 instead usual 100 problem thread switching python global semaphore used gil regularly released immediately reacquired unfortunately time leads thread winning race semaphore thus wait time threads dirty patch intervened nanosleep short amount time used 1000 nsecs try call sched_yield rather nanosleep benefit without much performance hit works still much hit try tuning checkinterval see find acceptable throughputresponsiveness balance adam olsen aka rhamphoryncus _______________________________________________ pythondev mailing list zvlllneumpythonorg httpmailpythonorgmailmanlistinfopythondev unsubscribe httpmailpythonorgmailmanoptionspythondevpythondev40tangomucom wed 06 aug 2008 085742 0600 pythondev improved thread switching