Upgrade to Pro — share decks privately, control downloads, hide ads and more …

知っているようで知らないWebサーバアーキテクチャ

 知っているようで知らないWebサーバアーキテクチャ

第6回ゲームサーバ勉強会用資料です。
Webの技術の根幹となるHTTPやTCP/IPを軽くおさらいしたあと、
マルチプロセス、マルチスレッド、イベント駆動といったサーバアーキテクチャについて解析し、
さらにイベント駆動を実現するための非ブロッキングI/OとI/Oの多重化について解説します。

Yuki Tamura

May 21, 2017
Tweet

More Decks by Yuki Tamura

Other Decks in Technology

Transcript

  1. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    %&-J()5803,4*OD
    ஌͍ͬͯΔΑ͏Ͱ஌Βͳ͍

    8FCαʔόΞʔΩςΫνϟ
    ୈ̒ճήʔϜαʔόษڧձ

    View full-size slide

  2. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ࣗݾ঺հ
    ాଜ༞थʢUXJUUFS!JTPQBSBNFUSJD

    σΟϥΠτϫʔΫεגࣜձࣾ
    ݩʑ͸ίϯιʔϧग़਎
    ൣғ͸ΫϥΠΞϯτɺαʔόɺΠϯϑϥɺ͍Ζ͍Ζʜʜ
    ࠷ۙ͸6OJUZͷ;FOKFDUʢ%*ϑϨʔϜϫʔΫʣ͍ͬͯ͡·͢
    ޷͖ͳݴޠ͸$ͱ-VB

    View full-size slide

  3. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    8FCαʔό
    3%# Ϣʔβʔ
    ϩʔυ

    όϥϯα
    8FCαʔό
    8FCαʔό
    ͜ͷลΓͷ͓࿩

    View full-size slide

  4. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ୅දతͳ8FCαʔό

    View full-size slide

  5. ࢮʹ
    ࢸΔ
    ࡸͦ
    ͠
    ͯ
    ɺ

    ұ

    View full-size slide

  6. αʔό͕
    ॏ͍Ͱ͢ʂ
    ໰୊ൃੜʂʂʂ

    View full-size slide

  7. Α͘஌Βͳ͍ਓ

    ʮαʔό͕ॏ͚Ε͹

    ୆਺Λ૿΍ͤ

    ͹͍͍͡Όͳ͍ʯ

    View full-size slide

  8. 8FCαʔό
    3%#
    8FCαʔό
    8FCαʔό
    8FCαʔό
    8FCαʔό
    8FCαʔό
    8FCαʔό
    8FCαʔόΛ૿΍͢ͱ
    3%#΁ͷ઀ଓ͕૿େ͠
    ো֐͕ൃੜ͢Δ͜ͱ΋
    %#΁ͷ઀ଓ
    ଟ͗͢໰୊

    View full-size slide

  9. %#͕աෛՙͰԠ౴͕ฦͤͳ͍
    Ԡ౴͕ฦΒͳ͍ͷͰ8FCαʔόͷ

    ॲཧ͕ऴΘΒͳ͍
    8FCαʔόͷॲཧ͕ऴΘΒͳ͍··

    ࣍ʑͱ৽͍͠ΞΫηε͕དྷΔ
    ࠷ޙʹ͸8FCαʔό͕٧·Δ

    ಥવͷࢮʂʂʂ

    View full-size slide

  10. %#ͷεέʔϧΞοϓ͠·͔͢ʁ

    View full-size slide

  11. %#ͷ࠷దԽ͠·͔͢ʁ

    View full-size slide

  12. Ͱ͕͢ɺࠓճ͸8FCαʔόͷ͓࿩Ͱ͢

    View full-size slide

  13. ໰୊ͷ੾Γ෼͚͕େ੾

    View full-size slide

  14. ͋Γ·͢͜Μͳো֐
    %#ʹ઀ଓͨ͠··

    8FCαʔόͰ໓஡ۤ஡ॏ͍ॲཧͰ٧·Δ
    %#͸ۭ͍ͯͯ8FCαʔό΋਺ଟ͋͘Δͷʹ

    ผͷαʔόʗγεςϜʹܨ͍Ͱ͍Δͷ͕ॏ͍
    αʔόΩϟογϡ͕/P42-ʹ͋ͬͯ

    Կ౓΋઀ଓͯͯ͠8FCαʔό͕໓஡ۤ஡ॏ͍
    GPSจͷதͰωοτϫʔΫ઀ଓʜʜ
    42-ͰաڈશͯͷσʔλΛᢞΊͯΔʜʜ

    View full-size slide

  15. 8FCαʔό
    3FEJT
    NFNDBDIFE
    ܾࡁγεςϜ
    .Z42-
    ೝূγεςϜ
    ͲΕ΋
    ॏ͍ΜͰ͢

    View full-size slide

  16. ໐Γ·͘
    Δɺ
    ి
    ࿩ ୈ


    View full-size slide

  17. 8FCαʔόͬͯ

    View full-size slide

  18. Ͳ͏΍ͬͯಈ͘ͷ͔
    આ໌Ͱ͖·͔͢ʁ

    View full-size slide

  19. ଟ͘ͷਓͷೝࣝ

    View full-size slide

  20. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    Ϣʔβʔ
    8FC
    ϑϨʔϜ

    ϫʔΫ
    3FRVFTU
    ͝ʹΐ͝ʹΐ
    ॲཧ͢Δ
    3FTQPOTF
    Ϣʔβʔ
    ͳΜ͔ͩ͜Μͳײ͡ʁ
    ϦΫΤετདྷͯ
    Ϩεϙϯεฦ͢ͷͰ͸ʁ

    View full-size slide

  21. ؒҧͬͯ͸͍·ͤΜ

    View full-size slide

  22. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE

    )551ͰϦΫΤετΛड৴͢Δ

    )551ϔομΛύʔε͢Δ

    ΞϓϦέʔγϣϯଆͰద੾ͳϋϯυϥΛݺͼग़͢

    ήʔϜͷॲཧΛ࣮ߦ͢Δʢ%#ͱ͔΋͍͡Δʣ

    ςϯϓϨʔτΤϯδϯͳͲΛ࢖ͬͯϨεϙϯεΛฦ͢
    جຊ͸͜Ε͚ͩ
    8FCαʔόͷ໾ׂ

    View full-size slide

  23. ͳΜͩ؆୯͡Όͳ͍͔

    View full-size slide

  24. Ͱ͸ɺ)551ͬͯ
    ͳΜͰ͠ΐ͏͔ʁ

    View full-size slide

  25. )ZQFSUFYU
    5SBOTGFS
    1SPUPDPM

    View full-size slide

  26. ϋΠύʔςΩετ

    సૹϓϩτίϧ

    View full-size slide

  27. ϋΠύʔςΩετΛసૹ͢Δʁ

    View full-size slide

  28. ςΩετΛ௒͑ͨςΩετʁ

    View full-size slide

  29. ͋Εʁը૾΋సૹͯ͠ͳ͍ʁ

    View full-size slide

  30. ࠓճ͸վగ൛)551Λ
    ݩʹ͓࿩͠·͢
    ʢ࠷৽͸)551ʣ

    View full-size slide

  31. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    3'$ 3FRVFTU'PS$PNNFOU
    ᐌ͘
    )551͸ɺ෼ࢄܕͷڠௐతͳ

    ϋΠύʔςΩετ৘ใγεςϜͷͨΊͷɺ

    εςʔτϨεͳ

    ΞϓϦέʔγϣϯϨϕϧͷϓϩτίϧͰ͋Δ

    View full-size slide

  32. ͳΔ΄Ͳݴ͍ͬͯΔ

    ҙຯ͕Θ͔ΒΜ

    View full-size slide

  33. )551͸ɺ

    ʦґڌՄೳͳ

    ʦτϥϯεϙʔτ૚΍ηογϣϯ૚ʧͷ

    ઀ଓʹ·͕ͨͬͯɼϝοηʔδΛަ׵͢Δʧ

    ͜ͱʹΑΓӡ༻͞ΕΔɼ

    εςʔτϨεͳʦཁ੥ʗԠ౴ʧϓϩτίϧͰ͋Δɻ
    3'$

    ΫϥΠΞϯτʗαʔόʹΑΔϝοηʔδॲཧ

    View full-size slide

  34. ɾ)551ΫϥΠΞϯτͱ͸ɺ

    ɹҰͭҎ্ͷ)551ཁ੥Λૹ৴͢Δ໨తͰɼ

    ɹαʔό΁ͷ઀ଓΛཱ֬͢ΔϓϩάϥϜͰ͋Δ
    ɾ)551αʔόͱ͸ɺ)551ཁ੥ʹର͠ɼ

    ɹͦͷ઀ଓΛड༰͠ɼ

    ɹΫϥΠΞϯτ΁ͷαʔϏεͱͯ͠ɼ

    ɹ)551Ԡ౴Λૹ৴͢ΔϓϩάϥϜͰ͋Δɻ
    ˝ྫ͑͹ɺήʔϜϓϩάϥϜͳͲ
    ˛ྫ͑͹ɺ8FCαʔόͳͲ

    View full-size slide

  35. ͨͩ͠ɺೋͭͷ༻ޠͰ͋Δ

    lΫϥΠΞϯτzɺlαʔόz͕ࢦ͢ͷ͸ɺ
    ͋Δಛఆͷ઀ଓͷͨΊʹɺ

    ͜ΕΒͷϓϩάϥϜ͕਱ߦ͢Δ໾ׂͷΈʹݶΒΕΔͷͰ
    ͋Δ઀ଓ্Ͱ͸ΫϥΠΞϯτʹͳΔͱಉ࣌ʹɺ

    ଞͷ઀ଓ্Ͱ͸αʔόͱͯ͠ಈ࡞͠ಘ·͢ɻ
    ʢαʔόʔͱΫϥΠΞϯτ͸ಉ࣌ʹ
    ɹΫϥΠΞϯτͱαʔόʔͰ΋͋ΓಘΔΑͱ͍͏͜ͱʣ

    View full-size slide

  36. ΄ͱΜͲͷ)551௨৴͸ɺ

    ʦ63*ʹΑΓࣝผ͞ΕΔԿΒ͔ͷϦιʔεʧͷ

    දݱʹର͢Δɼ

    ݕࡧऔಘཁ੥ʢ(&5ʣ͔ΒͳΔɻ
    3'$

    ΫϥΠΞϯτʗαʔόʹΑΔϝοηʔδॲཧ

    View full-size slide

  37. 6OJGPSN

    3FTPVSDF

    *EFOUJGJFS

    View full-size slide

  38. 63*͸ɺந৅త͋Δ͍͸෺ཧతͳϦιʔεΛࣝผ͢ΔͨΊ
    ͷ؆ܿͳจࣈྻͰ͋Δɻ
    6OJGPSN౷Ұॻࣜ
    3FTPVSDFϦιʔε

    *EFOUJGJFSࣝผࢠ

    View full-size slide

  39. ʲ౷Ұॻࣜʳ

    ҰఆͷॻࣜΛѻ͏͜ͱɻ
    ʲϦιʔεʳ
    ओʹిࢠจॻɺը૾ɺ৘ใݩɺαʔϏεͳͲΛࢦ͕͢ɺ
    ਓؒ΍اۀɺਤॻؗͷॻ੶ͳͲ෺ཧతͳ΋ͷɺ
    ํఔࣜɺԋࢉࢠɺ਺஋ͱ͍ͬͨந৅త֓೦΋ࢦͤΔɻ
    ʲࣝผࢠʳ
    ༷ʑͳର৅͔ΒಛఆͷҰͭΛࣝผ͢ΔͨΊͷ΋ͷɻ

    View full-size slide

  40. GET /hello.txt HTTP/1.1
    User-Agent: curl/7.16.3 libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3
    Host: www.example.com
    Accept-Language: en, mi
    HTTP/1.1 200 OK
    Date: Mon, 27 Jul 2009 12:28:53 GMT
    Server: Apache
    Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT
    ETag: "34aa387-d-1568eb00"
    Accept-Ranges: bytes
    Content-Length: 51
    Vary: Accept-Encoding
    Content-Type: text/plain
    Hello World! My payload includes a trailing CRLF.
    (&5ʹΑΔΫϥΠΞϯτͷཁ੥
    (&5ͷཁ੥ʹର͢Δαʔό͔ΒͷԠ౴

    View full-size slide

  41. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ͪΌΜͱ)551஌Γ͍ͨͳΒ
    3'$ )551

    3'$ʙ վగ൛)551

    3'$ )551

    3'$ 63*

    Λಡ΋͏

    View full-size slide

  42. ɺ
    ݟ

    Β
    ͵
    ୈࢀ࿩
    ࢓༷

    View full-size slide

  43. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    3'$ 3FRVFTU'PS$PNNFOU
    ᐌ͘
    )551͸ɺ෼ࢄܕͷڠௐతͳ

    ϋΠύʔςΩετ৘ใγεςϜͷͨΊͷɺ

    εςʔτϨεͳ

    ΞϓϦέʔγϣϯϨϕϧͷϓϩτίϧͰ͋Δ

    View full-size slide

  44. )551͸εςʔτϨε
    Ͳ͏͍͏ҙຯͩΖ͏ʁ

    View full-size slide

  45. εςʔτϑϧ
    εςʔτϨε

    View full-size slide

  46. ɹ٬ɿʮ͜Μʹͪ͸ʯ
    ళһɿʮ͍Βͬ͠Ό͍·ͤɺϚΫυόʔΨʔ΁Α͏ͦ͜ʯ
    ɹ٬ɿʮϏοάϚΫυηοτɺ͓ئ͍͠·͢ʯ
    ళһɿʮαΠυϝχϡʔ͸͍͔͕͠·͔͢ʁʯ
    ɹ٬ɿʮϙςτͰʯ
    ళһɿʮυϦϯΫ͸Կʹͳ͍͞·͔͢ʯ
    ɹ٬ɿʮΞΠείʔώʔͰʯ
    ళһɿʮʴ̎̌ԁͰαΠζΛ̡ʹͰ͖·͕͢ʁʯ
    ɹ٬ɿʮ͡Όɺ̡ʹ͍ͯͩ͘͠͞ʯ

    ళһɿʮҎ্ͰΑΖ͍͠Ͱ͔͢ʁʯ

    ɹ٬ɿʮ͸͍ʯ
    ళһɿʮ͔͜͠·Γ·ͨ͠ɻ˓˓ԁʹͳΓ·͢ʯ
    εςʔτϑϧόʔΨʔγϣοϓ
    ࢀߟɿࢁຊཅฏ
    ʰ8FCΛࢧ͑Δٕज़ʱ

    View full-size slide

  47. ɹ٬ɿʮ͜Μʹͪ͸ʯ
    ళһɿʮ͍Βͬ͠Ό͍·ͤɺϚΫυόʔΨʔ΁Α͏ͦ͜ʯ
    ɹ٬ɿʮϏοάϚΫυηοτɺ͓ئ͍͠·͢ʯ
    ళһɿʮαΠυϝχϡʔ͸͍͔͕͠·͔͢ʁʯ
    ɹ٬ɿʮϏοάϚΫυηοτʹϙςτͰʯ
    ళһɿʮυϦϯΫ͸Կʹͳ͍͞·͔͢ʯ
    ɹ٬ɿʮϏοάϚΫυηοτʹϙςτͱΞΠείʔώʔͰʯ
    ళһɿʮʴ̎̌ԁͰαΠζΛ̡ʹͰ͖·͕͢ʁʯ
    ɹ٬ɿʮϏοάϚΫυηοτʹϙςτͱΞΠείʔώʔʢ̡ʣͰʯ

    ళһɿʮҎ্ͰΑΖ͍͠Ͱ͔͢ʁʯ

    ɹ٬ɿʮϏοάϚΫυηοτʹϙςτͱΞΠείʔώʔʢ̡ʣͰɻҎ্Ͱ͢ʯ
    ళһɿʮ͔͜͠·Γ·ͨ͠ɻ˓˓ԁʹͳΓ·͢ʯ
    εςʔτϨεόʔΨʔγϣοϓ
    ࢀߟɿࢁຊཅฏ
    ʰ8FCΛࢧ͑Δٕज़ʱ

    View full-size slide

  48. εςʔτϨε
    ໘౗͍͘͞ͳ

    View full-size slide

  49. εςʔτϨε͔ͩΒ
    εέʔϧ͢Δͷͩͱͨ͠Βʁ

    View full-size slide

  50. ɹɹ٬ɿʮ͜Μʹͪ͸ʯ
    ళһ̖ɿʮ͍Βͬ͠Ό͍·ͤɺϚΫυόʔΨʔ΁Α͏ͦ͜ʯ
    ɹɹ٬ɿʮϏοάϚΫυηοτɺ͓ئ͍͠·͢ʯ
    ళһ̗ɿʮαΠυϝχϡʔ͸͍͔͕͠·͔͢ʁʯ
    ɹɹ٬ɿʮϏοάϚΫυηοτʹϙςτͰʯ
    ళһ̘ɿʮυϦϯΫ͸Կʹͳ͍͞·͔͢ʯ
    ɹɹ٬ɿʮϏοάϚΫυηοτʹϙςτͱΞΠείʔώʔͰʯ
    ళһ̙ɿʮʴ̎̌ԁͰαΠζΛ̡ʹͰ͖·͕͢ʁʯ
    ɹɹ٬ɿʮϏοάϚΫυηοτʹϙςτͱΞΠείʔώʔʢ̡ʣͰʯ

    ళһ̚ɿʮҎ্ͰΑΖ͍͠Ͱ͔͢ʁʯ

    ɹɹ٬ɿʮϏοάϚΫυηοτʹϙςτͱΞΠείʔώʔʢ̡ʣͰɻҎ্Ͱ͢ʯ
    ళһ̛ɿʮ͔͜͠·Γ·ͨ͠ɻ˓˓ԁʹͳΓ·͢ʯ
    εςʔτϨεόʔΨʔ͸

    ళһ͕ಉ͡Ͱͳͯ͘΋ྑ͍
    ࢀߟɿࢁຊཅฏ
    ʰ8FCΛࢧ͑Δٕज़ʱ

    View full-size slide

  51. εςʔτϨε͔ͩΒ
    ٬͕ߟ͑ͯΔ࣌ଞͷࣄ͕ग़དྷΔ

    View full-size slide

  52. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    3'$ 3FRVFTU'PS$PNNFOU
    ᐌ͘
    )551͸ɺ෼ࢄܕͷڠௐతͳ

    ϋΠύʔςΩετ৘ใγεςϜͷͨΊͷɺ

    εςʔτϨεͳ

    ΞϓϦέʔγϣϯϨϕϧͷϓϩτίϧͰ͋Δ

    View full-size slide

  53. ΞϓϦέʔγϣϯ૚
    τϥϯεϙʔτ૚
    Πϯλʔωοτ૚
    ϦϯΫ૚
    )551 44) '51 %)$1ͳͲ
    5$1 6%1ͳͲ
    *1 *1W *1W
    ͳͲ
    5$1*1ࢀরϞσϧ
    ΠʔαωοτͳͲ
    ίί

    View full-size slide

  54. )551͸5$1*1ϕʔε

    View full-size slide

  55. 5$1ʁ*1ʁ͓͍͍͠ʁ

    View full-size slide

  56. 5SBOTNJTTJPO
    $POUSPM
    1SPUPDPM
    ͱ͸ͳΜͧ΍ʁ

    View full-size slide

  57. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    w Ԡ౴Λඞཁͱ͢Δ
    w γʔέϯε൪߸ͱݺ͹ΕΔσʔλͷॱং͚ͮΛ࣋ͭ
    w ΫϥΠΞϯτͱαʔόͷԟ෮࣌ؒ 355SPVOEUSJQUJNF
    Λ

    ༧ଌ͢ΔΞϧΰϦζϜΛ಺แ͢Δ
    w λΠϜΞ΢τͱ࠶ૹͷ࢓૊ΈΛ࣋ͭ
    5$1ͱ͸ͲΜͳϓϩτίϧ͔ʁ

    View full-size slide

  58. ߴ଎͞ΑΓਖ਼͕֬͞େࣄ

    View full-size slide

  59. Ͳ͏ͯ͠ਖ਼֬ͳͷ͔΋͏গ͠

    View full-size slide

  60. ਖ਼֬ͷՁ஋͸
    ୈ࢛࿩

    View full-size slide

  61. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    5$1ίωΫγϣϯͷ
    ཱ֬ͱऴྃʹ͍ͭͯ

    View full-size slide

  62. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    XBZIBOETIBLF

    View full-size slide

  63. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ΫϥΠΞϯτ αʔόʔ
    TPDLFU
    DPOOFDUʢϒϩοΫʣ

    ʢΞΫςΟϒΦʔϓϯʣ
    TPDLFU CJOE MJTUFOʢύογϒΦʔϓϯʣ
    BDDFQUʢϒϩοΫʣ
    DPOOFDU͔Β໭Δ
    BDDFQU͔Β໭Δ

    SFBEʢϒϩοΫʣ
    4:/+
    4:/, BDL+
    BDL,
    αʔόʔ͸ίωΫγϣϯΛड͚෇͚Δ༻ҙΛ͢Δ

    ͜Ε͸௨ৗTPDLFUɺCJOEɺMJTUFOΛݺͼग़͢ʹύογϒΦʔϓϯ
    ΫϥΠΞϯτ͸DPOOFDUΛݺͼग़͠ΞΫςΟϒΦʔϓϯΛ࣮ߦ͢Δ

    γʔέϯε൪߸ͷॳظ஋Λ4:/ηάϝϯτͰૹ৴͢Δ
    αʔό͸4:/ʹର͢ΔԠ౴Λૹ৴͢ΔͨΊʹࣗ਎ͷ4:/ͱɺ

    ΫϥΠΞϯτͷ4:/ʹର͢ΔԠ౴ͱͳΔ"$,Λ୯Ұͷηάϝϯτͱͯ͠ૹ৴͢Δ
    ΫϥΠΞϯτ͸αʔόͷ4:/ʹԠ౴͢Δ




    BDL֬ೝԠ౴൪߸

    View full-size slide

  64. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    5$1ίωΫγϣϯͷཱ֬͸

    ి࿩ʹࠅࣅ͍ͯ͠Δ
    TPDLFUؔ਺ి࿩Λ༻ҙ͢Δ
    CJOEؔ਺ࣗ෼ͷి࿩൪߸Λڭ͑Δ
    MJTUFOؔ਺ண৴͕͋ͬͨͱ͖ʹݺͼग़͠ԻΛ໐Β͢
    DPOOFDUؔ਺૬खͷ൪߸͕Θ͔Ε͹͜ΕͰμΠΞϧͰ͖Δ
    BDDFQUؔ਺ड࿩ثΛऔΓ্͛Δ

    View full-size slide

  65. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    5$1ίωΫγϣϯͷղ์

    View full-size slide

  66. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ΫϥΠΞϯτPSαʔόʔ αʔόʔPSΫϥΠΞϯτ
    DMPTF

    ʢΞΫςΟϒΫϩʔζʣ
    '*/.
    BDL.
    BDL/
    ऴྃ͢Δଆ͕DMPTFΛݺͼग़͢ʹΞΫςΟϒΫϩʔζ

    σʔλͷૹ৴͕ऴྃͨ͜͠ͱΛҙຯ͢Δ'*/ηάϝϯτΛૹ৴͢Δ
    '*/Λड৴ͨ͠ଆ͸ɺύογϒΫϩʔζΛ࣮ߦɺड৴ͨ͠'*/͸5$1ʹΑͬͯ

    Ԡ౴͕ૹ৴͞ΕɺͦΕҎ্σʔλ͸ड৴͠ͳ͍ͷͰ&0'ͱͯ͠ΞϓϦʹ௨஌
    &0'ΛಡΈग़ͨ͠ΞϓϦ͕ιέοτͷDMPTFΛߦ͏

    ͜ΕʹΑΓɺ5$1͸'*/ηάϝϯτΛૹ৴͢Δ
    ࠷ޙͷ'*/Λड৴ͨ͠ଆ͸͜ͷ'*/ʹର͢ΔԠ౴Λߦ͏



    ʢύογϒΫϩʔζʣ
    SFBE͕Λฦ͢
    '*// DMPTF

    View full-size slide

  67. جૅதͷجૅ

    View full-size slide

  68. Ͱ΋ҙ֎ͱ஌Βͳ͍͜ͱ
    આ໌Ͱ͖ͳ͍͜ͱ

    View full-size slide

  69. ͳͥͳΒউखʹ
    ͏·͍͜ͱ΍ͬͯ͘ΕͯΔ͔Β

    View full-size slide

  70. ஌Βͳ͍ͱ͜ΖͰؤு͍ͬͯΔ
    ͦΕ͕̩̘̥

    View full-size slide

  71. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ΫϥΠΞϯτ αʔόʔ
    TPDLFU
    DPOOFDUʢϒϩοΫʣ
    TPDLFU CJOE MJTUFO
    BDDFQUʢϒϩοΫʣ
    4:/@3$7%
    &45"#-*4)&%
    DPOOFDU͔Β໭Δ
    &45"#-*4)&%
    BDDFQU͔Β໭ΔɺSFBEʢϒϩοΫʣ
    XSJUFɺSFBEʢϒϩοΫʣ ˝σʔλʢཁٻʣ
    ʻαʔό͕ཁٻΛॲཧʼ
    XSJUFɺSFBEʢϒϩοΫʣ
    ˝σʔλʢԠ౴ʣ
    ɹཁٻͷBDL
    SFBE͔Β໭Δ
    DMPTF
    '*/@8"*5@
    SFBE͔Β໭Δ
    BDL֬ೝԠ౴൪߸
    Ԡ౴ͷBDL
    $-04&@8"*5
    DMPTF
    5*.&@8"*5
    $-04&%
    ͱ
    ͋
    Δ
    ̩
    ̘
    ̥
    ί
    ω
    Ϋ
    γ
    ϣ
    ϯ
    -"45@"$,
    '*/@8"*5@
    SFBE͕Λฦ͢
    4:/@4&/5
    -*45&/
    ͔͜͜͠
    ݟͯͳ͍

    View full-size slide

  72. ͡Ό̞̥͸ʁ
    *OUFSOFU
    1SPUPDPM

    View full-size slide

  73. ̞̥͸࠷΋جຊతͳ௨৴୯Ґ
    ύέοτΛ૬खʹૹ৴͢Δ

    View full-size slide

  74. ൃ৴ऀɺड৴ऀ͸
    ̞̥ʹΑͬͯಛఆ͞ΕΔ

    View full-size slide

  75. ̞̥͸ύέοτΛૹग़͢Δ͚ͩ

    ૬खʹಧ͔͘͸อূ͠ͳ͍

    View full-size slide

  76. ࣮֬ʹૹड৴͢Δ
    ඞཁ͕͋ΔͳΒ͹
    ̩̘̥ͳͲΛ
    ࢖͏ඞཁ͕͋Δ

    View full-size slide

  77. 5$1*1ͷ௨৴͸جຊॏ͍ɻ
    .Z42-1SPUPDPMͳͲ͸
    4PDLFU௨৴͕ͩɺ
    ͦ΋ͦ΋ωοτϫʔΫϦιʔεΛ
    සൟʹ࢖͏ͱ͍͏͜ͱ͕ॏ͍
    ͱ͍͏ೝࣝΛ࣋ͭ͜ͱɻ

    View full-size slide



  78. ͠
    ͨࡸͷ
    Ͱ


    ޒ࿩

    View full-size slide

  79. ͍Α͍Α8FCαʔόͷ͓࿩

    View full-size slide

  80. ̝̩̩̥ΛͲ͏ޮ཰ྑ͘
    ॲཧ͢Δ͔ʁ

    View full-size slide

  81. αʔό͸ԿΛͲ͏ؤுͬͯ
    ͍Δͷ͔ʁɹ

    View full-size slide

  82. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ΫϥΠΞϯτ αʔό
    5$1ϙʔτΛCJOEͯ͠
    MJTUFO͢Δ
    (&5)551
    )5510,
    5$1XBZIBOETIBLF
    BDDFQUͯ͠
    ৽͍͠઀ଓΛड͚ೖΕΔ
    SFBE SFDW
    Ͱ
    )551ϦΫΤετΛड͚औΔ
    ϦΫΤετΛॲཧ͢Δ
    XSJUF TFOE
    Ͱ
    )551ϨεϙϯεΛฦ͢
    DMPTFͯ͠5$1઀ଓΛ੾Δ
    ج


    ͳ
    ϓ
    ϩ
    η
    ε


    View full-size slide

  83. ͜ͷ··Ͱ͸εέʔϧͰ͖ͳ͍

    View full-size slide

  84. *0ϨϕϧͰ͸ϒϩοΫ͞ΕΔͷͰ
    SFBEXSJUFத͸ଞͷ͜ͱ͕Ͱ͖ͳ͍͔Β

    View full-size slide

  85. ฒߦॲཧͷํ๏͸ओʹ̏ͭ

    View full-size slide

  86. Ϛϧνϓϩηε
    ϚϧνεϨου
    Πϕϯτۦಈ

    View full-size slide

  87. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    Ϛϧνϓϩηε
    ϦΫΤετΛฒߦͰॲཧ͢ΔͨΊɺGPSLͰࢠϓϩηεΛੜ੒
    ॲཧΛࢠϓϩηεʹ೚ͤΔɻ
    GPSL͸ϝϞϦ্ͷΞυϨεۭؒΛ·Δ͝ͱผͷΞυϨεۭؒʹ
    ίϐʔ͢ΔͨΊҰൠతʹ஗͍ͱݴΘΕΔɻ
    ͕ɺ࣮ࡍʹ͸$P8 $PQZ0O8SJUF
    ͱ͍͏࢓૊ΈͰ
    ϝϞϦίϐʔͷෛՙΛ཈͑Δɻ
    $P8͸GPSL࣌ʹࢠϓϩηεͷԾ૝ΞυϨεۭؒʹ
    ਌ϓϩηεͷΞυϨεΛϚοϐϯά͠਌ࢠͰΞυϨεڞ༗͢Δɻ

    View full-size slide

  88. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    Ϛϧνϓϩηε
    SP
    PC hoge::i

    foo::tmp
    main()
    hoge()
    foo()
    globalHoges;
    ελοΫ
    ςΩετ
    σʔλ
    new bar[]; ώʔϓ
    SP
    PC hoge::i

    foo::tmp
    main()
    hoge()
    foo()
    globalHoges;
    new bar[];
    GPSL
    ϓϩηεͷίϐʔ
    Ծ૝ΞυϨεۭؒ Ծ૝ΞυϨεۭؒ
    Ϩδελ Ϩδελ
    1$ϓϩάϥϜΧ΢ϯλ
    41ελοΫϙΠϯλ

    View full-size slide

  89. ਌ϓϩηε
    ࢠϓϩηε
    ࢠϓϩηε
    ࢠϓϩηε
    ࢠϓϩηε
    ΫϥΠΞϯτ
    ΫϥΠΞϯτ
    ΫϥΠΞϯτ
    ΫϥΠΞϯτ
    ˛
    GPSLͯ͠
    ࢠϓϩηεΛ૿΍͢
    ͦΕͧΕ͕ɺ਌ͱ
    ಉ͡Α͏ʹड͚෇͚Δ
    Ϛϧνϓϩηεͷ࢓૊Έ

    View full-size slide

  90. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ϚϧνϓϩηεͷϝϦοτ
    ࢓૊Έ͕୯७
    ϓϩάϥϚ͕ҙࣝ͠ͳ͚Ε͹ͳΒͳ͍͜ͱ͕΄΅ͳ͍ɻ
    $P8ͷ࢓૊Έͷ͓͔͛ͰΞυϨεڞ༗Ͱ͖ΔͨΊɺ
    ίϐʔͷෛՙ͸ࢥͬͨΑΓ΋େ͖͘ͳ͍ɻ
    ॻ͖ࠐΈ࣌ʹ਌ͷϝϞϦۭؒΛࢠͷϝϞϦۭؒʹίϐʔ͢Δɻ

    ౎౓GPSL͢Δ͜ͱͳ͘ɺࣄલʹGPSLͯ͠ʢQSFGPSLʣ࢖͍ճ͢͜
    ͱ΋Ͱ͖Δɻ

    View full-size slide

  91. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ϚϧνϓϩηεͷσϝϦοτ
    ϝϞϦফඅྔ͕ଟ͍
    $P8Ͱڞ༗͸Ͱ͖Δ͕ɺॻ͖ࠐΈઌ͸ڞ༗Ͱ͖ͳ͍ͨΊɺ

    ঃʑʹϝϞϦΛফඅ͍ͯ͘͜͠ͱʹͳΔɻ
    ·ͨɺࢠϓϩηεҎ্ͷΫϥΠΞϯτ਺Λಉ࣌ʹ͞͹͚ͳ͍ɻ
    ݶք͕͘ΔͱXBZIBOETIBLFࡁΈͷ઀ଓ͸Ωϡʔʹͨ·Δɻ
    ͔͠͠ɺ୭΋BDDFQU͠ͳ͍ͨΊɺ٧·ͬͯ͠·͏ɻ

    View full-size slide

  92. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ϚϧνεϨου
    SP
    PC
    foo::i

    foo::j
    main()
    hoge()
    foo()
    globalHoges;
    ελοΫ
    ςΩετ
    σʔλ
    new bar[]; ώʔϓ
    hoge::x

    hoge::y
    εϨου̍
    SP
    PC
    ελοΫ
    εϨου̎
    Ϩδελ
    Ϩδελ
    1$ϓϩάϥϜΧ΢ϯλ
    41ελοΫϙΠϯλ
    Ծ૝ΞυϨεۭؒ

    View full-size slide

  93. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ϚϧνεϨουͷϝϦοτ
    ϝϞϦফඅ͕গͳ͍ʢϓϩηεΑΓʣ
    ϓϩηεͱಉ༷ʹ౎౓εϨουΛੜ੒͢Δํ๏ͱɺ

    ࣄલʹεϨουΛ͓͖ͭͬͯ͘࢖͍ճ͢ʢεϨουϓʔϧʣํ๏

    ͕͋Δɻ

    εϨου͸ϝϞϦΛ࠷ॳ͔Βڞ༗͢ΔͨΊɺ
    ϓϩηεΑΓϝϞϦফඅྔ͕গͳ͍ͱݴΘΕΔɻ

    View full-size slide

  94. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ϚϧνεϨουͷσϝϦοτ
    Ϧιʔεڝ߹͕ى͖΍͍͢
    ϚϧνεϨου͸ෳ਺ͷεϨου͕ϝϞϦۭؒΛڞ༗͢Δɻ
    ͦͷͨΊɺϦιʔε͕ڝ߹͠ͳ͍Α͏ʹؾΛ͚ͭͯ

    ϓϩάϥϜ͠ͳ͚Ε͹ͳΒͳ͍ɻ
    ͖ͪΜͱཧղ͍ͯ͠ͳ͚Ε͹ɺෆՄղͳόάΛੜΈग़͢ɻ

    View full-size slide

  95. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    Πϕϯτۦಈ
    ωοτϫʔΫ*0ΛଟॏԽͯ͠
    ϓϩηεεϨουͰ
    ෳ਺ͷωοτϫʔΫ઀ଓΛಉ࣌ʹࡹ͘
    ʢOPOCMPDLJOH*0Λ༻͍Δʣ
    Πϕϯτొ࿥
    Πϕϯτ଴ػ
    Πϕϯτॲཧ
    ޙॲཧ

    View full-size slide

  96. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ඇϒϩοΩϯά*0 OPOCMPDLJOH*0

    ιέοτ͸σϑΥϧτͰϒϩοΩϯάɻ

    ͜Ε͸ιέοτʹରͯ͠ଈ࠲ʹ׬ྃ͠ͳ͍γεςϜίʔϧΛ
    ݺͼग़ͨ࣌͠ɺݺͼग़ͨ͠ϓϩηε͸৚݅ͷ੒ཱΛ଴ͬͯ
    εϦʔϓ͢Δ͜ͱΛҙຯ͢Δɻ
    ඇϒϩοΩϯά*0Ͱ͸γεςϜίʔϧΛݺͼग़ͯ͠΋*0͕
    ४උͰ͖͍ͯͳ͚Ε͹ϒϩοΫͤͣଈ࠲ʹΤϥʔΛฦ͢ɻ
    ʢඇϒϩοΩϯά*0ͱඇಉظ*0͸ಉ͡Ͱͳ͍͜ͱʹ஫ҙʣ

    View full-size slide

  97. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ୅දతͳछྨͷ*0
    w ϒϩοΩϯά*0
    w ඇϒϩοΩϯά*0
    w *0ͷଟॏԽ
    w γάφϧۦಈ*0
    w ඇಉظ*0

    View full-size slide

  98. ϒϩοΩϯά*0
    ΞϓϦ Χʔωϧ
    γεςϜίʔϧΛݺͿͱ
    ΧʔωϧʹεΠον͢Δ JOJUJBUF
    SFBE*0
    SFBE
    SFTQPOTF
    σʔλΛ
    Χʔωϧۭ͔ؒΒ
    Ϣʔβʔۭؒ΁
    3FBE

    ϓϩηε͸γεςϜίʔϧͷ
    ฦ౴଴ͪʹͳΓுΓ෇͘ɻ
    ͦͷؒɺϓϩάϥϜͷॲཧ͕
    ਐΉ͜ͱ͸Ͱ͖ͳ͍ɻ
    CMPDLFE

    View full-size slide

  99. ඇϒϩοΩϯά*0
    ΞϓϦ Χʔωϧ
    γεςϜίʔϧΛݺͿͱ
    ΧʔωϧʹεΠον͢Δ
    JOJUJBUF
    SFBE*0
    SFBE
    SFTQPOTF
    3FBE

    ϑΝΠϧσΟεΫϦϓλͷ
    ४උ͕׬͍ྃͯ͠ͳ͚Ε͹
    ଈ࠲ʹΤϥʔΛฦ͢ɻ
    ϓϩηε͸ϒϩοΫ͞Εͣɺ
    ͦͷؒʹଞͷॲཧΛ͢Δ͜ͱ͕
    Ͱ͖Δɻ
    ଈ࠲ʹΤϥʔΛฦ͢
    ଈ࠲ʹΤϥʔΛฦ͢
    γεςϜίʔϧΛݺͿͱ
    ΧʔωϧʹεΠον͢Δ
    γεςϜίʔϧΛݺͿͱ
    ΧʔωϧʹεΠον͢Δ
    σʔλΛ
    Χʔωϧۭ͔ؒΒ
    Ϣʔβʔۭؒ΁

    View full-size slide

  100. *0ͷଟॏԽ
    QPMM
    ɺTFMFDU
    ɺFQPMM

    γεςϜίʔϧΛར༻͠ɺ
    ෳ਺ͷσΟεΫϦϓλΛ
    ̍ͭͷϓϩηεͰ؅ཧ͢Δ͜ͱɻ
    ೖग़ྗՄೳʹͳͬͨ৔߹ɺ
    Χʔωϧ͔Β௨஌͞ΕΔɻ
    ΞϓϦ Χʔωϧ
    γεςϜίʔϧΛݺͿͱ
    ΧʔωϧʹεΠον͢Δ
    JOJUJBUF
    SFBE*0
    SFBE
    SFTQPOTF
    4FMFDU

    ଈ࠲ʹΤϥʔΛฦ͢
    γεςϜίʔϧΛݺͿͱ
    ΧʔωϧʹεΠον͢Δ
    σʔλΛ
    Χʔωϧۭ͔ؒΒ
    Ϣʔβʔۭؒ΁
    SFBE

    4FMFDUͰ
    σʔλ͕ಡΊΔΑ͏ʹͳΔ
    SFBE

    CMPDLFE

    View full-size slide

  101. γάφϧۦಈ*0
    σΟεΫϦϓλͷ༻ҙ͕Ͱ͖ͨ࣌ʹɺ
    4*(*0γάφϧΛ༻͍ͯ௨஌͢Δɻ
    γάφϧۦಈ*0Ͱ͸ɺ
    *0ૢ࡞ͷىಈ͕Մೳʹͳͬͨ͜ͱΛ௨஌͢Δɻ
    ඇಉظ*0Ͱ͸ɺ
    *0ૢ࡞͕׬ྃͨ͜͠ͱΛ௨஌͢Δɻ
    ਅͷඇಉظ*0Ͱ͸ͳ͍ɻʢ*0ૢ࡞தʹଞͷ͜ͱ͕Ͱ͖ͳ͍ʣ

    View full-size slide

  102. ඇಉظ*0
    ΞϓϦ Χʔωϧ
    γεςϜίʔϧΛݺͿͱ
    ΧʔωϧʹεΠον͢Δ JOJUJBUF
    SFBE*0
    SFBE
    SFTQPOTF
    σʔλΛ
    Χʔωϧۭ͔ؒΒ
    Ϣʔβʔۭؒ΁

    ͷ


    ͕
    Մ

    *0ॲཧ͕׬ྃͨ͠λΠϛϯάͰ
    ௨஌Λߦ͏ɻ
    ௨஌͸γάφϧ͔ίʔϧόοΫʹ
    ΑͬͯߦΘΕɺ௨஌͕͘Δ·Ͱ͸
    ଞͷॲཧΛ͢Δ͜ͱ͕Ͱ͖Δɻ
    BJP@SFBE

    *0
    QSPDFTTJOH

    View full-size slide

  103. ϝΠϯεϨου
    ΫϥΠΞϯτ
    ΫϥΠΞϯτ
    ΫϥΠΞϯτ
    ΫϥΠΞϯτ ετϨʔδ
    ඇϒϩοΩϯά*0
    *0ͷଟॏԽ
    Πϕϯτۦಈͷ࢓૊Έ

    View full-size slide

  104. εϨουϓϩηεͳͷʹ
    ͳͥฒߦॲཧͰ͖Δͷ͔ʁ
    *0ΛଟॏԽ͢Δ͜ͱͰɺ
    ෳ਺ͷσΟεΫϦϓλΛ؂ࢹ͠
    ඇϒϩοΩϯά*0ʹΑͬͯ
    ౎౓ͷ΍ΓͱΓ͕Ͱ͖ΔͨΊ

    View full-size slide

  105. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ΠϕϯτۦಈͷϝϦοτ
    ʮ$,໰୊ʯʹରԠ
    $,໰୊ʢΫϥΠΞϯτສ୆໰୊ʣͱ͸ϋʔυ΢ΣΞͷੑೳ
    ͕͕͋ͬͯ΋ɺΫϥΠΞϯτͷ਺͕ສ୆ۙ͘ʹͳΔͱɺ
    ϓϩηε΍εϨουͷ਺͕૿͑͗͢Δ͜ͱʹΑΓɺ
    ίϯςΩετεΠονͷΦʔόʔϔου͕େ͖͘ͳΓ͗ͯ͢
    ͞͹͚ͳ͘ͳΔ͜ͱɻΠϕϯτۦಈ͸͜ΕΛղܾ͢Δɻ

    View full-size slide

  106. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    ΠϕϯτۦಈͷσϝϦοτ
    ϚϧνίΞ͕׆͖ͳ͍
    Πϕϯτۦಈ͸جຊ̍ϓϩηε̍εϨουͷͨΊ
    ϚϧνίΞͷ$16Λ׆͔͢͜ͱ͕Ͱ͖ͳ͍ɻ
    ·ͨɺ̍ϓϩηε̍εϨουͳͷͰɺ

    ϓϩηε͕ࢮ͵ͱ͖͸͢΂ͯר͖ࠐΜͰࢮ͵ɻ

    View full-size slide

  107. Α͠ϋΠϒϦουʹ͠Α͏

    View full-size slide

  108. $PQZSJHIU%&-J()5803,4*OD"MM3JHIUT3FTFSWFE
    w "QBDIF.1.QSFGPSLʢϚϧνϓϩηεʣ
    w "QBDIF.1.XPSLFSʢϚϧνϓϩηεʴϚϧνεϨουʣ
    w "QBDIF.1.FWFOUʢϚϧνϓϩηεʴΠϕϯτۦಈʣ
    w **4ʢϚϧνϓϩηεʴϚϧνεϨουʣ
    w OHJOYʢϚϧνϓϩηεʴΠϕϯτۦಈʣ
    ࣮ࡍͷ)551αʔόͰ͸ɺεέʔϧ͢ΔͨΊʹ
    ඇৗʹߴ౓ͳ͜ͱ͕ߦΘΕ͍ͯ·͢ɻ
    ૊Έ߹ΘͤʹΑΔ࢓૊Έ
    NQNNVMUJQSPDFTTJOHNPEVMF

    View full-size slide


  109. બ୒
    ͷ
    Λ
    ୈ࿡
    ɹ࿩

    View full-size slide

  110. ݸʑͷḉੑೳ͸
    ঢ়گͱઃఆʹґΔ

    ͷͰ߇͑·͢

    View full-size slide

  111. )551ͱ͸Կ͔Λ஌Δ
    ωοτϫʔΫͷίετ͸

    ඇৗʹߴ͍͜ͱʹؾΛ͚ͭΔ
    8FCαʔόʹ͓͚Δ

    ฒߦԽͷ୅දతͳख๏ͱɺ

    *0ʹର͢ΔରࡦΛ஌Δ

    View full-size slide

  112. ͍Ζ͍Ζ΍͖ͬͯͨ݁࿦ɿ

    ো֐ൃੜ࣌͸ɺ
    Ͳ͜ͰϘτϧωοΫ͕ൃੜ͍ͯ͠Δ͔
    ໰୊ͷ੾Γ෼͚Λ·ͣߟ͑Δ͜ͱ

    View full-size slide

  113. ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠

    View full-size slide