Pythonãªãçãæ¸ãããã¹ãªããã½ããã¯ãã¿ã¨ãã¦é¢ç½ããå®ç¨æ§ã¯çç¡ã ã ãã©ãmultiprocessingã¯ã¬ãã§å®ç¨çãªã¢ã¸ã¥ã¼ã«ã(Python2.6以éã®æ¨æºã©ã¤ãã©ãª) #!/usr/bin/env python from time import sleep from multiprocessing import Pool from random import randint num = 20 def sleep_sort(n): sleep(n) print(n) Pool(num).map( sleep_sort, [randint(1, num) for i in xrange(num)] ) Pool#mapã®è¿ãå¤ã¯ããããã®å®è¡çµæã®ãªã¹ããªãã ãã©ãsleep sortã§ã¯å½¹ã«ç«ããªãã®ã§å²æ 常èãè¦ãã½ã¼ãã¢ã«ã´ãªãºã ï¼ãã®åã"sleep sort"ï¼
{{#tags}}- {{label}}
{{/tags}}