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
Zeeshan Khan
August 20, 2014
Programming
0
100
Multithreading using NSOperation - 2
Zeeshan Khan
August 20, 2014
Tweet
Share
More Decks by Zeeshan Khan
See All by Zeeshan Khan
Core Data Migration
izeeshan
0
55
Proxy Server
izeeshan
1
390
Multi-Threading using NSOperation
izeeshan
0
310
Other Decks in Programming
See All in Programming
AI巻き込み型コードレビューのススメ
nealle
1
150
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
250
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
450
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
380
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
260
Architectural Extensions
denyspoltorak
0
280
SourceGeneratorのススメ
htkym
0
190
「ブロックテーマでは再現できない」は本当か?
inc2734
0
890
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
260
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
3.5k
CSC307 Lecture 04
javiergs
PRO
0
660
Featured
See All Featured
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
110
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
ラッコキーワード サービス紹介資料
rakko
1
2.2M
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
49
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Exploring anti-patterns in Rails
aemeredith
2
250
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.5k
Amusing Abliteration
ianozsvald
0
97
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Visualization
eitanlees
150
17k
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