© Wallace Wang 2019
Wallace WangPro iPhone Development with Swift 5https://doi.org/10.1007/978-1-4842-4944-4_4

4. Multithreaded Programming Using Grand Central Dispatch

Wallace Wang1 
(1)
San Diego, CA, USA
 

The next time you pay for groceries in a supermarket, look at the lines at the checkout stands. If there’s only one open checkout stand, there’s likely a long line of customers waiting to pay. That means everyone has to wait their turn before they can leave. However if there are multiple checkout stands open, more customers can pay at the same time and the wait time for everyone is much less. That’s the basic idea behind multithreaded programming.

In the old days of computers, tasks were fairly simple so processors were fast enough to handle them ...

Get Pro iPhone Development with Swift 5: Design and Manage Top Quality Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.