"Multithreading" simple comprehension & Process and "How many cores is your computer?" 】

Source: Internet
Author: User

Believe that you will often hear the thread or process two concepts, we first look at the process

What is a process? process, as the name implies, is an ongoing program, or it can be said to be a running program.

Ctrl+alt+delete three keys together press, see Windows Task Manager (in fact, a program crashes often in this way to close the program) we can see:

You can find that your computer runs multiple processes at the same time. Previously a single-core computer, the CPU can only respond to one service at a time.

So why can you run multiple processes at the same time? play Music at the same time, write programs, and run code in the background ...

The CPU usage record shows that the 1,2,3,4 indicated in the figure refers to the computer four core meaning that the CPU can respond to four requests at the same time. Running multiple threads at the same time in a single program accomplishes different tasks, called multithreading. Multithreading is primarily designed to conserve CPU time.

So back to the first question, what is a thread?

A program has at least one process, and a process has at least one thread . A thread is the least-executed unit of a process.

In summary, each program starts with at least one process to start, and at least one thread is started per startup process.

My humble research, more superficial, the shortcomings of the Please enlighten me. Thank you!

"Multithreading" simple comprehension & Process and "How many cores is your computer?" 】

Related Article

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.