[fpc-pascal] Threading vs Parallelism ?
gpd at gpdnet.co.uk
Fri Mar 31 10:55:56 CEST 2017
> I would offer the following definitions:
> - Parallelism is a (design) concept for expressing collateral actions in which the processing order of the actions is unspecified. They may take place serially or
> contemporaneously in real time, or a mixture of the two.
> - Threads are an implementation mechanism for realising collateral actions within a single processing environment.
> Neither of the above implies multiple CPUs or processing units.
I would agree wholeheartedly with most of that. Parallelism is purely a concept of multiple tasks running at the same time
Threads or processes are just implementations of that concept. Threads tend to be used for related tasks in a single process. Separate processes tend to be used for unrelated or independent tasks. Those are not hard and fast rules.
However, multiple independent compute units must be required for *true* parallelism. On a single processor any tasks running at the same time is just an illusion, normally created by the OS in time slicing between tasks based on certain criteria (priority, I/O, cpu usage etc.). That applies equally to threads or processes
Various languages assist, or purely exist, to make creating multi-tasking easier, but it ultimately all boils down to the same thing.
More information about the fpc-pascal