-
Book Overview & Buying
-
Table Of Contents
Mastering Swift 6 - Seventh Edition
By :
We often hear concurrency and parallelism used interchangeably; however, it is important to understand the difference between them.
Concurrency is the concept of multiple tasks starting, running, and completing within the same time period. This does not necessarily mean that the tasks are executed simultaneously. In fact, in order for tasks to be run simultaneously, our application needs to be running on a multicore or multiprocessor system. Concurrency allows us to share the processor or cores among multiple tasks, but a single core can only execute one task at any given time.
Parallelism is the concept of two or more tasks running simultaneously. Since each core of our processor can only execute one task at a time, the number of tasks executing simultaneously (in parallel) is limited to the number of cores within our processors and/or the number of processors that we have. As an example, if we have a four-core processor, then we are limited to...