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.5k
並行・並列処理のテストは難しい
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
610
平静を保ち、コードを生成せよ 〜 OpenAPI Generator誕生の背景と軌跡 〜 / gunmaweb34
akihito_nakano
25
55k
プライベートAPIのクライアントをいい感じにしたい / pepabo_ec_tech_mtg02
akihito_nakano
0
1.7k
サーキットブレーカー 〜 有料契約店舗数 国内 No.1 ECサービスに神を宿す 〜 / pepabo_ec_tech_mtg01
akihito_nakano
1
4k
並列処理で消耗しているかたへ - Snidel のご紹介 -
akihito_nakano
4
3.5k
Other Decks in Programming
See All in Programming
Road to RubyKaigi: Making Tinny Chiptunes with Ruby
makicamel
4
120
Building Scalable Mobile Projects: Fast Builds, High Reusability and Clear Ownership
cyrilmottier
2
280
リストビュー画面UX改善の振り返り
splcywolf
0
140
状態と共に暮らす:ステートフルへの挑戦
ypresto
1
440
AWSで雰囲気でつくる! VRChatの写真変換ピタゴラスイッチ
anatofuz
0
160
Boost Your Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
1.6k
Unlock the Potential of Swift Code Generation
rockname
0
250
PHP で学ぶ OAuth 入門
azuki
1
190
大LLM時代にこの先生きのこるには-ITエンジニア編
fumiyakume
7
3k
Develop Faster With FrankenPHP
dunglas
2
3.3k
国漢文混用体からHolloまで
minhee
1
190
プロダクト横断分析に役立つ、事前集計しないサマリーテーブル設計
hanon52_
2
440
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
GraphQLとの向き合い方2022年版
quramy
46
14k
Code Review Best Practice
trishagee
67
18k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
Making Projects Easy
brettharned
116
6.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.4k
Product Roadmaps are Hard
iamctodd
PRO
52
11k
KATA
mclloyd
29
14k
Building Applications with DynamoDB
mza
94
6.3k
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 ݟΛڞ༗͍͖ͯ͠·͠ΐ͏ʂʂ̍