ã¯ããã«
ãååã¯ãããã°ã©ã ã®å å¤é¨ããçºè¡ãããã·ã°ãã«ã¤ãã³ããè£è¶³ããéç¥ããããã®ã·ã°ãã«ç¨ãã£ã¹ã¯ãªãã¿ãsignalfdãã«ã¤ãã¦è§£èª¬ãã¾ãããä»åã¯ãè¤æ°ã®ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ãä¸å 管çãããå¤éI/Oãæ©è½ã«ã¤ãã¦è§£èª¬ãã¦ãã¾ãã
é£è¼æ¦è¦
- 第1åï¼ãã£ã¹ã¯ãªãã¿ã®æ¦è¦
- 第2åï¼ã¤ãã³ãç¨ãã£ã¹ã¯ãªãã¿ãeventfdãã®ç¹å¾´
- 第3åï¼ã¿ã¤ãã¼ç¨ãã£ã¹ã¯ãªãã¿ãtimerfdãã®ç¹å¾´
- 第4åï¼ã·ã°ãã«ç¨ãã£ã¹ã¯ãªãã¿ãsignalfdãã®ç¹å¾´
- 第5åï¼å¤éI/OãMultiplex I/Oãã®ç¨®é¡ã®ç¹å¾´ã使ãæ¹
- 第6åï¼å¤éI/Oã®æ§è½ã¨C10Kåé¡
- 第7åï¼ã·ã°ãã«é§åI/Oã®ç¹å¾´ã使ãæ¹
- 第8åï¼éåæI/OãAsynchronous I/Oãã®ä½¿ãæ¹ã¨æ§è½å·®
- 第9åï¼ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ããã·ã³ã°ã®ç¹å¾´ã使ãæ¹
ããµã³ãã«ããã°ã©ã ã¯100è¡åå¾ç¨åº¦ã¾ã§ã¯ç»é¢ã«è¨è¼ãã¾ããå
¨ããã°ã©ã ã¯å§ç¸®ãã¦ãã¼ã¸ä¸é¨ãããã¦ã³ãã¼ãå¯è½ã«ãã¦ãã¾ããmake
ã³ãã³ãã§ã³ã³ãã¤ã«ã§ãã¾ããi386/x86_64ç°å¢ã§åä½ç¢ºèªæ¸ã¿ã§ãã
ãããã°ã©ã ã®ããªã¥ã¼ã ä¸ãã¨ã©ã¼å¦çãå¼æ°ãã§ãã¯ãªã©ãçãã¦ããã®ã§ãããããããäºè§£ãã ãããã¾ã使ç¨æ³ã誤ãã¨ã·ã¹ãã ã«é大ãªå½±é¿ãä¸ããå¯è½æ§ãããã¾ããå©ç¨ããå ´åã¯è²¬ä»»ã®ã¨ããç°å¢ã«ããã¦å®è¡ããããããé¡ããã¾ãã
ãå½ãããã¯ã§ã¯ãå®éã«ããã°ã©ã ãéãã¦åä½ç¢ºèªãæ§è½æ¸¬å®ãè¡ããã¨ã§ãå人çãªè¦è§£ãè¿°ã¹ããã¦ããã ãã¾ããããã¾ã§å人çãªææ³ã«åºã¥ãã¦ããã®ã§ãåè«ãææãªã©ãããã¨æãã¾ããææã質åãªã©ã¯å¤§æè¿ãªã®ã§ããã®éã¯ãã²ãé£çµ¡ãã ãããå¯è½ãªéãã®å¯¾å¿ã«åªãã¾ãã
Multiplex I/Oï¼å¤éI/Oï¼ã®ç´¹ä»
ããã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ã«å¯¾ãã¦write(2)
ãå®è¡ãããã¨ãã«ã¼ãã«ã«ãã£ã¦ãã®ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ã¯readyç¶æ
ã«ãªãã¾ãããã®ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ãread(2)
ãã¦ããå´ã¨ãã¦ã¯ãreadyç¶æ
ã«ãªã£ããã¨ãæ¤ç¥ãããã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ãéãã¦æ
å ±ãåå¾ã§ãã¾ãã
ããããããã¤readyç¶æ
ã«ãªããåãããªãç¶æ
ã§read(2)
ãå®è¡ããã¨ãé常ã¯read(2)
ã§ãµã¹ãã³ãï¼Blockingï¼ãç¶ãã¾ãï¼æ³¨1ï¼ã
ãããã§ãè¯ãå ´åãããã§ãããããè¤æ°ã®ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ã管çããå ´åãä¸åã®ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ã§ãµã¹ãã³ãããã¦ã¯ä»ã®å¦çã«æ¯éããããã¾ãããã®åé¡ã®è§£æ±ºæ段ã¨ãã¦ãå¤é/IOã«ãããã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ã®ç®¡çæ¹æ³ãããã¾ãã
ãå¤éI/Oã¯è¤æ°ã®ãã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ãä¸å
çã«ç®¡çããreadyç¶æ
ã«ãªã£ããã£ã¹ã¯ãªãã¿ãç¾ããã対象ã®ãã£ã¹ã¯ãªãã¿ãç¥ãããæ©è½ã§ããåå説æããeventfd(2)/timerfd(2)/signalfd(2)
ããã¡ã¤ã«ãã£ã¹ã¯ãªãã¿ã§ãããã¨ãããå¤éI/Oã¸ã®å¯¾å¿ãå¯è½ã§ãã
ããµã¹ãã³ãç¶æ ã«ãªããªãNonBlockingè¨å®ãå¯è½ã§ãããããèªã¿åºããªãç¶æ ã«ã¯å¤ãããªãã®ã§ãçµå±ã¯èªã¿è¾¼ããã¾ã§ä½åº¦ãread(2)ãå®è¡ããªãã¦ã¯ãããªãç¶æ³ã«å¤ããããã¾ããã