Java------multithreading overview

Source: Internet
Author: User

Multithreading Overview:

Processes and threads are the two essential modes of operation in a modern operating system. There can be multiple processes in the operating system, including system processes (processes established internally by the operating system) and user processes (processes created by the user), and multiple threads in a process.


The process can be simply understood as an ongoing program, and when we open the Task Manager we can see the process.


A thread is the smallest execution unit of a program, and a multithreaded program means that one application has the ability to perform two or more tasks at the same time.

A thread is the content of a process, and a process has at least one thread.



the threading mechanism of the Java language is based on the thread of the host operating system, which wraps the threading mechanism provided by the host operating system as a language-level mechanism for the programmer to use. On the one hand, the programmer provides a simple and consistent, platform-independent multithreaded programming interface, on the other hand, for programmers to shield the host operating system threading technical details, so that Java programmers do not have to care how to map the Java Language threading mechanism to the host operating system line libraries, This task is completely done by the Java virtual machine.



Within the JVM, a program's multitasking is implemented through threads. When you run a Java application with a Java command, a JVM process is started. In a JVM environment, the user thread runs in the form of threads.



The meaning of multi-threaded existence:



The application of multi-thread programming technology can give full play to the "instruction level parallel execution" advantage of multicore CPU, so as to achieve the effect of "threading-level concurrency Running".

What do you mean, I think that is the CPU in a fast switch between multiple threads, run this thread for a while, then run that thread for a while, so that the two applications on the computer appear to be running "at the same time", but it is not, just because the CPU switching speed too fast, so that we "look" is running simultaneously.

Java------multithreading overview

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.