- Mastering Concurrency in Python
- Quan Nguyen
- 210字
- 2021-06-10 19:23:54
Concurrent versus parallel
At this point, if you have had some experience in parallel programming, you might be wondering whether concurrency is any different from parallelism. The key difference between concurrent and parallel programming is that, while in parallel programs there are a number of processing flows (mainly CPUs and cores) working independently all at once, there might be different processing flows (mostly threads) accessing and using a shared resource at the same time in concurrent programs.
Since this shared resource can be read and overwritten by any of the different processing flows, some form of coordination is required at times, when the tasks that need to be executed are not entirely independent from one another. In other words, it is important for some tasks to be executed after the others, to ensure that the programs will produce the correct results.
The preceding figure illustrates the difference between concurrency and parallelism: while in the upper section, parallel activities (in this case, cars) that do not interact with each other can run at the same time, in the lower section, some tasks have to wait for others to finish before they can be executed.
We will look at more examples of these distinctions later on.
- WildFly:New Features
- Google Flutter Mobile Development Quick Start Guide
- 數據庫系統教程(第2版)
- Raspberry Pi Networking Cookbook(Second Edition)
- 程序員數學:用Python學透線性代數和微積分
- OpenNI Cookbook
- 深入淺出RxJS
- 數據結構與算法分析(C++語言版)
- Developing SSRS Reports for Dynamics AX
- ArcGIS for Desktop Cookbook
- Software-Defined Networking with OpenFlow(Second Edition)
- Ionic3與CodePush初探:支持跨平臺與熱更新的App開發技術
- JavaWeb從入門到精通(視頻實戰版)
- React.js實戰
- Improving your Penetration Testing Skills