1. # -*- coding:utf-8 -*-
    2. # @auth ivan
    3. # @time 20190110
    4. # @goal test the multiprocessing run
    5. import os
    6. import time
    7. import multiprocessing
    8. def worker(sign):
    9. print(sign, 'pid:', os.getpid())
    10. time.sleep(1)
    11. print(1)
    12. print('Main:', os.getpid())
    13. plist = []
    14. for j in range(5):
    15. p = multiprocessing.Process(target=worker, args=('process', ))
    16. p.start()
    17. plist.append(p)
    18. p.join()
    19. """
    20. Main: 99228
    21. process pid: 99229
    22. process pid: 99230
    23. process pid: 99231
    24. process pid: 99232
    25. process pid: 99233
    26. 1
    27. 1
    28. 1
    29. 1
    30. 1
    31. """