Robot Snakes and the Global Interpreter Lock

Pranith Hengavalli (~prnthh)




Python is an amazing language, known for its vast standard library and use in rapid prototyping. When we were trying to build a robotics system that is primarily modular and upgradeable, we ended up using Python to power the brain of the project.

In this talk, we'll discuss how we designed the event loop, responsible for controlling the mechanical actions and state of a robot snake.

  • Animating multiple motors concurrently at different speeds to different positions.
  • Foreground and background tasks.
  • Interrupting ongoing tasks.

We will discuss best practices when performing asynchronous actions in Python, and how to ensure actions are completed within a bounded time. Finally we touch one of the lesser known 'features' of Python, the Global Interpreter Lock.

GIL is a mutex that protects access to Python objects, preventing multiple threads from executing at once. Two threads calling a function may take twice as much time as a single thread calling the function twice. We'll discuss some of the real world implications of the GIL, along with some considerations that must be taken while writing highly synchronous Python code.


Knowledge of common Python syntax would be great.

Content URLs:

-slides tbd

Speaker Info:

Hi, I'm Pranith, a final year undergrad student at NMIT, Bangalore.

I'm a robotics enthusiast with a passion for cypherpunk, virtual reality, and generally, the future. Apart from the usual frameworks, I've used Python across the field, ranging from web technologies implemented on raw CGI to microPython on the ESP8266.

I try to apply Python in odd ways to bridge various layers of the stack, and as a result have a fair amount of experience breaking it.

Id: 775
Section: Core python and Standard library
Type: Talks
Target Audience: Beginner
Last Updated: