# thread.py
import os
print(os.getpid())
def dead_loop():
while True:
pass
dead_loop()
保存为 thread.py
$ python3 thread.py
2617
$ cat /proc/2617/status
Name: python3
Umask: 0022
State: R (running)
Tgid: 2617
Ngid: 0
Pid: 2617
PPid: 2274
TracerPid: 0
Uid: 1000 1000 1000 1000
Gid: 1000 1000 1000 1000
FDSize: 256
Groups: 24 25 29 30 44 46 108 114 115 119 136 1000
NStgid: 2617
NSpid: 2617
NSpgid: 2617
NSsid: 2274
Threads: 1
Threads: 1
表示有一个线程,请问,这个线程的线程号是多少?