Overview of new Lisboa source building and Java multithreading process

Source: Internet
Author: User

1: To understand multi-threading, you must first understand the thread, and to understand the thread, you must first understand the process, because the thread is dependent on the process and exists.

2: What is a process?
Through the Task Manager we see the existence of the process.
By observing, we find that only the running program will appear. New Lisboa Source Building qq:2152876294 website diguaym.com

进程:就是正在运行的程序。进程是系统进行资源分配和调用的独立单位。每一个进程都有它自己的内存空间和系统资源。

3: What is the point of multi-process?
A single-process computer can do only one thing, and we now have computers that do multiple things.
Example: While playing the game (the game process), while listening to music (music process).
This means that computers now support multiple processes and can perform multiple tasks within a single time period.
And, you can increase the CPU utilization.

问题:    一边玩游戏,一边听音乐是同时进行的吗?    不是。因为单CPU在某一个时间点上只能做一件事情。     而我们在玩游戏,或者听音乐的时候,是CPU在做着程序间的高效切换让我们觉得是同时进行的。     注:那肯定会说到多核CPU对吧,但是多核CPU其实在某些情况下也是通过CPU的高效切换来运行的     例:比如开启了30几个进程,但是你只有2个CPU,那么肯定运行不过来对吧,最后还是通过CPU的高效切换的

4: What is a thread?
Multiple tasks can be performed within the same process, and each of these tasks I can see is a thread.
Thread: is the execution unit of the program, the execution path. is the most basic unit of the CPU used by the program.
Single thread: If the program has only one execution path.
Multithreading: If the program has more than one execution path.

5: What is the point of multithreading?
Multithreading exists, not to improve the execution speed of the program. In fact, to improve application usage.
The execution of the program is actually in the grab CPU resources, CPU execution right.
Multiple processes are robbing this resource, and one of those processes has a higher chance of grabbing CPU execution if the execution path is more.
We are not sure which thread will be able to grab at any time, so the execution of the thread is random.

Overview of new Lisboa source building and Java multithreading process

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.