Python3 asynchronous programming processes and Threads-1

Source: Internet
Author: User

Python3 Asynchronous programming processes and threads-1

First, understanding inter-process communication

    • Inter-process communication

    • Process

    • Thread

    • Thread vs Process

    • IO model

    • Concurrency vs Parallel

    • Asynchronous vs Synchronization


Two, multi-threading and multi-process usage

    • Compute-intensive vs I/O-intensive

    • GIL

    • Multithreading

    • Multi-process


Third, the benefits and usage of the co-process

    • Co-process

    • Yield

    • Yield from


Iv. inter-process Communication-IPC 01

    • Pipelines: Nameless pipes and Named Pipes (FIFO)

    • Message Queuing

    • Signal Volume

    • Shared storage

    • Socket

    • Streams

Related definitions:

Pipeline:

Named pipes:

Message Queuing:

Signal Volume:

Shared Memory:

Motoko Operation:


V. Characteristics of the process

    • Dynamic nature

    • Concurrency of

    • Independence

    • of Asynchrony


Vi. Status of the process

    • Running running takes up CPU is running

    • Ready to wait for CPU

    • Blocking blocked temporarily does not have operating conditions, even if the CPU is idle

      Related definitions:

      Process Control BLOCK:



several Process Control operations in UNIX systems:


Thread:


Sharing between Threads:


Thread-Independent Information:


Creation of Threads:


Vii. understanding Inter-process Communication 02

I/O model

    • Block type

    • Non-blocking

    • I/O multiplexing

    • Signal-driven

    • asynchronous I/O

Related definitions:

Two phases of the I/O operation:


Blocking I/O:


Non-blocking I/O:


I/O multiplexing:


Signal-driven:


asynchronous I/O:


Concurrency and parallelism:


Asynchronous and synchronous:


Asynchronous implementations:


To handle multitasking operations:

    • Multi-process/multi-threaded

    • I/O model

    • Co-process

multithreaded, multi-process implementation mode: Master worker mode

Master assigning tasks Multi-process disadvantage: Creating a process resource requires multiple Frok () function multithreading disadvantage: A thread problem, the entire hanging off



Python3 asynchronous programming processes and Threads-1

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.