Serialism, parallelism, virtual parallelism and concurrency and iOS

Alcivanio (Swift)
3 min readJul 29, 2019

This article is part of a compilation that aims to explain better how CGD works and how to better use it. Here we’re going into a list of popular terminologies when it comes to multi-threading systems.

The way how work is processed depends of a set of things, such as the hardware, operational system, compiler, etc. The combination of those components will create a path the hardware will follow to produce the expected result. When we talk in a processor level, works can be computed by one, two or more processors or cores. It changes how fast a work will be done and how it will be managed. A developer usually doesn’t has any control of which core/processor will be used to process the work, the operational system is in charge of that.

iOS is an operational system inherently concurrent, which allow developers to create fluid apps that execute tasks in background while the user interact with the interface. There is some ways to create a processor that process multiple tasks at the same time. Well, to be honest, sometimes the tasks aren’t processed at the same time. We’re going to discuss above the strategies that can be implemented in order to produce this result.

Serialism is the traditional way of doing computing. Which means that the processor or the system will be executing just one work by time, and the next one will start execution only after the end of the current. The order of the tasks to be dispatched to the processor depends of the strategy used in the implementation. We’re not going deeper on that, since with serialism usually we can’t create this illusion of multiple tasks being executed at the same time, well, because they aren’t executed at the same time.

Parallelism is a type of computation in which many calculations or the execution of processes are carried out simultaneously[1]. Bringing this definition to our real word, it means that our computer has more than one core, and we’re able to execute tasks on both cores simultaneously.

Virtual parallelism is when we fake parallelism, which means, having just one available core and more than one task, we split those tasks in minor tasks and use techniques as time slicing in order to make it feels as they’re being executed in the same time.

Concurrency, according to Apple is the notion of multiple things happening at the same time[2]. Bringing it to our world, it’s basically a more abstract way of talk about parallelism and virtual parallelism. Both are contained on concurrency. Both can happen on iOS when it comes to concurrency. And you have not real control if your task will be executed in a parallel or virtual-parallel way.

After getting into this list, is easy to deduce that iPhone X, for example, that has 6 cores in it’s CPU, is a concurrent system, and it achieves this concurrency by parallelism and virtual parallelism.

References

[1] Gottlieb, Allan; Almasi, George S. (1989). Highly parallel computing. Redwood City, Calif.: Benjamin/Cummings. ISBN 0–8053–0177–1.

[2]https://developer.apple.com/library/archive/documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html

--

--

Alcivanio (Swift)

Computer Engineer + iOS Engineer. I am interested in Swift, Kotlin, Firebase, Data Structures, ASO & On Solving Real World Problems.