Java thread pool

Source: Internet
Author: User

Multithreading technology mainly solves the problem of multiple threads in the processor unit, which can significantly reduce the idle time of the processor unit and increase the throughput capacity of the processor unit.

Suppose a server takes a task to complete: T1 creates a thread time, T2 the time to execute a task in the thread, T3 destroys the threading time.

if: T1 + T3 is much larger than T2, you can use a thread pool to improve server performance.
A thread pool consists of the following four basic components:
1. Thread pool Manager (ThreadPool): Used to create and manage thread pools, including creating a thread pool, destroying the thread pool, adding new tasks;
2, worker thread (poolworker): Thread pool threads, in the absence of a task in the waiting state, you can cycle the execution of tasks;
3, Task Interface (tasks): Each task must be implemented by the interface for the task of scheduling the execution of tasks, it mainly specifies the entry of the task, the completion of the task after the end of the task, the implementation of the mission status, etc.;
4. Task Queue (Taskqueue): Used to store tasks that are not processed. Provides a buffering mechanism.

Java thread pool

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.