Home > Java > Javagetting Started > body text

A brief overview of java multithreading

王林
Release: 2020-08-15 16:26:37
forward
2318 people have browsed it

A brief overview of java multithreading

1. Threads and processes

(Recommended tutorial: java introductory tutorial)

(1) Process

A process is an independent unit of the system that allocates and calls resources. Each process has its own memory space and system resources;

(2) Thread

Thread: the execution unit of the process, execution path

Single thread: an application The program has only one execution path

Multi-threading: An application has multiple execution paths

What is the meaning of multi-process? ——Improve CPU usage

2. Parallelism and concurrency

Parallelism occurs physically at the same time, which means running multiple programs at the same time at a certain point in time;

Concurrency It occurs logically at the same time, which refers to running multiple programs at the same time within a certain period of time.

(Recommended video tutorial: java course)

3. Is the running principle of Java program and the startup of JVM multi-threaded?

The operating principle of Java program:

Start the JVM by the java command. JVM startup is equivalent to starting a process. Then the process creates a main thread to call the main method.

Is the startup of the JVM virtual machine single-threaded or multi-threaded?

The garbage collection thread must also be started first, otherwise memory overflow will easily occur.

JVM startup starts at least the garbage collection thread and the main thread, so it is multi-threaded.

The above is the detailed content of A brief overview of java multithreading. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template