A talk on Global Interpreter Lock in Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cpp_multithreading remove warnings cthreads and add g++ compile in travis Feb 12, 2018
python_c_extension
python_multithreading
slides
tests
.gitignore
.travis.yml
README.md

README.md

GIL Talk

Build Status

A talk on Global Interpreter lock.

Contents

Functions threads API

$ python python_multithreading/function_threads.py

Class based threads API

$ python python_multithreading/class_threads.py

Extension Module

Python C extension module is written in extension_module.c to build it on mac, run:

$ python python_c_extension/setup.py build

The above will will compile extension_module.c, and produce an extension module in the build directory. Depending on the system, the module file will end up in a subdirectory build/lib.system.extension_module.so.

Copy the built *.so file in the current directory, for e.g.:

$ cp -r build/*/* python_c_extension

The function defined in extensions module is used in c_ext_gil_test.py, run it as following:

$ python python_c_extension/c_extension_gil.py
Single Thread: 2.118302
Two Threads:   1.348021

Compile and run C Threads

  • compile
$ g++ cpp_multithreading/c_threads.cpp -o cpp_multithreading/c_threads
  • run
$ ./cpp_multithreading/c_threads

Acknowledgement

Thanks to Garvit and Suhaib, who played a vital role in the preparation of this presentation.