Limitations of Java multithreaded programming precedence

Source: Internet
Author: User

limitations of Java multithreaded programming precedence

restricting thread priority and scheduling

Brother Lian

java The threading model involves thread priorities that can be dynamically changed. In essence, the priority of a thread is from 1 to 10 JVM java support 10 priority, the base-level operating system support may be much less priority, which can cause some confusion. Therefore, you can only use the priority as a very coarse tool. The final control can be accomplished by judicious use of the yield () function. In general, do not rely on thread precedence to control the state of threads.

Summary

This article describes the How threads are used in Java programs. More important issues like whether threading should be used on a large program depends on the application at hand. One way to decide whether to use multithreading in your application is to estimate the amount of code that can be run in parallel. And remember the following points:

using multithreading does not increase CPU capacity. However, if the local thread implementation of the JVM is used, different threads can run concurrently on different processors (in multi- CPU machines), thereby making the multi- CPU machines are fully utilized.

If the application is computationally intensive and is subject to CPU functionality, only a multi- CPU machine can benefit from more threads.

multithreading is usually advantageous when an application must wait for slow resources, such as a network connection or a database connection, or when the application is non-interactive.

based on Internet software has to be multithreaded; otherwise, users will feel the application is unresponsive. For example, when developing a server to support a large number of clients, multithreading can make programming easier. In this case, each thread can serve a different customer or group of customers, thus shortening the response time.

Some programmers may have Threads are used in C and other languages, and there is no language support for threads in those languages. These programmers can often be made to lose confidence in threads.


Limitations of Java multithreaded programming precedence

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.