Python route Nineth _ Threads and processes

Source: Internet
Author: User

Processes, Threads

Process: One execution of a program

Threads: Basic scheduling Unit for CPUs

Each process provides the resources needed to execute the program. A process has a virtual address space, execute code, open handle system objects, a secure situational awareness, a unique process identifier, environment variables, a priority class, minimum and maximum working dimensions, at least one thread of execution, and each process starts with a thread, called the main path, The main thread can create multiple child threads

A process is a collection of CPU-bound instructions that, in a single-core CPU, can only perform one task at a time. For example, in a factory, at the same time a workshop can only have one workshop to work, other workshops can only wait.

Thread:

A thread is the basic CPU dispatch unit.

For example: If you are reading a book, you have something to pause, after a while you come back and want to continue reading (from the point you paused to continue reading), if you want to write down the page number, line number, letter number. So you need to remember these three numbers for reading.

Join you have a bedroom where you use the above techniques to join in after a break to re-read a book that you can quickly recover in any place.

The same thread is the same reason, a CPU will give people an illusion at the same time the CPU to do multiple calculations. It takes a little time to count on each one.

No matter how many threads you start, how many CPUs you have, Python will only allow one thread to run at the same time while executing, wiping ... , then what is it called multithreading? This early conclusion of the knot, listen to my live talk.

Python route Nineth _ Threads and processes

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.