From the course: iOS Development: Threading and Grand Central Dispatch

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Adding multithreading

Adding multithreading

From the course: iOS Development: Threading and Grand Central Dispatch

Start my 1-month free trial

Adding multithreading

- [Instructor] We cannot talk about Grand Central Dispatch without talking about multithreading. UI tasks are run on the main thread. If you try to do any time consuming tasks on the main thread, then your app will freeze or hang, and this is not a good user experience. Suppose a new item just dropped, and everyone is flooding the vendor's website to shop. The servers need to handle different requests from different users. All these requests will be handled by different, unique threads. And when an item is sold out, the users need to be updated on the spot. This is what you call multithreading. Multithreading allows multiple tasks to be executed at the same time. It does so by allowing the processor to create concurrent threads to switch between. The switch happens fast, and that's why you don't notice it. You might think that the two threads you created are executing at the same time, but that's not the case. There are…

Contents