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
Multi-Threading using NSOperation
Search
Zeeshan Khan
August 18, 2014
Programming
0
210
Multi-Threading using NSOperation
Zeeshan Khan
August 18, 2014
Tweet
Share
More Decks by Zeeshan Khan
See All by Zeeshan Khan
Core Data Migration
izeeshan
0
38
Multithreading using NSOperation - 2
izeeshan
0
64
Proxy Server
izeeshan
1
320
Other Decks in Programming
See All in Programming
GitLab CI/CD で C#/WPFアプリケーションのテストとインストーラーのビルド・デプロイを自動化する
hacarus
0
450
障害対応を起点としたもっといい開発と運用のサイクル作りのためにできること / Hatena Enginner Seminar #29
polamjag
0
400
PostmanでAPIの動作確認が楽になった話
h455h1
0
180
The Cutting Edge Of Versioning (LambdaConf 2024)
chriskrycho
0
170
WebGLで始める コンピュータグラフィックス入門
heller77
0
330
Apache Hive 4 on Treasure Data
ryukobayashi
1
440
初心者のためのRubyKaigi入門/RubyKaigi Introduction
a_matsuda
10
1.6k
『Railsオワコン』と言われる時代に、なぜブルーモ証券はRailsを選ぶのか
free_world21
1
390
Hanami and htmx
bkuhlmann
0
230
Goのmultiple errorsについて (2024年4月版)
syumai
4
1.2k
Code Reviews
bkuhlmann
4
900
検証も兼ねて個人開発でHonoとかと向き合った話
hanetsuki
1
1.3k
Featured
See All Featured
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
21
1.6k
Making the Leap to Tech Lead
cromwellryan
125
8.5k
Bash Introduction
62gerente
605
210k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
188
16k
Infographics Made Easy
chrislema
238
18k
YesSQL, Process and Tooling at Scale
rocio
165
13k
Into the Great Unknown - MozCon
thekraken
15
1k
Optimising Largest Contentful Paint
csswizardry
13
2.4k
Design by the Numbers
sachag
274
18k
Building a Scalable Design System with Sketch
lauravandoore
457
32k
Transcript
Multi - Threading by zeeshan 1
CPU Why do we have n number of Core(s)? 2
nothing is limitless & every problem has a solution Clock
Speed A time unit 3
Thread ‘Kernel-level’ + ‘Application-level’ Data Structures An application can use
multiple cores by creating multiple threads. 4 Parallel Computation Asynchronous Solution
Key Terms • Process • Thread (Safe / Un-Safe) •
Task • Concurrent / Non-Concurrent • Concurrent vs Parallel 5
NSThread POSIX (Mavericks is 100% POSIX conferment) 6 Life Cycle
Hazard of Threaded Programming • UIKit access • Database access
• Stale result • Cancellation • De-allocation 7
Solutions • Operations (Current Session) • GCD (Next Session) •
Notification Queue • Asynchronous (Hopefully Next to Next Session) • Timers 8
NS Operation to the rescue 9
NS Operations • Manage all threaded code • Model asynchronous
operations • KVO Support • Dependencies • Priorities 10
NS Operation II • Thread Confinement • Completion Block •
Cancellation • Concurrent vs Non-Concurrent • Some Caveats... 11
NS Operation Queue • Simpler, Name it • Add, Ready
& Execute, Cancel | Finish • Pending Operations • Multiple Queues • Threads & Queues 12
NS Operations Queue II • Queue Width • Pause (Suspended)
Queues • Cancellation • KVC Compliant • Add Operation with Blocks 13
NS Operations - Use • Blocks • Concrete sub classes
• Selector • Block • User defined sub classes 14
References: • Multithreading Using NSOperation (http:// izeeshan.wordpress.com/2014/08/17/multi-threading- using-nsoperation/) • Concurrency
Programming Guide • Threading Programming Guide • API References 15
Any Questions? Thank you! @zeeshan_khan http://izeeshan.wordpress.com/ 16
17 @zeeshan_khan