The difference between a Java process and a thread

Source: Internet
Author: User

Each process has a single piece of memory space, and an application can start multiple processes at the same time. Like a browser, opening a browser is equivalent to starting a process.

A thread refers to an execution process in a process that can contain multiple threads.

Each process requires the operating system to allocate a separate memory space, and multiple threads in the same process share the space, that is, resources such as shared memory.

. Advantages and Disadvantages

Threads and processes have advantages and disadvantages in use:

The thread execution cost is small, but it is not conducive to the management and protection of resources;

And the process is the opposite.

At the same time, threads are suitable for running on SMP machines, while processes can be migrated across machines.

Note:SMP is (symmetrical multi-processing) shorthand, usually referred to as the dual CPU system, is actually the most common symmetric multiprocessor system, commonly known as 2-way symmetric multi-processing.

The difference between a Java process and 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.