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:
- Multiprocessing. process creates a new process. If the target parameter is set to F, a sub-process named F is created;
- Multiprocessing. Queue
- Multiprocessing. Pipe
- Multiprocessing. Pool is used to manage the created sub-processes so that they can coordinate their work.
- 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.