Article Summary-java Concurrent programming Combat-Introduction

Source: Internet
Author: User

History of Concurrency:

Threading is the simplest way to control and leverage the computational power of multiprocessor systems.

The following factors drive multiple programs to work together: 1. Make full use of computer resources; 2. Ensure multi-user time-sharing fairness; 3. Sometimes it is more convenient to solve problems with multiple programs.

In the early time sharing system, each process is a von Neumann machine.

Finding the balance between sequential and asynchronous execution is the key to making the program efficient.

The presence of threads breaks down processes and is more adaptable to running on multiprocessor systems.

A thread in the same process that achieves good data sharing. However, sharing data between multiple threads can lead to concurrency problems.


Advantages of threading:
The first advantage is the use of multi-core processors.

A second advantage is the simplification of component development.

A third advantage is that the server allocates a thread for each connection from the client and uses synchronous IO, which is an efficient way.

The fourth advantage is to improve the user experience of graphical software and prevent the "freezing" phenomenon from arising.


Risk of threading:
The first risk is that the execution sequence cannot be determined under multithreading, and there is an unexpected situation. Using the Java synchronization mechanism can improve the problem.

The second risk is the case where a deadlock, such as a program, cannot continue.

The third risk is that in multi-threading, thread scheduling and synchronization mechanisms increase resource overhead.

Threads are everywhere:
Sometimes, the code itself is a single thread. But frameworks and components will still introduce multithreading.

Article Summary-java concurrent programming Combat-Introduction

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.