Skip to content

Instantly share code, notes, and snippets.

View CamilleMo's full-sized avatar

Camille Moatti CamilleMo

View GitHub Profile
@CamilleMo
CamilleMo / multiprocessing.md
Last active December 22, 2022 03:46
This is a guide on how to use the multiprocessing module

Introduction

The multiprocessing module was defined in PEP 371 by Jesse Noller and Richard Oudkerk. The idea behind this module is to take advantage of multiple processors on a machine. This module is very similar to the threading module.
Given that you use processes you can avoid the Global Interpreter Lock (GIL). Let's start by using the Process class.

Getting Started With Multiprocessing

The Process class is very similar to the threading module’s Thread class.

@CamilleMo
CamilleMo / logging.md
Last active February 26, 2017 18:59
This is a guide on the logging module

Introduction

The logging module can make your life easier especially when writing a multi-threaded program. It will help generate a .log file so you can make ex-post controls. You can also use it for debugging.

Example

script.py :

#!/usr/bin/env python