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
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
58
Proxy Server
izeeshan
1
400
Multi-Threading using NSOperation
izeeshan
0
320
Other Decks in Programming
See All in Programming
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
560
🦞OpenClaw works with AWS
licux
1
370
【ディップ|26年新卒研修資料】OpenAPI/Swagger REST API研修
dip_tech
PRO
0
170
Import assertionsが消えた日~ECMAScriptの仕様はどう決まり、なぜ覆るのか~
bicstone
2
190
次世代リンターで探る、tsgo 時代における型認識カスタムルールの現実解
ytakahashii
0
240
ソースコード→AST→オペコード、の旅を覗いてみる
o0h
PRO
1
140
Structured Concurrency, Scoped Values and Joiners in the JDK 25 26 27
josepaumard
1
150
Are We Really Coding 10× Faster with AI?
kohzas
0
190
My daily life on Ruby
a_matsuda
3
410
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
450
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
2
190
いつか誰かが、と思っていた フロントエンド刷新5年間の実践知
kiichisugihara
1
280
Featured
See All Featured
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
Ruling the World: When Life Gets Gamed
codingconduct
0
230
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
ラッコキーワード サービス紹介資料
rakko
1
3.3M
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
We Have a Design System, Now What?
morganepeng
55
8.1k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
AI: The stuff that nobody shows you
jnunemaker
PRO
7
640
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
sira's awesome portfolio website redesign presentation
elsirapls
0
250
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
280
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