Welcome to python2.6: multi-processor Programming

Source: Internet
Author: User
Original article: http://www.blogchina.com/20081009613591.html

Python2.6 is just released in 10.1. I can't wait to write this introduction before reading it carefully. There are too many exciting new improvements. 2.6 is directed
Python3.0 (python3000) is a new step and is not compatible with the python2.x sequence. I carefully read the newly added
Processing of multi-process packet group multiprocessing (PEP 371), which is a weapon developed by python to take advantage of services gradually becoming the mainstream m3 system platform. The official document says "process-based 'threading' interface": (Note: The M3 platform is dedicated to multi-core, multi-processor, multi-computer system, multi-core, multi-CPU, and multi-computers, I called him m3 system programming, and put the local multi-core multi-processor and Remote Multi-computer under the same framework to consider many advantages, such as multiprocessing. manager ).

Two main tools for processing parallel computing in Python are threading and multiprocessing. As mentioned in the preceding document
Like threading APIs to create and manage processes (not threads !). The exciting thing is that multiprocessing provides local and remote synchronous processing methods, allowingProgramEmployee charge
By leveraging the powerful computing capabilities provided by m3, instead of making them stick to the advertising effect, it is no longer a "Silver-like wax gun head, which is useless in sight. Multithreading technology is familiar to us, but multithreading cannot utilize multi-core and multi-processor computing capabilities. In terms of distributed parallel processing, python is the first to lead the trend. It is no coincidence that Guido van rosum is the master of Andrew S Tanenbaum, the operating system mentor.
The earliest distributed operating system Amoeba was designed and developed for it to develop system management programs. Therefore, python is of excellent lineage and is a tool specially developed for distributed systems.
People feel that python is better than Java in distributed parallel processing, not to mention C. Of course, preferences are sometimes biased! Python2.6, that is
Python3000 effectively solves the problem of "global lock Gil" (side-stepping). Let's look at the statement on Wikipedia:

Now we encapsulate the interface and system call for distributed parallel system programming. The following is a brief introduction:

    1. Multiprocessing. process creates a new process. If the target parameter is set to F, a sub-process named F is created;
    2. Multiprocessing. Queue
    3. Multiprocessing. Pipe
    4. Multiprocessing. Pool is used to manage the created sub-processes so that they can coordinate their work.
    5. Multiprocessing. Manager manages the sub-processes created on the remote server, encapsulates the lock and rlock locks and signal semophore, so that you do not have to deal with parallel issues independently.

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.