ばんじゅん🍓
September 19, 2021
2.6k

ほんの一瞬だけでもConcurrencyの計算理論に触れてみませんか？ / Let's try taking a quick look at a calculus for concurrency

Video Archive(TBA):

ばんじゅん🍓PRO

September 19, 2021

Transcript

3. © ZOZO Technologies, Inc. 3 Swift Concurrency?????? Ͱ΋ͳΜ͔ඇಉظͬͯଊ͑Ͳ͜Ζ͕ͳͯ͘೉͍͠ҹ৅͋Δ… Concurrency =

ඇಉظ   ͚ͩͬʁ ҙ֎ͱ   ؾΛ෇͚Δ͜ͱ͕ଟ͍? ϦϑΝΫλͱ͔   ίʔυϨϏϡʔͱ͔   Ͳ͏͠Α͏

6. © ZOZO Technologies, Inc. 6 Swiftͦͷ΋ͷͰ͸ͳ͘…  ผͷ֯౓͔ΒConcurrencyΛݟͯΈΔ ۩ମతͳจ๏ ۩ମతͳίʔυΛॻ͘ΤϯδχΞ ܭࢉཧ࿦ɾܗࣜख๏

ந৅తͳϞσϧ ந৅తͳϞσϧ্ͷϩδοΫ Concurrency ීஈͷϓϩάϥϛϯά ྫࣔ ʰCCSʱ ֓೦తͳੈք
7. © ZOZO Technologies, Inc. 7 ͘͘͢͢͝͝େࡶ೺ͳ۠ผͰ͍͏ͱ… ඇಉظ͕ಉ࣌ʹಈ͍ͯΔΠϝʔδ ීஈͷϓϩάϥϛϯά ֓೦తͳੈք ՄೳੑΛ

਺্͑͛Δ 1εςοϓͣͭ֬ೝ͢Δ
8. © ZOZO Technologies, Inc. 8 ◆ ConcurrencyΛભҠਤͰʁʁฉ͍ͨ͜ͱ͕͋ΔʂʂʹͳΔ ◆ ؾ෼స׵Λ݉ͶͨࢥߟͷτϨʔχϯάͱࢥͬͯ΋OK !

◆ ࣮ࡍ͙͢໾ʹཱ͔ͭʁʁΛؾʹ͠ͳ͍ ࠓ೔ͷΰʔϧ

12. © ZOZO Technologies, Inc. 12 CCS - Calculus of Communicating

Systems ฒߦܭࢉͷϞσϧͷͻͱͭ ݸผʹಈ͘ʮϓϩηεʯ͕ͨ͘͞Μ͋Γɺޓ͍ʹ௨৴ͯ͠ܭࢉ͕ਐΉɺͱ͢Δ ʮϓϩηεʯͱ͸ɺUNIXϓϩηεɾεϨουɾActorͳͲͳͲΛྨਪͯ͠΋Α͍͕ɺ΋ͬͱ֓೦తͳ΋ͷ͢ ΂ͯɻਓ΍γεςϜͰ΋Α͍ɻ จ๏ɿ ϓϩηε P = 0 a.P1 P1 + P2 P1 | P2 P1[b/a] P1\a A | | | | | | ͳʹ΋͠ͳ͍ ΞΫγϣϯaΛͯ͠P1ʹͳΔ P1·ͨ͸P2ʹͳΔ P1ͱP2͕ฒྻ͢Δ a→b໊લସ͑ a͕֎͔Βݟ͑ͳ͍P1 ଞͷϓϩηε໊ࢀর ஞ࣮࣍ߦ ඇܾఆੑ ฒྻ߹੒ ʢˠ௨৴ʣ ※จ๏ͷ΄͔ʹηϚϯςΟΫε͕͋ΓɺҎԼྫࣔʹΑΓུ https://en.wikipedia.org/wiki/Calculus_of_communicating_systems
13. © ZOZO Technologies, Inc. 13 CCS - جຊจ๏ͱͦͷભҠܥ 1. جຊจ๏ͱͦͷભҠܥ

2. ભҠܥΛಋग़͢ΔηϚϯςΟΫε 3. ϓϩηεΛ؍ଌ͢Δͱ͸Ͳ͏͍͏͜ͱ͔ʁ 4. ผͷϓϩηεʹஔ׵͑ʢϦϑΝΫλʣͰ͖Δ͔ʁ ౳Ձੑ͸ʁ 5. CCS͚ͩ͡Όͳ͍ɺଞʹ΋͋Δ௨৴ϓϩηεܭࢉ
14. © ZOZO Technologies, Inc. 14 ϓϩηεͷࣜͱϥϕϧ෇͖ભҠܥ a.b.0 ࣜ ભҠܥ a.0

0 a a.b.0 a b.0 b a.0 a.0 ͸ aͯ͠ ࢭ·Δ 0 a.b.0 ͸ aͯ͠ bͯ͠ ࢭ·Δ 0͸ʮͳʹ΋͠ͳ͍ʯ
15. © ZOZO Technologies, Inc. 15 બ୒ a.0 + b.0

a.0 + b.0 a ࣜ ભҠܥ 0 b aͯ͠ ࢭ·Δ bͯ͠ ࢭ·Δ ·ͨ͸ ͲͪΒ͔બΜͰ෼ذ aͯ͠ࢭ·Δ͔ɺ   bͯ͠ࢭ·Δ͔ɺ ͲͪΒ͔ 0
16. © ZOZO Technologies, Inc. 16 ฒྻ߹੒ ʢ௨৴͢ΔྫͰ͸ͳ͍ʣ a.0 | b.0

