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
280
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
52
Multithreading using NSOperation - 2
izeeshan
0
80
Proxy Server
izeeshan
1
360
Other Decks in Programming
See All in Programming
「理解」を重視したAI活用開発
fast_doctor
0
210
Fiber Scheduler vs. General-Purpose Parallel Client
hayaokimura
1
170
RubyKaigi Dev Meeting 2025
tenderlove
1
410
エンジニア向けCursor勉強会 @ SmartHR
yukisnow1823
2
8.4k
個人開発の学生アプリが企業譲渡されるまで
akidon0000
0
1.1k
サービスクラスのありがたみを発見したときの思い出 #phpcon_odawara
77web
4
690
Memory API : Patterns, Performance et Cas d'Utilisation
josepaumard
1
150
SwiftUI API Design Lessons
niw
1
300
generative-ai-use-cases(GenU)の推しポイント ~2025年4月版~
hideg
1
320
Make Parsers Compatible Using Automata Learning
makenowjust
2
5.7k
Browser and UI #2 HTML/ARIA
ken7253
2
130
파급효과: From AI to Android Development
l2hyunwoo
0
140
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
69
4.7k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Building an army of robots
kneath
305
45k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.2k
Code Reviewing Like a Champion
maltzj
523
40k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
A designer walks into a library…
pauljervisheath
205
24k
4 Signs Your Business is Dying
shpigford
183
22k
Rebuilding a faster, lazier Slack
samanthasiow
81
8.9k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
178
53k
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