4 ms·
Concurrency = logical simultaneity. Parallelism = physical simultaneity. When the former is mapped to the latter we encounter scalability. Some examples: Unix c
by omazurov 8y ago
Concurrency = logical simultaneity.
Parallelism = physical simultaneity.
When the former is mapped to the latter we encounter scalability. Some examples:
Unix commands (cp, grep, awk, sort) do not scale on multi-core systems due to total lack of concurrency in their implementation.
Quick sort scales worse than merge sort because the latter allows for more concurrency.
A parallel program using a barrier between outer loop iterations (f.e. matrix inversion, or computational partial differential equations) won't scale well because barriers are antithetical to concurrency.
- pmarin 8y ago>Unix commands (cp, grep, awk, sort) do not scale on multi-core systems due to total lack of concurrency in their implementation. This is not true. Unix commands are designed to be used in pipelines. Unix is actually the easiest way to run things in parallel, so easy that people don't even notice.
- dspillett 8y agoThat isn't the individual tools showing concurrency - they are running concurrently due to the way the OS manages processes and pipelines. The overall task has multiple things running concurrently but it doesn't have to[1] and the individual components are doing no concurrency of their own. It has the same effect in many cases because of the buffering built into how pipes are handled, for instance passing the output of gzip through gzip through gzip will happily use most of three cores (if that much CPU time is free at that moment) but try that with commands that need to block such as invocations of sort for example and you'll see that break down. One sort command in your pipeline will tie the whole lot to not scaling much beyond one core[2]. Also pipes and other trickery like xargs/parallel don't help if the task is something like "grep over this large file" - that will only scale over multiple cores at all if your implementation of grep supports a multi-threaded search (and your data is in cache or otherwise in RAM so the process isn't IO-bound). [1] it could queue each and spool the output between to temporary storage, it is so chose [2] note that some implementations of sort, such as the GNU version seen in most (all?) linux distributions, do support their own multi-core use
- omazurov 8y agoDon't confuse individual commands with the operating system, which is highly concurrent. I was very specific in my statement.