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
Grand Central Dispatch
Search
nghialv
May 20, 2014
Programming
180
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Grand Central Dispatch
nghialv
May 20, 2014
More Decks by nghialv
See All by nghialv
How LLMs Actually Work
nghialv
0
30
Presentation for CA.go
nghialv
0
130
A consistent delivery process with GitOps style for any application on any platform
nghialv
0
550
How it works - 1.1 - What happens when you run kubectl apply command
nghialv
0
1.1k
Why and how we build a unified CD system
nghialv
0
370
PipeCD at CyberAgent
nghialv
2
1.2k
Introdution_to_PipeCD.pdf
nghialv
2
750
The Journey of Software Delivery
nghialv
4
470
Monitoring at AbemaTV
nghialv
18
12k
Other Decks in Programming
See All in Programming
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
160
symfony/aiとlaravel/boost
77web
0
120
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
310
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
230
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
150
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
150
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
100
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
200
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
1.1k
AI がコードを書く時代における新卒エンジニアの仕事風景 (2026) / New Graduate Engineers in the Era of AI Coding (2026)
sushichan044
0
220
関数型プログラミングのメリットって何だろう?
wanko_it
0
160
分散システム、なんですぐ死んでしまうん?耐障害性を高めたいあなたのためのレジリエンスパターン入門
mshibuya
7
5.7k
Featured
See All Featured
Embracing the Ebb and Flow
colly
88
5.1k
Designing for humans not robots
tammielis
254
26k
How STYLIGHT went responsive
nonsquared
100
6.2k
Fireside Chat
paigeccino
42
4k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
It's Worth the Effort
3n
188
29k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
290
ラッコキーワード サービス紹介資料
rakko
1
3.9M
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
180
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6k
Ethics towards AI in product and experience design
skipperchong
2
330
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Transcript
[iOS multithreading:GCD];
• Multithreading in iOS • Grand Central Dispatch • Queues
• Example
Multithreading in iOS
• Pthreads : C-based interface for creating and manipulating threads
• NSThread : Cocoa threads • Grand Central Dispatch : a lightweight multithreading engine developed by Apple Inc • NSOperation : wrapper for task
Pthreads NSThreads GCD NSOperation complexity low high abstraction level low
high
Grand Central Dispatch
What is GCD? • A lightweight multithreading engine • Uses
a thread pool • Automatically optimizes threading • Scheduling of tasks • Uses look-free exclusion rather than mutual exclusion
• define the tasks • block or function • add
them to an appropriate dispatch queue dispatch_async(queue, ^{ some_async_work(); });
thread thread thread Queue based task task task task task
queue task task task task task queue task task task
Queue types • Serial Queues • only one task running
at a time • user queue or main queue • Concurrent Queue • tasks started in order but run concurrently • 3 priority levels: HIGHT, DEFAULT, LOW
Frequently Used APIs • dispatch_async(queue, block) • dispatch_once(queue, block) •
dispatch_apply(iterations, queue, block) • dispatch_group_async(group, queue, block)
Example
Palindromic words • palindromic words - ճจ • is a
word that reads the same forward as it does backward : “radar” • problem • count the palindromic words in a dictionary radar wrong way yaw result = 3
for (size_t index = 0; index < Words.count; index++) {
NSString *word = [Words objectAtIndex:index]; NSString *reverseString = [self reverseString:word]; if([word caseInsensitiveCompare:reverseString] == NSOrderedSame) { self.palindromicCount++; } else { for (size_t i = index + 1; i < Words.count - 1; i++) { NSString *secondWord = [Words objectAtIndex:i]; if([reverseString caseInsensitiveCompare:secondWord] == NSOrderedSame) { self.palindromicCount += 2; break; } } } }; dispatch_apply(Words.count, queue, ^(size_t index) { NSString *word = [Words objectAtIndex:index]; NSString *reverseString = [self reverseString:word]; if([word caseInsensitiveCompare:reverseString] == NSOrderedSame) { self.palindromicCount++; } else { for (size_t i = index + 1; i < Words.count - 1; i++) { NSString *secondWord = [Words objectAtIndex:i]; if([reverseString caseInsensitiveCompare:secondWord] == NSOrderedSame) { self.palindromicCount += 2; break; } } } });
for (size_t index = 0; index < Words.count; index++) {
NSString *word = [Words objectAtIndex:index]; NSString *reverseString = [self reverseString:word]; if([word caseInsensitiveCompare:reverseString] == NSOrderedSame) { self.palindromicCount++; } else { for (size_t i = index + 1; i < Words.count - 1; i++) { NSString *secondWord = [Words objectAtIndex:i]; if([reverseString caseInsensitiveCompare:secondWord] == NSOrderedSame) { self.palindromicCount += 2; break; } } } }; dispatch_apply(Words.count, queue, ^(size_t index) { NSString *word = [Words objectAtIndex:index]; NSString *reverseString = [self reverseString:word]; if([word caseInsensitiveCompare:reverseString] == NSOrderedSame) { self.palindromicCount++; } else { for (size_t i = index + 1; i < Words.count - 1; i++) { NSString *secondWord = [Words objectAtIndex:i]; if([reverseString caseInsensitiveCompare:secondWord] == NSOrderedSame) { self.palindromicCount += 2; break; } } } });
Results • iPhone 5 : dual-core A6 chip • dictionary
: 25000 words 1.86 times faster Sequential GCD 274s 147s