Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
並行・並列処理のテストは難しい
Search
Akihito Nakano
October 27, 2016
Programming
2
4.4k
並行・並列処理のテストは難しい
Akihito Nakano
October 27, 2016
Tweet
Share
More Decks by Akihito Nakano
See All by Akihito Nakano
OpenAPI Generator Meetup #1
akihito_nakano
1
1.3k
Libraの現状と技術面をざっくりと / astudy20191114
akihito_nakano
4
1.1k
カート刷新プロジェクトにおけるOpenAPIを活用したコード自動生成の今と明日 / astudy20190419
akihito_nakano
2
590
平静を保ち、コードを生成せよ 〜 OpenAPI Generator誕生の背景と軌跡 〜 / gunmaweb34
akihito_nakano
25
54k
プライベートAPIのクライアントをいい感じにしたい / pepabo_ec_tech_mtg02
akihito_nakano
0
1.7k
サーキットブレーカー 〜 有料契約店舗数 国内 No.1 ECサービスに神を宿す 〜 / pepabo_ec_tech_mtg01
akihito_nakano
1
3.9k
並列処理で消耗しているかたへ - Snidel のご紹介 -
akihito_nakano
4
3.4k
Other Decks in Programming
See All in Programming
functionalなアプローチで動的要素を排除する
ryopeko
1
210
shadcn/uiを使ってReactでの開発を加速させよう!
lef237
0
300
はてなにおけるfujiwara-wareの活用やecspressoのCI/CD構成 / Fujiwara Tech Conference 2025
cohalz
3
2.7k
PicoRubyと暮らす、シェアハウスハック
ryosk7
0
220
ErdMap: Thinking about a map for Rails applications
makicamel
1
650
Flatt Security XSS Challenge 解答・解説
flatt_security
0
730
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
9
2.4k
.NETでOBS Studio操作してみたけど…… / Operating OBS Studio by .NET
skasweb
0
120
HTML/CSS超絶浅い説明
yuki0329
0
190
盆栽転じて家具となる / Bonsai and Furnitures
aereal
0
1.9k
PHPカンファレンス 2024|共創を加速するための若手の技術挑戦
weddingpark
0
140
Package Traits
ikesyo
1
210
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
244
12k
Statistics for Hackers
jakevdp
797
220k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Bash Introduction
62gerente
610
210k
Into the Great Unknown - MozCon
thekraken
34
1.6k
How STYLIGHT went responsive
nonsquared
96
5.3k
Being A Developer After 40
akosma
89
590k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Building Applications with DynamoDB
mza
93
6.2k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
Transcript
தڿਓ(.01&1"#0JOD ʲϖύϘºϓϨΠυʳ5FDI.FFUVQʙࣗಈςετɾ$*ฤʙ ฒߦɾฒྻॲཧͷςετ͍͠
8&#ΞϓϦέʔγϣϯΤϯδχΞ ػೳ։ൃνʔϜ தڿਓ ͖͋ͬʔ !/","/0@"LJIJUP &$ࣄۀ෦Χϥʔϛʔγϣοϓάϧʔϓ IUUQBDLJOUPTIHJUIVCJP
Χϥʔϛʔγϣοϓ
܅ϖύϘͰಇ͔ͳ͍͔ʁ ࠷৽ͷ࠾༻ใΛνΣοΫˠ !QC@SFDSVJU
ฒߦɾฒྻॲཧͷςετ
ฒߦɾฒྻॲཧʁ Կʹ͍ͭͯͷൃදͳͷ͔Πϝʔδ͍͢͠Α͏ʹ ͡Ίʹ໌֬ʹ͓͖ͯ͠·͢ʂ
ฒߦɺฒྻɺඇಉظɺࢄʜ ϚϧνεϨου Ϛϧνϓϩηε ͪ͜Βʹ͍ͭͯͷൃදͰ͢ ཧతʹಠཱͨ͠ෳͷϊʔυͰ ฒߦɾฒྻ
ͳͥฒߦɾฒྻॲཧΛςʔϚʹʁ
ฒߦɾฒྻॲཧɹ׆༻ͷྲྀΕ wϓϩηοαߴԽ͔ΒϚϧνίΞ wϦιʔεΛޮతʹ׆༻͢ΔͨΊʹฒߦɾฒྻॲཧ͕͞ΕΔ wฒߦɾฒྻॲཧ͕ಘҙͳݴޠ͕ʹ w3VCZձٞͰ(VJME͕ఏҊ͞Εͨ
1)1
4OJEFM εφΠσϧ IUUQTHJUIVCDPNBDLJOUPTITOJEFM खܰʹϚϧνϓϩηεͰ͖Δ ࢠϓϩηεͷॲཧ݁ՌΛड͚औΕΔ ϚελʔʗϫʔΧʔϞσϧ 1)1Ҏ্
ϓϧϦΫΤετܴʂ IUUQTHJUIVCDPNBDLJOUPTITOJEFM
ຊ
ฒߦɾฒྻॲཧͷ͠͞Λςετͷ؍Ͱ
λΠϛϯά
ϓϩμΫτίʔυ class Foo def run Thread.new do # ৭ʑ @done
= true end # ৭ʑ end end
ςετίʔυ class FooTest < Test::Unit::TestCase def test_run (foo = Foo.new).run
sleep 1 assert_true foo.done end end
ςετίʔυ class FooTest < Test::Unit::TestCase def test_run (foo = Foo.new).run
sleep 1 assert_true foo.done end end ෆ҆ఆ
εςοϓ ॲཧΛΓग़͢
ϓϩμΫτίʔυ͜ΕΛʜ class Foo def run Thread.new do # ৭ʑ @done
= true end # ৭ʑ end end
ϓϩμΫτίʔυ͜͏ʂ class Foo def run Thread.new do # ৭ʑ @done
= self.do end # ৭ʑ end def do # ৭ʑ true end end
ςετίʔυ͜ΕΛʜ class FooTest < Test::Unit::TestCase def test_run (foo = Foo.new).run
sleep 1 assert_true foo.done end end
ςετίʔυ͜͏ʂ class FooTest < Test::Unit::TestCase def test_run (foo = Foo.new).run
sleep 1 assert_true foo.done end def test_do assert_true Foo.new.do end end
ඇಉظͳ෦Λ ಉظॲཧͱͯ͠ςετͰ͖ΔΑ͏ʹͳͬͨʂ
)VNCMF0CKFDUύλʔϯ Y6OJU5FTU1BUUFSOT$I
͕͔ͩ͠͠
ςετίʔυ·ͩղܾ͍ͯ͠ͳ͍ʜ class FooTest < Test::Unit::TestCase def test_run (foo = Foo.new).run
sleep 1 assert_true foo.done end def test_do assert_true Foo.new.do end end ෆ҆ఆ
εςοϓ ϝοηʔδύογϯάΛ͏
lϝϞϦͷ্ͰγΣΞ͢ΔͷͰͳ͘ ίϛϡχέʔγϣϯͰγΣΞ͢Δz 4J[FE2VFVFΛͬͯ ͦΕͬΆ͍͜ͱΛΓ·͢
ϓϩμΫτίʔυ͜ΕΛʜ class Foo def run Thread.new do # ৭ʑ @done
= self.do end # ৭ʑ end def do # ৭ʑ true end end
ϓϩμΫτίʔυ͜͏ʂ class Foo def initialize @done = SizedQueue.new(1) end def
run Thread.new do # ৭ʑ @done << self.do end # ৭ʑ end … (ུ) … end
ςετίʔυ͜ΕΛʜ class FooTest < Test::Unit::TestCase def test_run (foo = Foo.new).run
sleep 1 assert_true foo.done end def test_do assert_true Foo.new.do end end
ςετίʔυ͜͏ʂ class FooTest < Test::Unit::TestCase def test_run (foo = Foo.new).run
assert_true foo.done.pop end def test_do assert_true Foo.new.do end end
λΠϛϯά ղܾʂ
ଞʹ w εϥΠυͰ൚༻తͳςΫχοΫͷ͝հͰ͕ͨ͠ w ݴޠϑϨʔϜϫʔΫ͕ఏڙ͢Δศརػೳ͋Γ·͢ w ྫ(Pݴޠͷ3BDF%FUFDUPS
·ͱΊ
·ͱΊ w ฒߦɾฒྻॲཧͷ͠͞ʹςετͰର߅Ͱ͖Δ w ಛ༗ͷϓϥΫςΟε͕͋Δ w ݟΛڞ༗͍͖ͯ͠·͠ΐ͏ʂʂ̍