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
3.9k
並行・並列処理のテストは難しい
Akihito Nakano
October 27, 2016
Tweet
Share
More Decks by Akihito Nakano
See All by Akihito Nakano
OpenAPI Generator Meetup #1
akihito_nakano
1
1k
Libraの現状と技術面をざっくりと / astudy20191114
akihito_nakano
4
980
カート刷新プロジェクトにおけるOpenAPIを活用したコード自動生成の今と明日 / astudy20190419
akihito_nakano
2
540
平静を保ち、コードを生成せよ 〜 OpenAPI Generator誕生の背景と軌跡 〜 / gunmaweb34
akihito_nakano
24
50k
プライベートAPIのクライアントをいい感じにしたい / pepabo_ec_tech_mtg02
akihito_nakano
0
1.6k
サーキットブレーカー 〜 有料契約店舗数 国内 No.1 ECサービスに神を宿す 〜 / pepabo_ec_tech_mtg01
akihito_nakano
1
3.5k
並列処理で消耗しているかたへ - Snidel のご紹介 -
akihito_nakano
4
3.2k
Other Decks in Programming
See All in Programming
RubyVM を PHP で実装する 〜Hello World を出力するまで〜
memory1994
PRO
1
490
The Future of C++ Interoperability: Insights from Porting a Game to Swift
teamhimeh
0
280
Understanding Ast By Looking
inouehi
0
120
Data Contracts In Practice With Debezium and Apache Flink (Kafka Summit London)
gunnarmorling
2
280
オブジェクト指向は必要なのか / Is object-oriented needed?
kishida
27
19k
とにかくHTTP3をライトニングに話す / Anyway, I'll talk to Lightning about HTTP3.
seike460
PRO
0
120
上手な探索的テストとその上達方法について
matsu802
4
660
チームでモデリングを育てるうえで 考えたこと・気づいたこと / Cultivating Modeling in Teams: Thoughts and Insights
mackey0225
5
2.4k
CSRF対策のやり方、そろそろアップデートしませんか / Update your knowledge of CSRF protection
hiro_y
25
15k
コミュニティに参加したことで起きた変化
ohmori_yusuke
3
130
Honoとhtmx
yusukebe
6
1.2k
ここ1~2年くらいで 使えるようになった(主要ブラウザーの最新版 がすべて対応した ) ウェブの新機能について ランダムに喋る!
myzkyy
9
6.5k
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
124
32k
Bash Introduction
62gerente
604
210k
The MySQL Ecosystem @ GitHub 2015
samlambert
242
12k
The Invisible Customer
myddelton
114
12k
Why You Should Never Use an ORM
jnunemaker
PRO
50
8.6k
The World Runs on Bad Software
bkeepers
PRO
60
6.6k
How STYLIGHT went responsive
nonsquared
92
4.7k
Code Reviewing Like a Champion
maltzj
512
39k
Atom: Resistance is Futile
akmur
258
25k
Why Our Code Smells
bkeepers
PRO
330
56k
The Art of Programming - Codeland 2020
erikaheidi
40
12k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
225
51k
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 ݟΛڞ༗͍͖ͯ͠·͠ΐ͏ʂʂ̍