Rust 程序设计语言 简体中文版 1.85.0
在等待网络调用完成的同时去处理别的工作就再好不过了。所以同 上操作系统会隐式地中断你的程序以便其它工作可以在网络操作进行的同时继续进行。 注意:视频导出这类操作通常被称为 “CPU 密集型”(“CPU-bound”)或者 “计算密集 型”(“compute-bound”)操作。其受限于计算机 CPU 或 GPU 处理数据的速度,以 及它所能利用的计算能力。而下载视频这类操作通常被称为 “IO 密集型”(“IO-0 码力 | 562 页 | 3.23 MB | 10 天前3Python 标准库参考指南 3.8.20
in a thread pool. with open('/dev/urandom', 'rb') as f: return f.read(100) def cpu_bound(): # CPU-bound operations will block the event loop: # in general it is preferable to run them in a # process pool 常数之一来指定。 一个简单的示例: from resource import * import time # a non CPU-bound task time.sleep(3) print(getrusage(RUSAGE_SELF)) # a CPU-bound task for i in range(10 ** 8): _ = 1 + 1 print(getrusage(RUSAGE_SELF))0 码力 | 1927 页 | 9.69 MB | 9 月前3Python 标准库参考指南 3.8.20
in a thread pool. with open('/dev/urandom', 'rb') as f: return f.read(100) def cpu_bound(): # CPU-bound operations will block the event loop: # in general it is preferable to run them in a # process pool 常数之一来指定。 一个简单的示例: from resource import * import time # a non CPU-bound task time.sleep(3) print(getrusage(RUSAGE_SELF)) # a CPU-bound task for i in range(10 ** 8): _ = 1 + 1 print(getrusage(RUSAGE_SELF))0 码力 | 1927 页 | 9.69 MB | 9 月前3Python 标准库参考指南 3.8.20
in a thread pool. with open('/dev/urandom', 'rb') as f: return f.read(100) def cpu_bound(): # CPU-bound operations will block the event loop: # in general it is preferable to run them in a # process pool 常数之一来指定。 一个简单的示例: from resource import * import time # a non CPU-bound task time.sleep(3) print(getrusage(RUSAGE_SELF)) # a CPU-bound task for i in range(10 ** 8): _ = 1 + 1 print(getrusage(RUSAGE_SELF))0 码力 | 2052 页 | 9.74 MB | 9 月前3Python 标准库参考指南 3.10.15
in a thread pool. with open('/dev/urandom', 'rb') as f: return f.read(100) def cpu_bound(): # CPU-bound operations will block the event loop: # in general it is preferable to run them in a # process pool 常数之一来指定。 一个简单的示例: from resource import * import time # a non CPU-bound task time.sleep(3) print(getrusage(RUSAGE_SELF)) # a CPU-bound task for i in range(10 ** 8): _ = 1 + 1 print(getrusage(RUSAGE_SELF))0 码力 | 2072 页 | 10.39 MB | 9 月前3Python 标准库参考指南 3.10.15
in a thread pool. with open('/dev/urandom', 'rb') as f: return f.read(100) def cpu_bound(): # CPU-bound operations will block the event loop: # in general it is preferable to run them in a # process pool 常数之一来指定。 一个简单的示例: from resource import * import time # a non CPU-bound task time.sleep(3) print(getrusage(RUSAGE_SELF)) # a CPU-bound task for i in range(10 ** 8): _ = 1 + 1 print(getrusage(RUSAGE_SELF))0 码力 | 2207 页 | 10.45 MB | 9 月前3Python 标准库参考指南 3.9.20
in a thread pool. with open('/dev/urandom', 'rb') as f: return f.read(100) def cpu_bound(): # CPU-bound operations will block the event loop: # in general it is preferable to run them in a # process pool import time # a non CPU-bound task (下页继续) 35.8. resource --- 资源使用信息 1875 The Python Library Reference, 发布 3.9.20 (续上页) time.sleep(3) print(getrusage(RUSAGE_SELF)) # a CPU-bound task for i in range(100 码力 | 2146 页 | 10.17 MB | 9 月前3Python 标准库参考指南 3.9.20
in a thread pool. with open('/dev/urandom', 'rb') as f: return f.read(100) def cpu_bound(): # CPU-bound operations will block the event loop: # in general it is preferable to run them in a (下页继续) 854 常数之一来指定。 一个简单的示例: from resource import * import time # a non CPU-bound task time.sleep(3) print(getrusage(RUSAGE_SELF)) # a CPU-bound task for i in range(10 ** 8): _ = 1 + 1 print(getrusage(RUSAGE_SELF))0 码力 | 2015 页 | 10.12 MB | 9 月前3Python 标准库参考指南 3.11.10
in a thread pool. with open('/dev/urandom', 'rb') as f: return f.read(100) def cpu_bound(): # CPU-bound operations will block the event loop: # in general it is preferable to run them in a # process pool 常量之一来指定。 一个简单的示例: from resource import * import time # a non CPU-bound task time.sleep(3) print(getrusage(RUSAGE_SELF)) # a CPU-bound task for i in range(10 ** 8): _ = 1 + 1 print(getrusage(RUSAGE_SELF))0 码力 | 2248 页 | 11.10 MB | 9 月前3Python 标准库参考指南 3.11.10
in a thread pool. with open('/dev/urandom', 'rb') as f: return f.read(100) def cpu_bound(): # CPU-bound operations will block the event loop: # in general it is preferable to run them in a # process pool 常量之一来指定。 一个简单的示例: from resource import * import time # a non CPU-bound task time.sleep(3) print(getrusage(RUSAGE_SELF)) # a CPU-bound task for i in range(10 ** 8): _ = 1 + 1 print(getrusage(RUSAGE_SELF))0 码力 | 2399 页 | 11.19 MB | 9 月前3
共 12 条
- 1
- 2