Java-Preliminary Understanding-The 12th chapter-Multi-line benefits and drawbacks

Source: Internet
Author: User

One.

Look at the multithreading technology is very good, why not all use multithreading to solve the problem?

Multithreading is a disadvantage, in which is really at the same time executed?

Windows itself is a multitasking operation of the operating system, who is responsible for the execution of the program, CPU. The CPU runs in the memory-responsible program. How does it know to run? The CPU is doing a quick switchover between multiple tasks, particularly fast, as if it were executing more than one program at a time, and in fact there is only a single execution path executing at one point.

When the program is running for a long time, each program is processed by the CPU frequency is slow, it is processed the probability of becoming lower, the final execution of the duration of the extension.

Think about it, can you improve this efficiency? Very simple, 2 CPU is done. 2 CPUs occupy the motherboard space. Multiple CPUs can be executed at the same time in real sense.

Multithreaded technology does help us solve problems that multiple programs need to execute at the same time. We learn the procedure is to solve the problem, all can solve what problem? Simultaneous execution of multiple programs. But it has disadvantages, open more, low efficiency. A lot of threads, too busy to crash. What are the biggest benefits of true dual-core and four-core CPUs? Memory.

CPU switching is random, who depends on it? Time slices.

Fast switching at the same time makes it possible to see multithreaded technology.

Java-Preliminary Understanding-The 12th chapter-Multi-line benefits and drawbacks

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.