Java Concurrency Tool Learning 01 process and thread Foundation

Source: Internet
Author: User

In concurrent programming, there are two basic units: processes and threads. Concurrent programming is primarily for threading, and of course, the process is also very important.
The operating system contains many processes and threads. Even in a single-core system (systems, which has a single execution core), the monolithic system actually has only one thread running, which implements thread concurrency through time slices.
With the development of technology, multi-processor system or multi-core processor system becomes more and more common, which makes the system processing concurrency greatly improved, of course, the single-processor single-core system can also have concurrency.

Process:
Each process is useful for a separate execution environment. Each process has a private, complete set of running resources (especially private memory space).
Some people often think of an application as a process, and the application should accurately be a collection of multiple collaborative processes. Most systems support process communication (Ipc:inter process communication), such as through a pipe (pipe) or socket socket (socket). IPC can not only realize the communication of internal process of the system, but also realize the communication of process between systems.
When the Java virtual Runtime is running, most of the time there is only one single process, and you can also create a new process through Processbuilder.

Thread:
Threads are also known as lightweight processes (lightweight processes). The process and thread headers provide the execution environment, but creating a thread consumes less resources than building a process.
Threads run inside the process, with at least one thread per process. The resources of the owning process are shared between threads, including memory, files, and so on. This makes the program run more efficiently and there are many potential problems with a single page.
Multithreading is the basic feature of Java, and from a developer's point of view, each Java project starts with only one thread, that is, the main path. Create a new thread through the main thread.

Java Concurrency Tool Learning 01 process and thread Foundation

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.