子线程资源共享
from threading import Thread
import time ,os
x = 100
def task():
global x
x = 50
print(os.getpid())#20456
if __name__ == '__main__':
t = Thread(target = task)
t.start()
time.sleep(2)
print(x) # 50
print(os.getpid()) #20456