【单选】假定有一台16核CPU物理机器,利用python语言写了一个多线程...
发布于 2022-03-03 16:32:26
【单选】假定有一台16核CPU物理机器,利用python语言写了一个多线程函数.import threading, multiprocessing
def loop():
x = 0
while True:
x = x ^ 1
for i in range(multiprocessing.cpu_count()):
t = threading.Thread(target=loop)
t.start()
请问,在CPython解释器下仅执行该段Python代码此台机器CPU使用率上限最接近哪个选项?
def loop():
x = 0
while True:
x = x ^ 1
for i in range(multiprocessing.cpu_count()):
t = threading.Thread(target=loop)
t.start()
请问,在CPython解释器下仅执行该段Python代码此台机器CPU使用率上限最接近哪个选项?
登录后免费查看答案
关注者
0
被浏览
27