4 ms·
How would a distinction between concurrency and parallelism benefit the modeling of program logic? The programming language incorporates thread+locking mechani
by maxmcd 1y ago
How would a distinction between concurrency and parallelism benefit the modeling of program logic?
The programming language incorporates thread+locking mechanisms.
- Kranar 1y agoParallelism introduces additional hazards such as data races, which are not present in concurrent code that lacks parallelism.
- seanw444 1y agoI'm of the opinion that we chose the wrong term for concurrency. Concurrency means multiple things going on simultaneously, which is not what's happening with our version of it. Only one thing is happening at any given time, but the tasks are being multiplexed on a shared resource. Parallelism = concurrency, "concurrency" = multiplexing. Maybe there's a more appropriate term than multiplexing, but I think that's certainly better than concurrency at describing it.
- Kranar 1y agoYes that's true the terms are confusing but nevertheless it's important. For example having read through some of this book it's still not clear if this book involves parallelism, especially since the book compares itself to Python, which does not involve parallelism without running C extensions.
- Jtsummers 1y agoData races and other race conditions are still present in concurrent systems without parallelism (of the actually executing at the same time sense, like with multiple cores). If they weren't, we wouldn't need most uses of mutexes and semaphores on single core processors. As the book gets into, concurrency is about multiple tasks that are arbitrarily interleaved with each other. That interleaving is why you can have data races and other errors even in a single core system.
- Kranar 1y agoData races are not possible on a single core system.
- convolvatron 1y agothey are entirely possible assuming preemptive scheduling
- Kranar 1y agoYes that's true and I was wrong to say otherwise. A data race can happen with preemptive multithreading on data whose size exceeds what the platform guarantees to access atomically, typically the word size. A more accurate statement would be that parallelism introduces additional possibilities for data races than those possible from concurrent execution (without parallelism).
- deleted 1y ago[deleted]
- maxmcd 1y agoData races are covered: https://harmony.cs.cornell.edu/book/#sec-57 https://harmony.cs.cornell.edu/book/#sec-57 Threads+locking introduce data race issues into Harmony's model. As far as I can tell.