a.0 | b.0   0 | b.0 a ࣜ ભҠܥ 0 | 0 b   a.0 | 0 b 0 | 0 a aͯ͠ ࢭ·Δ bͯ͠ ࢭ·Δ ͱ ยଆͣͭಈ͍ͯɺࠨӈͲͪΒ͔ΛḷΔ ʢΠϯλʔϦʔϒʣ aͯ͠ bͯ͠ ࢭ·Δ͔ɺ   bͯ͠ aͯ͠ ࢭ·Δ͔ɺ ͲͪΒ͔
17. © ZOZO Technologies, Inc. 17 ฒྻ߹੒ͱඇܾఆੑͷؔ࿈ a.0 | b.0 a.b.0

+ b.a.0   a.0 | b.0   0 | b.0 a ࣜ ભҠܥ 0 | 0 b   a.0 | 0 b 0 | 0 a   a.b.0 + b.a.0 a b   b.0   a.0 0 b 0 a ಉ͡ʂ
18. © ZOZO Technologies, Inc. 18 CCSͷΑ͋͘Δྫ: ࣗൢػ ྫʢվม͋Γ)ͷࢀߟจݙ … Reactive

Systems: Modelling, Specification and Verification (English Edition) by Luca Aceto, Anna Ingólfsdóttir, Kim Guldstrand Larsen, Jiri Srba Co ff ee Machine User ແݶίʔώʔ ແݶϢʔβʔ coin 🪙 ☕ coffee
19. © ZOZO Technologies, Inc. 19 CCSͷΑ͋͘Δྫ: ࣗൢػ ʢೖग़ྗʣ ______

CM = coin.coffee.CM ____   User = coin.coffee.User ࣜ Co ff ee Machine User ແݶίʔώʔ ແݶϢʔβʔ coin 🪙 ______   coffee ☕ coffee ____   coin
20. © ZOZO Technologies, Inc. 20 CCSͷΑ͋͘Δྫ: ࣗൢػ ʢભҠਤʣ ______

CM = coin.coffee.CM ____   User = coin.coffee.User ______   coin.coffee.CM ______   coffee.CM coin ______   coffee ____   coin.coffee.User   coffee.User ____   coin coffee ࣜ ભҠܥ ແݶίʔώʔ ͱ ແݶϢʔβʔ
21. © ZOZO Technologies, Inc. 21 CCSͷΑ͋͘Δྫ: ࣗൢػ ʢϓϩηεؒͷಉظ௨৴ʣ ______

CM = coin.coffee.CM ____   User = coin.coffee.User ______   coin coffee ࣜ ભҠܥ ฒߦͨ͠ϓϩηεؒͷૹड৴ϖΞ
22. © ZOZO Technologies, Inc. ભҠܥ 22 CCSͷΑ͋͘Δྫ: ࣗൢػ ʢ֎͔ΒݟΔʣ

CM | User τ ______   coffee.CM | coffee.User ࣜ CMͱUserͷcoinૹड৴ʹΑΔભҠ  ʢ֎͔Β͸ݟ͑ͳ͍ʣ ______   CM = coin.coffee.CM ____   User = coin.coffee.User ͷͱ͖ͷ CM | User
23. © ZOZO Technologies, Inc. ભҠܥ 23 CCSͷΑ͋͘Δྫ: ࣗൢػ (and more…)

CM | User | User | User τ ??? ࣜ ͷͱ͖ͷ CM | User | User | User ______   CM = coin.coffee.CM ____   User = coin.coffee.User
24. © ZOZO Technologies, Inc. 24 ͞ΒͳΔਂΈ΁ ✅ جຊจ๏ͱͦͷભҠܥ ભҠܥΛಋग़͢ΔηϚϯςΟΫε ϓϩηεΛ؍ଌ͢Δͱ͸Ͳ͏͍͏͜ͱ͔ʁ

ผͷϓϩηεʹஔ׵͑ʢϦϑΝΫλʣͰ͖Δ͔ʁ ౳Ձੑ͸ʁ CCS͚ͩ͡Όͳ͍ɺଞʹ΋͋Δ௨৴ϓϩηεܭࢉ ؾʹͳͬͨΒௐ΂ͯΈΑ͏ʂ

26. © ZOZO Technologies, Inc. https://zozo.jp/ • ೔ຊ࠷େڃͷϑΝογϣϯ௨ൢαΠτ • 1,400Ҏ্ͷγϣοϓɺ8,200Ҏ্ͷϒϥϯυͷऔΓѻ͍ʢͱ΋ʹ 2021೥3݄຤࣌఺ʣ

• ৗ࣌83ສ఺Ҏ্ͷ঎඼ΞΠςϜ਺ͱຖ೔ฏۉ2,900఺Ҏ্ͷ৽ண ঎ ඼Λܝࡌ • ίεϝઐ໳ϞʔϧʮZOZOCOSMEʯ΍ۺͷઐ໳Ϟʔϧ ʮZOZOSHOESʯɺϥάδϡΞϦʔˍσβΠφʔζκʔϯ ʮZOZOVILLAʯΛల։ • ଈ೔഑ૹαʔϏε • ΪϑτϥοϐϯάαʔϏε • πέ෷͍ ͳͲ 26

28. © ZOZO Technologies, Inc. גࣜձࣾZOZOςΫϊϩδʔζ ςοΫϦʔυ ZOZOTOWN iOS ͹Μ͡ΎΜ🍓 /

@banjun 28 -PWF-JWFS NBD04 \$SFBUF-JWF1IPUPTGSPN.PWJFT 'MJDL4,, J04 +BQBOFTF\$VTUPN,FZCPBSE&YUFOTJPO ݸਓϓϩδΣΫτɾ1PEDBTU ͖ͷ͜ΔΤϑΤϜX!USFCZ͖ͷ͜Δ