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
300
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
55
Multithreading using NSOperation - 2
izeeshan
0
94
Proxy Server
izeeshan
1
380
Other Decks in Programming
See All in Programming
詳細の決定を遅らせつつ実装を早くする
shimabox
1
1.3k
CSC509 Lecture 11
javiergs
PRO
0
310
GeistFabrik and AI-augmented software development
adewale
PRO
0
120
CloudflareのSandbox SDKを試してみた
syumai
0
170
Eloquentを使ってどこまでコードの治安を保てるのか?を新人が考察してみた
itokoh0405
0
3.2k
知られているようで知られていない JavaScriptの仕様 4選
syumai
0
630
Stay Hacker 〜九州で生まれ、Perlに出会い、コミュニティで育つ〜
pyama86
2
2.3k
開発生産性が組織文化になるまでの軌跡
tonegawa07
0
180
CSC509 Lecture 13
javiergs
PRO
0
260
TVerのWeb内製化 - 開発スピードと品質を両立させるまでの道のり
techtver
PRO
3
1.1k
Bakuraku E2E Scenario Test System Architecture #bakuraku_qa_study
teyamagu
PRO
0
780
JJUG CCC 2025 Fall: Virtual Thread Deep Dive
ternbusty
3
470
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
432
66k
The Invisible Side of Design
smashingmag
302
51k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.8k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
Fireside Chat
paigeccino
41
3.7k
Being A Developer After 40
akosma
91
590k
A better future with KSS
kneath
239
18k
Designing for humans not robots
tammielis
254
26k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
Mobile First: as difficult as doing things right
swwweet
225
10k
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