----> 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