Concurrency model-basic concepts and basic concepts

Source: Internet
Author: User

Concurrency model-basic concepts and basic concepts

We often hear about programming from school a long time ago.Concurrent ProgrammingOccasionally, we can hear parallel expressions, but many of us are not very clear.ConcurrencyAndParallelWhat are the specific differences? I believe we write all of them when we first started learning programming languages.Serial ProgramStep by step.Concurrent programIt is not prone to errors, but it is far inferior in performanceConcurrencyThere is also a highly fault-tolerant concurrency:Distributed Program, Distributed programs are also concurrent programs. They can also be highly fault tolerant and can be deployed separately;
Concurrency is essentially different from parallelism.
Concurrency means that a program can only perform one operation at a time, but multiple operations can be performed at different time points;
For example, a person is a multi-threaded species. When you are the only one, you can enable multi-threaded "one side of cooking and playing iPad". However, at a certain point in time, one person can only do one thing, it is impossible for us to play the iPad when we are cooking, and it is impossible for us to play the iPad when we are playing the iPad. We can only play the iPad when we are not doing the stir-fry, only when we put down the iPad in our hands can we stir-fry it, but in terms of time, we still play iPad while cooking. In this way, the fried food may not be good. Haha, just like concurrent programming, there is competition for resources. The competing resources here are hands and eyes. There is a CPU in the computer, and there is a crisis everywhere. It burned out accidentally. Haha!
Parallelism means that several identical operations or several different operations can be performed at the same time point;
For example, if you and your girlfriend are at home, you don't need to cook at this time. You can play iPad when your girlfriend is cooking, when your girlfriend is ready, you can eat it (not a good man). Just as many computers now have multiple CPUs, we can write programs that run on multiple CPUs at the same time with higher concurrency performance, but the premise is that you need to have the conditions (computers with multiple CPUs );
Concurrency is not parallel, sometimes it is also concurrent, sometimes it is just parallel, not concurrency; Concurrency is only used when parallel tasks are multiple tasks, but parallel tasks are only a task;
This series is only for programmingConcurrency Model, Sometimes we talk about parallelism, but the focus is on the concurrency model;

 

This series of articles will mainly talk about the concurrency models: thread and lock models, Actor models, and Go CSP models;

First Article address: Solinx
Http://www.solinx.co/archives/175

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.