Python Multiprocessing Tutorial: Parallel Programming Made Easy

Опубликовано: 17 Сентябрь 2023
на канале: Cloudvala
267
6

  / multiprocessing-in-python  


Overview
The multiprocessing module was added to Python in version 2.6. It was originally defined in PEP 371 by Jesse Noller and Richard Oudkerk. The multiprocessing module allows you to spawn processes in much the same manner as you can spawn threads with the threading module. The idea here is that because you are now spawning processes, you can avoid theGlobal Interpreter Lock (GIL) and take full advantages of multiple processors on a machine.
The multiprocessing package also includes some APIs that are not in the threading module at all. For example, there is a neat Pool class that you can use to parallelize executing a function across multiple inputs. We will be looking at Pool later. We will start with the multiprocessing module’s Process class.
Getting started with multiprocessing
The Process class is very similar to the threading module’s Thread class. Let’s try creating a series of processes that call the same function and see how that works:


На этой странице сайта вы можете посмотреть видео онлайн Python Multiprocessing Tutorial: Parallel Programming Made Easy длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Cloudvala 17 Сентябрь 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 267 раз и оно понравилось 6 зрителям. Приятного просмотра!