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
Multithreading using NSOperation - 2
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Zeeshan Khan
August 20, 2014
Programming
110
0
Share
Multithreading using NSOperation - 2
Zeeshan Khan
August 20, 2014
More Decks by Zeeshan Khan
See All by Zeeshan Khan
Core Data Migration
izeeshan
0
56
Proxy Server
izeeshan
1
390
Multi-Threading using NSOperation
izeeshan
0
320
Other Decks in Programming
See All in Programming
Server-Side Kotlin LT大会 vol.18 [Kotlin-lspの最新情報と Neovimのlsp設定例]
yasunori0418
1
140
レガシーPHP転生 〜父がドメインエキスパートだったのでDDD+Claude Codeでチート開発します〜
panda_program
0
900
AWS re:Invent 2025の少し振り返り + DevOps AgentとBacklogを連携させてみた
satoshi256kbyte
3
160
ふりがな Deep Dive try! Swift Tokyo 2026
watura
0
210
Nuxt Server Components
wattanx
0
280
Xdebug と IDE による デバッグ実行の仕組みを見る / Exploring-How-Debugging-Works-with-Xdebug-and-an-IDE
shin1x1
0
380
Running Swift without an OS
kishikawakatsumi
0
830
CDK Deployのための ”反響定位”
watany
4
750
JOAI2026 1st solution - heron0519 -
heron0519
0
130
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
220
実用!Hono RPC2026
yodaka
2
190
AI-DLC Deep Dive
yuukiyo
8
3.7k
Featured
See All Featured
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
160
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
340
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
340
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.8k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.1k
What's in a price? How to price your products and services
michaelherold
247
13k
Building Applications with DynamoDB
mza
96
7k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
350
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
210
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Transcript
Multi - Threading using NSOperation by zeeshan 1 Using Blocks
& GCD and Using Asynchronous APIs
• Please point out, if anything is wrong. • Please
stop me & raise your voice, for: • Going too fast... • Not getting anything... • Any doubts... • Any inclusion from your side. 2
Central Processing Unit 3
• Why CPU is in the first slide? • How
early days of computing works? • What do we understand by cores? • How does these came into existence? • How does it effect our system? 4 CPU
nothing is limitless & every problem has a solution Clock
Speed A time unit 5
Clock Speed • What is Clock Speed? • Any problem
with it? • Any solution for that? • How to use these cores? How to take advantage of extra cores? 6
Thread ‘Kernel-level’ + ‘Application-level’ Data Structures An application can use
multiple cores by creating multiple threads. 7 Parallel Computation Asynchronous Solution
Threads • What is Thread? • What are the problems
it solves? (Advantages?) • Does anyone can create thread APIs or any standard follows? • What does Objective C do about thread? 8
Key Terms • Process • Thread • Task (Any diagram?)
• Concurrent / Non-Concurrent • Thread Safe / Thread Un-Safe (Any diagram?) X
NSThread POSIX (Mavericks is 100% POSIX conferment) 9 Life Cycle
NSThread • In which framework is it written? • What
is the lifecycle? • What is it based on? • How can we use it? (Any code?) 10
Is Thread a Problem • It is a right solution?
• What are the cost of using it? • When does problem arise? and Why? • Who gets the burden of it? • How does Thread is different from Process and Task? (Any visual show?) 11
Hazard of Threaded Programming • UIKit access • Database access
• Stale result • Cancellation • De-allocation 12
Solutions • Operations (Current Session) • GCD (Next Session) •
Notification Queue • Asynchronous (Hopefully Next to Next Session) • Timers 13
NS Operation to the rescue 14
NS Operation • When does it introduced? • What is
it actually and how it does? • How to use it? • How many times I can use one operation? • What are the features? 15
NS Operation II • Manage all threaded code • Model
asynchronous operations • KVO Support (Any APIs) • Dependencies (Any APIs) • Priorities (Any APIs) 16
NS Operation III • Thread Confinement • Completion Block (Any
APIs?) • Cancellation • Concurrent vs Non-Concurrent • Some Caveats... 17
NS Operation Queue • Simpler, Name it • Add, Ready
& Execute, Cancel | Finish • Pending Operations (Operations vs OperationCounts) • Multiple Queues • Threads & Queues (How many threads?) 18
NS Operations Queue II • Queue Width (Any APIs?) •
Pause (Suspended) Queues • Cancellation • KVC Compliant (APIs?) • Add Operation with Blocks 19
NS Operations - Use • Blocks • Concrete sub classes
• Selector • Block • User defined sub classes 20
References: • Multithreading Using NSOperation (http:// izeeshan.wordpress.com/2014/08/17/multi-threading- using-nsoperation/) • Threading
Programming Guide • Concurrency Programming Guide • API References (NSOperation and NSOperationQueue) 21
Lets Revise 22 • CPU / Clock Speed • Thread
Solutions and Problems • Process, Thread, Task, Concurrency, • Safe, Un-Safe, Parallel • Operation, Queue,
Demo Use of NS Operation and its queue 23
Any Questions? Thank you! http://izeeshan.wordpress.com/ 24
25 @zeeshan_khan