Overview of processes and Threads

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.
Process: Is the program that is running.
A process is an independent unit of system resource allocation and invocation. Each process has its own memory space and system resources.

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.

Problem:
Do you play the game while listening to the music at the same time?
No. Because a single CPU can only do one thing at a certain point in time.
While we are playing the game, or listening to music, the CPU is doing the program between the efficient switching let us feel that it is at the same time.

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 processes and Threads

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.