Java Virtual machine 6: Garbage collection (GC)-2 (differences in parallelism and concurrency)

Source: Internet
Author: User

1. Concurrent programming

These two nouns are concepts in concurrent programming and are defined under the model of concurrent programming:

  • Concurrency: It is on the same CPU at the same time (not really at the same time, but at the same time, because the CPU is switching between multiple programs) to run multiple programs.
  • Parallel: is multiple or simultaneous one CPU, each CPU runs a program.

For example, concurrent, like a person (CPU) Feed 2 Children (program), rotate each person to feed a mouthful, on the surface of two children are eating.
In parallel, 2 people feed 2 children, and two children eat at the same time.

Parallelism and concurrency are not two mutually exclusive concepts.

2. Under the garbage collector

In the context of talking about garbage collectors, you can understand these two nouns:

1. Parallel parallel

Multiple garbage collection threads work in parallel, but the user thread is still waiting

2. Concurrent concurrent

means that the user thread executes concurrently with the garbage collection thread (but not necessarily in parallel, may be alternately executed), the user program continues to run, and the garbage collector runs on the other CPU

Reprint Address: http://www.cnblogs.com/xrq730/p/4839245.html

Java Virtual machine 6: Garbage collection (GC)-2 (differences in parallelism and concurrency)

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.