æè¿Rubyã§ã¯ãã¼ã©ãæ¸ããã ãªããªãæ°åãã®å
¥ã£ãåããã¿ããä¸æ©ã§3Gãã¤ããã®ãã¼ã¿ããã¦ã³ãã¼ããã¦ããã ã¾ããããã«æ¯ä¾ãã¦å¦çãé
ããªãçºãThreadã使ããã¨ã«ããã Rubyã§ã®Threadã¯ã°ãªã¼ã³ã¹ã¬ãããã¤ã¾ã1ã¤ã®ã«ã¼ãã«ã¹ã¬ããã«å¯¾ãã¦è¤æ°ã®ã¦ã¼ã¶ã¼ã¹ã¬ãããåä½ãã¦ããçºã並è¡çã«ã¯åä½ã§ãããã並åã«ã¯åããªããã¤ã¾ãéããªããªãã ãããã¯ãã¼ã©ã®ããã«ããã«ããã¯ããããã¯ã¼ã¯ã¨ãã£ã¹ã¯IOã®å ´åãå¾
ã¡æéã«ä»ã®å¦çãã§ããã®ã§ããããæç¨ã§ãã åé¡ã¨ãã¦Rubyã®Threadã¯ã¨ã«ããé
ããã³ã¹ããé«ãããã¹ã¤ããã³ã°é
ããã æ¬æ¥ã¯ (1..10000).map { |e| Thread.start { e**2 } }.map{ |th| th.value } ã¿ããã«Threadã使ãæ¨ã¦ã«ãããã楽ã ãã ã§ããªã½ã¼ã¹ããã£ãããªãéã
{{#tags}}- {{label}}
{{/tags}}