ããã¯ããªãŒã³ã³ããã®å¯¿åœã®åã®æçš¿ããå€ãã®æéãçµéããŸããã ãã¥ãŒã®è«æã®ç¶ããããã«æžãããšãæåŸ ããŠããŸããããåé¡ããããŸãããäœãæžãã¹ããã¯ç¥ã£ãŠããŸããããC ++ã§ã¯ãããã®ã¢ãããŒãããããŸããã§ããã ãèªåã§è©Šããªãã£ããšæžãã®ã¯è¯ããããŸããããšæãããã®çµæã libcdsã«æ°ãããã¥ãŒã¢ã«ãŽãªãºã ãå®è£ ããããšããŸãã ã
ä»ãè°è«ã®ãµã€ã¯ã«ãç¶ããããšãã§ããæãæ¥ãŸããã ãã®èšäºã¯ãã¥ãŒã§çµãããŸãã
äžæããå Žæãç°¡åã«æãåºããŠãã ããã ããã¯ããªãŒãã¥ãŒã®ããã€ãã®èå³æ·±ãã¢ã«ãŽãªãºã ãæ€èšãããã«ãŒãã³ã¯ããã€ãã®åæãã¹ãã§ã®äœæ¥ã®çµæã瀺ããŠããŸãã äž»ãªçµè«ã¯ããã¹ãŠãæªããšããããšã§ãïŒ ããžãã¯ã³ã³ãã¢ã¢ã³ãã¹ã¯ããïŒCASïŒã®ããã¯ããªãŒã¢ãããŒããç·åœ¢ã§ã¯ãªãã«ããŠããå°ãªããšãã¹ã¬ããæ°ã®å¢å ã«äŒŽãããã©ãŒãã³ã¹ã®åäžãåŸããããšããæåŸ ã¯å®çŸããŸããã§ããã ãã¥ãŒã¯ã¹ã±ãŒãªã³ã°ããŸããã çç±ã¯äœã§ããïŒ..
ãã®è³ªåã«å¯Ÿããçãã¯ãææ°ã®ããã»ããµã®ã¢ãŒããã¯ãã£ã«ãããŸãã CASããªããã£ãã¯ããªãéãåœä»€ã§ããããã£ãã·ã¥ãšå éšåæãããã³ã«ã倧éã«ããŒãããŸãã åããã£ãã·ã¥ã©ã€ã³äžã§CASãç©æ¥µçã«äœ¿çšããããšã§ãããã»ããµã¯äž»ã«ãã£ãã·ã¥ã®äžè²«æ§ãç¶æããããšã«å°å¿µ
ã¹ã¿ãã¯ãšãã¥ãŒã¯ããšã³ããªãã€ã³ãã®æ°ãå°ãªããããããŒã¿æ§é ã®ããã¯ããªãŒã¢ãããŒãã«ã¯éåžžã«äžåãã§ãã ã¹ã¿ãã¯ã®å Žåããã®ãããªãã€ã³ãã¯1ã€ã ãã§ã-ã¹ã¿ãã¯ã®æäžéšããã¥ãŒã®å ŽåãããããšããŒã«ã®2ã€ããããŸãã CASã¯ãããã®ãã€ã³ããžã®ã¢ã¯ã»ã¹ãæ±ããŠç«¶åããŸãããããã»ããµã®äœ¿çšçã100ïŒ ã«ãªããšããã©ãŒãã³ã¹ãäœäžããŸãã äœã«ã䌌ãŠããŸãããïŒ..ããã¯å€å žçãªã¹ãã³ããã¯ã§ãïŒ CASã®ããã¯ããªãŒã¢ãããŒãã§ã¯ããã¥ãŒããã¯ã¹ã«ããå€éšåæããªããªããŸããããããã»ããµåœä»€ã¬ãã«ã§å éšåæãåŸãããã»ãšãã©åã¡ãŸããã§ããã
å¶éããããã¥ãŒ
äžèšã®ãã¹ãŠãç¡å¶éïŒç¡å¶éïŒMPMCïŒè€æ°ã®ãããã¥ãŒãµãŒ/è€æ°ã®ã³ã³ã·ã¥ãŒããŒïŒãã¥ãŒã«é©çšãããããšã«æ³šæããŠãã ããã ååãšããŠãé
åã«åºã¥ããŠæ§ç¯ãããèŠçŽ ã®æ°ã®ç¹ã§å¶éãããŠããïŒå¶éãããŠããïŒãã¥ãŒã§ã¯ããã®åé¡ã¯ãé
åå
šäœã®ãã¥ãŒèŠçŽ ã®æ£ç¢ºãªåæ£ïŒåæ£ïŒã®ããã«ããã»ã©é¡èã§ã¯ãªãå ŽåããããŸãã ãŸãã1ã€ã®ã©ã€ã¿ãŒããã³/ãŸãã¯1ã€ã®ãªãŒããŒãåãããã¥ãŒã«å¯ŸããŠãããé«éãªã¢ã«ãŽãªãºã ãæ§ç¯ã§ããŸãã
競äºåã®ãããã¥ãŒã®å¹æçãªå®è£ ã®åé¡ã¯ãç 究è ã«ãšã£ãŠäŸç¶ãšããŠé¢å¿ã®ãããã®ã§ãã è¿å¹Žããé¡ã«ãããã¯ããªãŒãã¥ãŒãå®è£ ããéã®ããŸããŸãªããªãã¯ãæåŸ ãããçµæããããããªããšããç解ãé«ãŸã£ãŠãããä»ã®ã¢ãããŒããæ€èšããå¿ èŠããããŸãã ããã«ããããã®ããã€ããæ€èšããŸãã
ãã©ããçµå
ã¹ã¿ãã¯ã«é¢ããèšäºã§ãã®æ¹æ³ã説æããŸãããããã©ããçµåã¯æ®éçãªæ¹æ³ã§ããããããã¥ãŒã«é©çšã§ããŸãã ãã·ã¢ã®C ++ User Groupã§ã® ãã¬ãŒã³ããŒã·ã§ã³ã®ãããªã«èªè ãéããŸãããã®ãããªã¯ããã©ããçµåã®å®è£ å°çšã§ãã
åºåãšããŠ
ãã®æ©äŒã«ããã·ã¢ã®C ++ãŠãŒã¶ãŒã°ã«ãŒãã®ã€ã³ã¹ãã€ã¢ã§ããäž»å¬è
ã§ããsermpã«ãµããŒãã¬ã€ãéä¿¡ããŸãã ã»ã«ã²ã€ããã®åéã§ã®ããªãã®ç¡ç§ã®ä»äºã¯è²Žéã§ãïŒ
ç§ã¯èªè ã«ãã®ã€ãã³ãã«æ³šæãæãããã®å€èŠ³ããããŠèª°ããã¬ãŒã³ããŒã·ã§ã³ã§äœããå ±æã§ãããã§ããããµããŒãããããšããå§ãããŸãã ç§èªèº«ã®çµéšãããã©ã€ãã³ãã¥ãã±ãŒã·ã§ã³ã¯ãããŒãèªãããããã£ãšã¯ãŒã«ã ãšç¢ºä¿¡ããŸããã
ãŸãã2015幎2æ27ã28æ¥ã«ã¢ã¹ã¯ã¯ã§éå¬ãããC ++ãã·ã¢äŒè°ã«ã泚ç®ããŠãã ããã
ç§ã¯èªè ã«ãã®ã€ãã³ãã«æ³šæãæãããã®å€èŠ³ããããŠèª°ããã¬ãŒã³ããŒã·ã§ã³ã§äœããå ±æã§ãããã§ããããµããŒãããããšããå§ãããŸãã ç§èªèº«ã®çµéšãããã©ã€ãã³ãã¥ãã±ãŒã·ã§ã³ã¯ãããŒãèªãããããã£ãšã¯ãŒã«ã ãšç¢ºä¿¡ããŸããã
ãŸãã2015幎2æ27ã28æ¥ã«ã¢ã¹ã¯ã¯ã§éå¬ãããC ++ãã·ã¢äŒè°ã«ã泚ç®ããŠãã ããã
ãã¥ãŒã®é å
è¡šé¢ã«ããããå€ãã®èœãšãç©Žãããã«ããããããå®è£ ãããªãé£ããã¢ãããŒãã2013幎ã«ãã¹ã±ãŒã©ãã«ãªããã¯ããªãŒãã¥ãŒãå®è£ ããããã®ç«¶åãååã«çœ®ãæããããšããã¿ã€ãã«ã®èšäºã§ææ¡ãããŸããã ã
ã¢ã€ãã¢ã¯ãšãŠãã·ã³ãã«ã§ãã åäžã®ãã¥ãŒã®ä»£ããã«ããµã€ãºKã®é åãäœæããããã®åèŠçŽ ã¯ããã¯ããªãŒãã¥ãŒã§ãããåçŽã«æ¥ç¶ããããªã¹ãã§è¡šãããŸãã é åã®æ¬¡ã®ïŒã¢ãžã¥ãKïŒã¹ãããã«æ°ããèŠçŽ ãè¿œå ãããŸãã ãããã£ãŠããã¥ãŒã®ããŒã«ã§ã®æ··éã¯å¹³æºåãããŸããããŒã«ã1ã€ã§ã¯ãªããããŒã«ãKåãããããKåã®äžŠåãããŒãŸã§ç·åœ¢ã®ã¹ã±ãŒã©ããªãã£ãåŸãããããšãæåŸ ã§ããŸãã ãã¡ãããé åã¹ããããžã®åæ¿å ¥ãå€éåããã«ã¯ãç¹å®ã®äžè¬çãªã¢ãããã¯å調å¢å ããã·ã¥æäœã«ãŠã³ã¿ãŒãå¿ èŠã§ãã åœç¶ããã®ã«ãŠã³ã¿ãŒã¯ããã¹ãŠã®ããã·ã¥ã¹ããªãŒã ã®åäžã®ãã¹ãã£ããã³ã°ãã€ã³ããã«ãªããŸãã ããããèè ã¯ãx86ã¢ãŒããã¯ãã£
xadd
ã¢ãããã¯å ç®ïŒãã®å Žåã¯ã€ã³ã¯ãªã¡ã³ãïŒã®
xadd
åœä»€ã¯CASããããããã«é«éã§ãããšäž»åŒµããŠããŸãïŒç§ã®èŠ³å¯ã«ããã°ãããã¯äžåçã§ã¯ãããŸããïŒã ãããã£ãŠãx86ã§ã¯åã€ããšãæåŸ ã§ããŸãã ä»ã®ã¢ãŒããã¯ãã£ã§ã¯ãatomic
fetch_add
CASã«ãã£ãŠãšãã¥ã¬ãŒãããããããã²ã€ã³ã¯ããã»ã©é¡èã§ã¯ãããŸããã
ãã¥ãŒããèŠçŽ ãåé€ããããã®ã³ãŒãã¯äŒŒãŠããŸããåé€ãããèŠçŽ ã®ã¢ãããã¯ã«ãŠã³ã¿ãŒïŒãããã«ãŠã³ã¿ãŒïŒããããããã«åºã¥ããŠKãæ³ãšããŠé åã¹ããããéžæãããŸãã ãã¥ãŒã®ã¡ã€ã³ããããã£ã®éåãæé€ããããã«-FIFO-åèŠçŽ ã«ã¯è¿œå ã®è² è·ïŒ
ticket
ïŒ-èŠçŽ ãè¿œå ãããšãã®ããã·ã¥ã«ãŠã³ã¿ãŒã®å€ãå®éã«ã¯èŠçŽ ã®ã·ãªã¢ã«çªå·ãå«ãŸããŸãã ã¹ãããã§åé€ããå Žåã
ticket
=ãæã€èŠçŽ ããããã«ãŠã³ã¿ãŒã®çŸåšã®å€ãæ€çŽ¢ããŸããèŠã€ãã£ãèŠçŽ ã¯
pop()
æäœã®çµæã§ãã
空ã®ãã¥ãŒããåé€ããåé¡ã解決ããèå³æ·±ãæ¹æ³ã ãã®ã¢ã«ãŽãªãºã ã§ã¯ãåé€ã«ãŠã³ã¿ãŒïŒãããã«ãŠã³ã¿ãŒïŒã®ã¢ãããã¯ã€ã³ã¯ãªã¡ã³ãã®åŸã«ã察å¿ããã¹ãããã§ã®æ€çŽ¢ãæåã«ç¶ããŸãã ã¹ãããã空ã§ããå¯èœæ§ããããŸãã ããã¯ããã¥ãŒå šäœã空ã§ããããšãæå³ããŸãã ãã ãããããã«ãŠã³ã¿ã¯æ¢ã«ã€ã³ã¯ãªã¡ã³ããããŠããããã以äžäœ¿çšãããšFIFOã«éåããèŠçŽ ã倱ãããããšãããããŸãã ããŒã«ããã¯ïŒãã¯ãªã¡ã³ãïŒããããšã¯ã§ããŸãããçªç¶ãä»ã®ã¹ã¬ãããèŠçŽ ãè¿œå ãŸãã¯åé€ããŸãïŒäžè¬çã«ããback-play-not-impossibleãã¯ããã¯ããªãŒã¢ãããŒãã®äžå¯æ¬ ãªç¹æ§ã§ãïŒã ãããã£ãŠã空ã®ãã¥ãŒãã
pop()
ç¶æ³ãçºçãããšãé åã¯ç¡å¹ã§ãããšå®£èšããã次ã«èŠçŽ ãæ¿å ¥ããããšãã«ãæ°ããããã·ã¥ã«ãŠã³ã¿ãŒãšãããã«ãŠã³ã¿ãŒãæã€æ°ããé åãäœæãããŸãã
æ®å¿µãªãããèè ã¯ã¡ã¢ãªã解æŸãããšããåé¡ãïŒã¹ããŒã¹ã®äžè¶³ã®ããã«ïŒæ°ã«ããŸããã§ãããã¢ã«ãŽãªãºã ãžã®ãã¶ãŒããã€ã³ã¿ãŒã¹ããŒã ã®é©çšã®è¡šé¢çãªèª¬æãå«ãããã€ãã®ææ¡ãäžããŸããã ãã³ãã
libcds
ã©ã€ãã©ãªã«ã¯ãã®èå³æ·±ãã¢ã«ãŽãªãºã ã®å®è£ ã¯ãããŸããã ããã«ããã¥ãŒã空ã«ãªããªãå Žåãã€ãŸãé åãç¡å¹ã«ãããªãå Žåãã¢ã«ãŽãªãºã ã¯é åã¹ããããªã¹ãããèŠçŽ ãåé€ããããšãæå³ããŠããªããããåé€ãããèŠçŽ ã®ç¡å¶éã®èç©ã®å¯Ÿè±¡ãšãªããŸãã
pop()
ã¯ã察å¿ããã¹ãããã§çŸåšã®
ticket
ãæã€èŠçŽ ãæ€çŽ¢ããã ãã§ãããé åå šäœãç¡å¹åããããŸã§ããªã¹ãããã®èŠçŽ ã®ç©ççãªé€å€ã¯çºçããŸããã
èŠçŽãããšãç§ãã¡ã¯èšãããšãã§ããŸãïŒã¢ã«ãŽãªãºã ã¯èå³æ·±ãã§ãããã¡ã¢ãªç®¡çã¯ååã«æ確ã«èª¬æãããŠããŸããã ãããªãç 究ãå¿ èŠã§ãã
ã»ã°ã¡ã³ãåããããã¥ãŒ
ãã¥ãŒã®ã¹ã±ãŒã©ããªãã£ãåäžãããå¥ã®æ¹æ³ã¯ããã©ã€ããªã®å å ¥ãå åºãããããã£ïŒFIFOïŒã«éåããããšã§ãã ããã¯æ¬åœã«æãã§ããïŒããã¯ã¿ã¹ã¯ã«äŸåããŸãïŒãã人ã«ãšã£ãŠã¯ãFIFOã®å³æ Œãªé å®ãå¿ é ã§ãããä»ã®äººã«ãšã£ãŠã¯-ç¹å®ã®å¶éå ã§ã¯å®å šã«åãå ¥ããããŸãã
ãã¡ãããã¡ã€ã³ã®FIFOããããã£ã«æ ¹æ¬çã«éåãããã¯ãããŸããããã®å ŽåãããŒã«ãšåŒã°ããããŒã¿æ§é ãååŸããŸãããã®æ§é ã§ã¯ãé åºã¯ãŸã£ãã芳å¯ãããŸãã
pop()
ãªãã¬ãŒã·ã§ã³ã¯èŠçŽ ãè¿ããŸãã ããã¯ãã¯ãã¿ãŒã³ã§ã¯ãããŸããã FIFOéåã®ãããã¥ãŒã®å Žåããã®éåãããã€ãä¿èšŒããããšæããŸããããšãã°ã
pop()
æäœã¯æåã®KèŠçŽ ã®1ã€ãè¿ããŸãã K = 2ã®å Žåãããã¯ãèŠçŽ AãBãCãDã...ãæã€ãã¥ãŒã®å Žåã
pop()
AãŸãã¯B
pop()
è¿ãããšãæå³ããŸãããã®ãããªãã¥ãŒã¯ãKãã¡ã¯ã¿ãŒ-FIFOéåå¶éã®å€ã匷調ããããã«ã»ã°ã¡ã³ãåãŸãã¯K ã»ã°ã¡ã³ãåãšåŒã°ããŸãã æããã«ãå³å¯ãªïŒå ¬æ£ãªïŒFIFOãã¥ãŒã®å ŽåãK = 1ã§ãã
ç§ãç¥ãéããåããŠãæãåçŽãªã»ã°ã¡ã³ãåããããã¥ãŒããããã¯ããªãŒã®ããŒã¿æ§é ã«èª²ããããèŠä»¶ã®èš±å®¹ã§ããç·©åã«å°å¿µããäœæ¥ã§2010幎ã«è©³çŽ°ã«æ€èšãããŸããã ãã¥ãŒã®å éšæ§é ã¯éåžžã«åçŽã§ãïŒäžèšã®èšäºã®å³ãK = 5ïŒïŒ
ãã¥ãŒã¯åçŽã«æ¥ç¶ãããã»ã°ã¡ã³ãã®ãªã¹ãã§ãããåã»ã°ã¡ã³ãã¯ãµã€ãºãKåã®èŠçŽ ã®é åã§ãã
Head
ãš
Tail
ã¯ããããããªã¹ãã®æåãšæåŸã®ã»ã°ã¡ã³ãã瀺ããŸãã
push()
æäœã¯ãããŒã«ã»ã°ã¡ã³ãã®ä»»æã®ç©ºãã¹ãããã«æ°ããèŠçŽ ãæ¿å ¥ãã
pop()
æäœã¯ããããã»ã°ã¡ã³ãã®ä»»æã®å æã¹ãããããèŠçŽ ãæœåºããŸãã ãã®ã¢ãããŒãã§ã¯ãKã»ã°ã¡ã³ãã®ãµã€ãºãå°ããã»ã©ãFIFOããããã£ã®éåãå°ãªããªãããšã¯æããã§ãã K = 1ã®å Žåãå³å¯ãã¥ãŒãååŸããŸãã ãããã£ãŠãKãå€ããããšã«ãããFIFOã®éåã®çšåºŠãå¶åŸ¡ã§ããŸãã
説æããã¢ã«ãŽãªãºã ã§ã¯ãã»ã°ã¡ã³ãã®åã¹ãããã¯ã空ããããžãŒïŒèŠçŽ ãå«ãïŒãããã³ãã¬ããŒãžãïŒèŠçŽ ãã¹ãããããèªã¿åãããïŒã®3ã€ã®ç¶æ ã®ããããã«ãªããŸãã
pop()
æäœã¯ã¹ããããããŽãç®±ãç¶æ ã«ããŸããããã¯ã空ããç¶æ ãšã¯ç°ãªããŸããããŽãç®±ãç¶æ ã¯ã¹ãããã®æçµç¶æ ã§ããããã®ãããªã¹ããããžã®å€ã®æžã蟌ã¿ã¯èš±å¯ãããŸããã ããã¯ã¢ã«ãŽãªãºã ã®æ¬ ç¹ã§ãããã¬ããŒãžãç¶æ ã®ã¹ãããã¯åå©çšã§ããã亀äºã®
push() / pop()
ãªã©ã®å žåçãªæäœã·ãŒã±ã³ã¹ã§ãæ°ããã»ã°ã¡ã³ãã®é åžã«ã€ãªãããŸãã ãã®æ¬ é¥ã¯å¥ã®äœæ¥ã§ä¿®æ£ãããŸããããã³ãŒãã¯ããªãè€éã«ãªããŸããã
æ¢æ€
ãã®ãããlibcdã«ã¯ããã¥ãŒçšã®2ã€ã®æ°ããã¢ã«ãŽãªãºã FCQueueãšSegmentedQueueã®å®è£ ããããŸãã 圌ãã®ããã©ãŒãã³ã¹ãèŠãŠããããã«å¯ŸåŠãã䟡å€ããããã©ãããç解ããŠã¿ãŸãããã
æ®å¿µãªãããåã®èšäºã®ãã¹ããå®è¡ãããµãŒããŒã«ä»ã®ã¿ã¹ã¯ãèªã¿èŸŒãŸãããã®åŸã¯ã©ãã·ã¥ããŸããã ããŸã匷åã§ã¯ãªãå¥ã®ãµãŒããŒã§ãã¹ããå®è¡ããå¿ èŠããããŸãã-Linuxãå®è¡ãã64Gã®ã¡ã¢ãªãæèŒãã2 x 12ã³ã¢AMD Opteron 1.5GHzïŒã»ãšãã©ç¡æïŒ-95ïŒ ã§ã¢ã€ãã«ç¶æ ã
çµæã®èŠèŠåãå€æŽããŸãã-Y軞ã«æ²¿ã£ããã¹ãå®è¡æéã®ä»£ããã«ã1ç§ãããã®ã¡ã¬æäœã®æ°ïŒMop / sïŒã延æããŸããã ãã®ãã¹ãã¯å€å žçãªãããã¥ãŒãµãŒ/ã³ã³ã·ã¥ãŒããŒã§ãããšããããšãæãåºãããŠãã ããïŒ2,000äžåã®æäœ-ãã€ããŒããšãã¥ã¬ãŒã·ã§ã³ãªãã®10Mããã·ã¥ãš10Mããããã€ãŸãæããªãã¥ãŒã€ã³ã°ã ãã¹ãŠã®ããã¯ããªãŒãã¥ãŒãã¹ãã¯ããã¶ãŒããã€ã³ã¿ãŒã䜿çšããŠã¡ã¢ãªãå®å šã«è§£æŸããŸãã
æ°ãããªãŠã ã®å€ãããŒã¿
æ°ãããªãŠã ã®åã®èšäºããã®ãã£ãŒã-MOp / sããã®ããã«èŠããŸã
ãŸããäœè«ïŒç§ãã¡ã¯äœã®ããã«åªåããŠããŸããïŒ ã¹ã±ãŒã©ããªãã£ã«ã€ããŠäœãåŸããã§ããïŒ
éãç©ççã«éåžžã«å€ãã®ã¹ã¬ããããµããŒãããŠããå Žåãçæ³çãªã¹ã±ãŒãªã³ã°ã¯ã¹ã¬ããæ°ã®å¢å ã«äŒŽãMop / sã®ç·åœ¢å¢å ã§ãã æ¬åœã«è¯ãçµæã¯ãMop / sãããããå¢å ãã察æ°ã®ããã«ãªããŸãã ã¹ã¬ããæ°ã®å¢å ã«äŒŽã£ãŠããã©ãŒãã³ã¹ãäœäžããå Žåãã¢ã«ãŽãªãºã ã¯ã¹ã±ãŒã©ãã«ã§ã¯ãªããããŸãã¯ããã€ãã®å¶éã«å¯ŸããŠã¹ã±ãŒã©ãã«ã§ãã
äŸµå ¥åãã¥ãŒã®çµæïŒäŸµå ¥åã³ã³ãããŒã¯ãSTLã®ããã«ãããŒã¿ã®ã³ããŒã§ã¯ãªããããŒã¿èªäœãžã®ãã€ã³ã¿ãŒãå«ããšããäºå®ã«ãã£ãŠç¹åŸŽä»ããããŸãããããã£ãŠãããã¯ããªãŒã®äžçã§ã¯ãããŒãæªããšèããããŠããèŠçŽ ã®ã³ããŒã«ã¡ã¢ãªãå²ãåœãŠãå¿ èŠã¯ãããŸããïŒã
Flat Combiningã¯ç¡é§ã«å®è£ ãããŠããªãããšãããããŸãããã®ææ³ã¯ãä»ã®ã¢ã«ãŽãªãºã ã«å¯ŸããŠéåžžã«è¯ãçµæã瀺ããŠããŸãã ã¯ããããã¯çç£æ§ãåäžãããŸããããé倧ãªæ²äžããããŸããã ããã«ãéèŠãªããŒãã¹ã¯ãå®éã«ããã»ããµãããŒãããªãããšã§ããåžžã«1ã€ã®ã³ã¢ã®ã¿ãåäœããŸãã ä»ã®ã¢ã«ãŽãªãºã ã¯ãå€æ°ã®ã¹ã¬ããã§100ïŒ ã®CPU䜿çšçã瀺ããŸãã
ã»ã°ã¡ã³ãåããããã¥ãŒã¯éšå€è ã§ããããšãããããŸãã ãããããããã¯å®è£ ã¢ã«ãŽãªãºã ã®ä»æ§ã«ãããã®ã§ãïŒã»ã°ã¡ã³ãã®ã¡ã¢ãªå²ãåœãŠïŒãã®ãã¹ãã§ã¯ãã»ã°ã¡ã³ããµã€ãºã¯16ïŒãæ°žç¶çãªå²ãåœãŠã«ã€ãªããã»ã°ã¡ã³ãã¹ããããåå©çšã§ããªããboost :: intrusive :: slist on lockã«åºã¥ãã»ã°ã¡ã³ãã®ãªã¹ãã®å®è£ ïŒ2çš®é¡ã®ããã¯-ã¹ãã³ããã¯ãšstd :: mutexãè©ŠããŸãããçµæã¯å®è³ªçã«åãã§ãïŒã
ç§ã¯ãäž»ãªãã¬ãŒããåœãã®å ±æã§ãããšããåžæãæã£ãŠããŸããã ã»ã°ã¡ã³ãåããããã¥ãŒã®å®è£ ã§ã¯ãã»ã°ã¡ã³ãã¯èŠçŽ ãžã®ãã€ã³ã¿ã®é åã§ããã ã»ã°ã¡ã³ããµã€ãºã16ã®å Žåãã»ã°ã¡ã³ãã¯16 * 8 = 128ãã€ããã€ãŸã2ã€ã®ãã£ãã·ã¥ã©ã€ã³ãå æããŸãã æåãšæåŸã®ã»ã°ã¡ã³ãã®ãããŒãåžžã«äžå®ã§ãããããåœå ±æã¯å®å šã«æé·ããŠããããšãããããŸãã ãã®ãããã¢ã«ãŽãªãºã ã«è¿œå ã®ãªãã·ã§ã³-å¿ èŠãªããã£ã³ã°ãå°å ¥ããŸããã ããã£ã³ã°=ãã£ãã·ã¥ã©ã€ã³ãµã€ãºïŒ64ãã€ãïŒã®å Žåãã»ã°ã¡ã³ããµã€ãºã¯16 * 64 = 1024ãã€ãã«å¢å ããŸããããã®æ¹æ³ã§èª€ã£ãå ±æãæé€ããŸãã æ®å¿µãªãããããã£ã³ã°ãSegmentedQueueã®ããã©ãŒãã³ã¹ã«å®è³ªçã«åœ±é¿ãäžããªãããšãå€æããŸããã ããããããã®çç±ã¯ãã»ã°ã¡ã³ãã»ã«æ€çŽ¢ã¢ã«ãŽãªãºã ã確ççã§ãããããããžãŒã»ã«ãèªã¿åãããšããè©Šã¿ãå€ã倱æãããã€ãŸããåã³èª€ã£ãå ±æãè¡ãããããã§ãã ãŸãã¯ãåœå ±æã¯ãã®ã¢ã«ãŽãªãºã ã®äž»ãªé害ã§ã¯ãªããçã®çç±ãæ¢ãå¿ èŠããããŸãã
æ倱ã«ãããããããèå³æ·±ã芳枬ã1ã€ãããŸããã¹ã¬ããæ°ãå¢å ããŠããSegmentedQueueã¯ããã©ãŒãã³ã¹ã®äœäžã瀺ããŸããã ããã¯ããã®ã¯ã©ã¹ã®ã¢ã«ãŽãªãºã ã«ããçš®ã®èŠç¹ããããšããåžæãäžããŸãã ããããå¥ã ã«ãããå¹ççã«å®è£ ããå¿ èŠããããŸãã
STLã®ãããªãã¥ãŒã®å ŽåãèŠçŽ ã®ã³ããŒãäœæãããšãåæ§ã®å³ã衚瀺ãããŸãã
æåŸã«ã楜ãã¿ã®ããã«ãå¶éä»ããã¥ãŒã®çµæã瀺ããŸããããã¯ãé åã«åºã¥ãDmitry Vyukovã¢ã«ãŽãªãºã ãäŸµå ¥åã®å®è£ ã§ãã
ã¹ã¬ããæ°= 2ïŒãªãŒããŒ1ã€ãšã©ã€ã¿ãŒ1ã€ïŒã®å Žåããã®ãã¥ãŒã«ã¯32 MOp / sã衚瀺ãããŸãããããã¯ãã£ãŒãã«åãŸããŸããã§ããã ã¹ã¬ããã®æ°ãå¢ãããšãããã©ãŒãã³ã¹ã®äœäžã芳å¯ãããŸãã èšãèš³ãšããŠãVyukovã®ãã¥ãŒã®å Žåãåœå ±æãéåžžã«éèŠãªæå¶èŠå ã«ãªãå¯èœæ§ããããŸããããã£ãã·ã¥ã©ã€ã³ã«æ²¿ã£ãããã£ã³ã°ãå«ããªãã·ã§ã³ã¯ãŸã libcdsã«ãããŸããã
å¥åŠãªæ奜家ã®ããã«
ãŸããIBM Power8äžã®çããLinuxãµãŒããŒã«åºããããŸãã-ãããã10ã³ã¢ã®2ã€ã®3.42 GHzããã»ããµãŒãåã³ã¢ã¯åæã«æ倧8ã€ã®åœä»€ãåæã«å®è¡ã§ããåèš160ã®è«çããã»ããµãŒã§ãã åããã¹ãã®çµæã以äžã«ç€ºããŸãã
äŸµå ¥åãã¥ãŒïŒ
STLã®ãããªãã¥ãŒïŒ
ã芧ã®ãšãããæ ¹æ¬çãªå€åã¯èŠãããŸããã ãããã1ã€ãããŸã-ã»ã°ã¡ã³ãåããããã¥ãŒã®çµæã¯K = 256ã®ã»ã°ã¡ã³ããµã€ãºã§è¡šç€ºãããŸã-ããã¯ãæå®ããããµãŒããŒã®KããŸãã«æé«ã«è¿ããã®ã§ãã
äŸµå ¥åãã¥ãŒïŒ
STLã®ãããªãã¥ãŒïŒ
ã芧ã®ãšãããæ ¹æ¬çãªå€åã¯èŠãããŸããã ãããã1ã€ãããŸã-ã»ã°ã¡ã³ãåããããã¥ãŒã®çµæã¯K = 256ã®ã»ã°ã¡ã³ããµã€ãºã§è¡šç€ºãããŸã-ããã¯ãæå®ããããµãŒããŒã®KããŸãã«æé«ã«è¿ããã®ã§ãã
çµè«ãšããŠãç§ã¯èå³æ·±ã芳å¯çµæã«æ³šç®ããããšæããŸãã äžèšã®ãã¹ãã§ã¯ããªãŒããŒãšã©ã€ã¿ãŒã®ãã€ããŒãã¯ãããŸãããç®æšã¯ããã¥ãŒãããã·ã¥ããŠããããèªã¿åãããšã§ãã å®éã®ã¿ã¹ã¯ã§ã¯ãåžžã«äœããã®çš®é¡ã®è² è·ãçºçããŸãããã¥ãŒããèªã¿åã£ãããŒã¿ã䜿çšããŠäœããè¡ãããã¥ãŒã«å ¥ããåã«ããŒã¿ãæºåããŸãã ãã€ããŒãã¯ããã©ãŒãã³ã¹ã®äœäžã«ã€ãªããããã«æãããŸãããå®éã«ã¯ãããã¯åžžã«ããã§ã¯ãªãããšã瀺ãããŠããŸãã ãã€ããŒããMOp / s
ãã®èšäºã§ã¯ããã¥ãŒã«å°å¿µããäœæ¥ã®ããäžéšã«è§ŠããåçïŒç¡å¶éïŒã®ã¿ãã€ãŸãèŠçŽ æ°ãå¶éããããšãªã觊ããŸããã å ã»ã©èšã£ãããã«ããã¥ãŒã¯ç 究è ã«ãšã£ãŠãæ°ã«å ¥ãã®ããŒã¿æ§é ã®1ã€ã§ãã ä»ã®å€ãã®äœåãæ®ã£ãŠããŸã-éãããïŒå¶éãããïŒãã¥ãŒãã¿ã¹ã¯ã¹ã±ãžã¥ãŒã©ã§äœ¿çšãããã¯ãŒã¯ã¹ãã£ãŒã«ãã¥ãŒãåäžã®ã³ã³ã·ã¥ãŒããŒãŸãã¯åäžã®ãããã¥ãŒãµãŒãã¥ãŒã«ã€ããŠ-ãã®ãããªãã¥ãŒã®ã¢ã«ãŽãªãºã ã¯1人ã®ã©ã€ã¿ãŒãŸãã¯ãªãŒããŒã«ãã£ãŠå€§å¹ ã«ç ãæŸãŸãããŠããããããã£ãŠãå€ãã®å Žåããã·ã³ãã«ã§/ãŸãã¯ã¯ããã«çç£ç-ãªã© ãªã©
microworld libcdsããã®ãã¥ãŒã¹
åã®èšäºãã©ã€ãã©ãªã®ããŒãžã§ã³1.6.0ããªãªãŒã¹ããããããFlat Combiningããã³SegmentedQueueãã¯ããã¯ã®å®è£
ã«å ããŠãå€ãã®ãšã©ãŒãä¿®æ£ãããSkipListãšEllenBinTreeã倧å¹
ã«äœãçŽãããŸããã
ä»åŸã®ããŒãžã§ã³2.0ã®ãªããžããªã¯githubã«ç§»åããããŒãžã§ã³2.0èªäœã¯C ++ 11æšæºãžã®ç§»è¡ã«å°å¿µããã³ãŒãã®çµ±åãã€ã³ã¿ãŒãã§ã€ã¹ã®çµ±åãæªåé«ãåŸæ¹äºææ§ã«éåãïŒäžéšã®ãšã³ãã£ãã£ã®ååãå€æŽãããããšãæå³ããŸãïŒãæŸèæãåé€ããŸãå€ãã³ã³ãã€ã©ã®ãµããŒãïŒããã³ãéåžžã©ãããèŠã€ãã£ããã®ã®ä¿®æ£ãšæ°ãããã°ã®çæïŒã
ä»åŸã®ããŒãžã§ã³2.0ã®ãªããžããªã¯githubã«ç§»åããããŒãžã§ã³2.0èªäœã¯C ++ 11æšæºãžã®ç§»è¡ã«å°å¿µããã³ãŒãã®çµ±åãã€ã³ã¿ãŒãã§ã€ã¹ã®çµ±åãæªåé«ãåŸæ¹äºææ§ã«éåãïŒäžéšã®ãšã³ãã£ãã£ã®ååãå€æŽãããããšãæå³ããŸãïŒãæŸèæãåé€ããŸãå€ãã³ã³ãã€ã©ã®ãµããŒãïŒããã³ãéåžžã©ãããèŠã€ãã£ããã®ã®ä¿®æ£ãšæ°ãããã°ã®çæïŒã
倧ããªã¿ã€ã ã©ã°ã«ããããããããã¥ãŒãšã¹ã¿ãã¯ã®è©±ãè«ççãªçµããã«æã£ãŠããããšãã§ããŠããããã§ãããããã¯ããã¯ããªãŒã®ã¢ãããŒããææ°ã®ããã»ããµã®ããŒã¿æ§é ã«ãšã£ãŠæãå奜çã§ã¯ãªããç§ã«ãšã£ãŠããŸãèå³æ·±ããã®ã§ã¯ãªãããã§ãã
ç§ãã¡ã®åã«ã¯ãã£ãšãšããµã€ãã£ã³ã°ãªæ§é ããããŸã-é£æ³ã³ã³ããïŒã»ãã/ãããïŒãç¹ã«çŸããããããæã€ããã·ã¥ãããããããŠã¹ã±ãŒã©ããªãã£ã®ç¹ã§ãã£ãšæè¬ããŠããŸãã
ç¶ããç¶ããšæããŸã...
ããã¯ããªãŒã®ããŒã¿æ§é
éå§ãã
åºæ¬ïŒ
äžïŒ
å€ããïŒ
åºæ¬ïŒ
- ååæ§ããã³ååããªããã£ã
- èšæ¶ã®å£ã¯ã©ãããæ¥ãã®ã§ããïŒ
- ã¡ã¢ãªã¢ãã«
äžïŒ
- ã¡ã¢ãªç®¡çã¹ããŒã
- RCU
- ã¹ã¿ãã¯ã®é²å
- å¥ã®è«æ
- ãã¥ãŒåæ
- 䞊è¡ãããïŒãŠã©ãŒã ã¢ãã
- 䞊è¡ãããïŒåããã·ã¥ãåæ§ç¯ãªã
- 䞊è¡ãããïŒãªã¹ããã¹ããã
- äžèŽãããïŒæš
- ã€ãã¬ãŒã¿ïŒãã«ãã¬ãã«é å
- å埩å¯èœãªãªã¹ã
å€ããïŒ