Java Summary of Multi-threading

Source: Internet
Author: User

1. The purpose of introducing threads and processes

The purpose of introducing processes into the OS is to enable more programs to execute concurrently to increase the utilization of resources and the amount of the system.

Threading is introduced to reduce the time spent by the program in concurrent execution, which is better concurrency for the OS.

2. The difference between a process and a thread

Process is a process of dynamic execution of a program, it needs to undergo a complete process from code load code execution to completion, multi-threaded operating system can run multiple processes at the same time (that is, running programs), because the CPU has a time-sharing mechanism, so each process can be recycled to get their own cup of the chip. Because the CPU executes very fast, all programs seem to run "simultaneously" (jargon is called "concurrency").

A thread is an entity of a process that is the basic unit of CPU dispatch and allocation, which is a smaller unit than a thread that can run independently. A thread does not own system resources at all, it has only a few resources that are essential in the run, but it can share all the resources owned by the process with other threads in the same process.

Java Summary of Multi-threading

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.