라벨이 multiprocessing인 게시물 표시

파이썬[Python]: multiprocessing - Process 클래스

파이썬(Phthon): multiprocessing 모듈 - Process 클래스(class) /// 설명 구분되어진 프로세스를 제어하는 클래스입니다.(2가지 방식: 콜러블 객체를 전달, run() 메서드의 오버라이딩) 참고: 프로세스 group: 사용하지 않습니다. target: run() 메서드에 의해 시행되는 콜러블 객체입니다. name: 프로세스에 이름을 부여합니다. 기본값은 Process-N, N은 정수 args: target 에 사용되어지는 튜플입니다. kwargs: target 에 사용되어지는 딕셔너리입니다. deamon: daemonic process. (백그라운드에서 시행되는 듯...) ※ 형식 class multiprocessing.Process(group=None, target=None, name=None, args=(), kwargs={}, *, daemon=None) reference https://docs.python.org/3/library/multiprocessing.html#module-multiprocessing /// 예제 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 import  multiprocessing import  datetime import  time     def  test_multiprocessing(i):      print (f '   ---> {__name__}: test_multiprocessing {i} is started!' )     time.sleep(i)      print (f '   {i}: test_multiprocessing - sleep({i}) ---' )      print (f '   ---> Time: {datetime.datetime.now().ti