Sending crtl+c to python process result in running full cpu-usage?

12 views
Skip to first unread message

Hongxin Song

unread,
Feb 24, 2018, 3:07:05 AM2/24/18
to cython-users
Dear all!

     I want to use multithreading module to study GIL performance in python version of 2.7.6 and CentOS6 system installed glibc-2.12, that have 32 cores. Then I make 8 python child threads run, then the cpu usage is near to 300%, but when I send crtl+c to process, the cpu usage is near to 800%. Why ? The codes as follow:

    
#coding=utf-8
import threading
def thread_tt(t):
   
while True:
       
pass
for x in xrange(0, 8):
    t
= threading.Thread(target=thread_tt, args=(5,))
    t
.start()

I think 300% cpu-usage result from one thread calls sem_post ,and one more thread call sem_wait frequently. But, 800% cpu-usage looks like every thread call sem_post and sem_wait at the same.


Reply all
Reply to author
Forward
0 new messages