Python Multithreading (not all threads progress) -
-- launch 10 threads -- threads share queue.queue(). -- each thread gets item queue -- each thread communicates first external webserver -- processes data coming ext. webserver -- communicates internal db -- gets next item queue -- repeats until queue finishes -- @ point threads joined , main thread exits -- in code, in main thread populate queue.queue() 500 items -- each thread gets first item in queue. i observe that:
-- (that means when each thread processing first item) 10 threads starts , proceeds -- however, second item onwards, 2 10 threads progress. -- since there multiple network, i/o operations involved, assume threads should interleave , cpu time.
could please explain behavior? pointers documentation or asked question on stack helpful.
sysctl hw.ncpu (mac os) hw.ncpu: 2
regards,
Comments
Post a Comment