Java Multi-thread: creating overhead to open a thread

Source: Internet
Author: User

----> About time, creating thread usage is to request resources directly to the system, where the system functions are called to allocate resources.
----> About resources, Java thread stacks memory is in the Java heap, so is not controlled by Java, only by the system resource constraints, the default thread stack size of a thread is 1M (when this can be set by setting the-xss property settings, but pay attention to the stack overflow problem), However, if each user request to create a new thread, the 1024 user ray thread occupies 1 g of memory, if the system is relatively large, suddenly system resources are not enough, and finally the program collapsed.
---> For the operating system, the cost of creating a thread is very expensive, it needs to allocate memory, scheduling, while the thread switch to perform memory paging, the CPU cache is emptied, switching back to the time to re-read information from memory, destroying the data locality.

Java Multi-thread: creating overhead to open a thread

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.