-
Book Overview & Buying
-
Table Of Contents
Mastering Swift 6 - Seventh Edition
By :
We started this chapter by explaining the concepts of concurrency and parallelism, which are often confused but have distinct meanings in software development. Concurrency involves managing multiple tasks in overlapping time periods, without them necessarily running simultaneously, while parallelism is running multiple tasks simultaneously.
Next, we discussed how these concepts apply in software development using Swift’s Grand Central Dispatch. GCD organizes tasks into queues, which can be either serial or concurrent. Serial queues handle one task at a time in the order they are added, ideal for tasks that need to be done in sequence. Concurrent queues allow tasks to run simultaneously, speeding up operations that don’t depend on each other.
Choosing between serial and concurrent queues gives us flexibility. Serial queues prevent data issues by ensuring only one task accesses shared resources at a time. Concurrent queues maximize the use of multi-core...