PyCon Pune 2018

PyCon Pune

Concurrency vs Parallelism

Submitted by Narendran (@dudewhocode) on Wednesday, 13 September 2017

videocam_off

Technical level

Beginner

Status

Submitted

Vote on this proposal

Login to vote

Total votes:  +2

Abstract

Any task can be made embarrassingly parallel with your code by crunching up the resources and using all CPU cores. What if your system resources are limited, say single core?, How do we achieve the similar speed in execution of tasks?. In this talk we will discuss on how one can use python3 to achieve near speed as in parallelism but without compromising system resources. At the end of the talk the audience will know what are synchronous, asynchronous, parallelism and concurrent executions. They will be able to design and write concurrent programs with Python3’s asyncio package.

Outline

A good code is one which uses the system resources efficiently which means not over utilizing the resources as well as not under utilizing by leaving them idle. One of the main features of Python3 is its asynchronous capabilities. We will see how we can levarage the async library to concurrently run our code, efficiently use our resources and finish the tasks blazingly fast.

Concurrency is not parallelism
a. Synchronous vs Asynchronous execution
a. What is parallelism?
b. What is concurrency?
c. RealWorld example (how a restaurant operates concurrently, why not in parallel?)

Introduction to asyncio in python 3
a. Eventloops
b. Co-routines
c. Futures
d. Execution flow of concurrent program
e. Think like an asynchronous programmer

Deep dive into asyncio package
a. Context Switch
b. Blocking tasks
c. Order of Execution
d. Sync vs Async HTTP calls
e. Creating Concurrency
f. Return When
g. Cancel Future
h. Handling Exceptions
i. Retrieving Exceptions
j. Wait Timeout
k. Parallel HTTP call
l. Concurrent HTTP call
m. Concurrency vs Parallelism benchmark (by making 1000’s of requests to battlefield 4 server)

How concurrency is different from multi-threading?

When not to use concurrency?

Summary

Requirements

Basic Python knowledge

Speaker bio

Naren is a Product Engineer with specific focus on building robust backend and scalable systems. He works on open source projects in his spare time. He loves speaking at tech conferences and currently helping MadStreetDen in scaling their Artifical Intelligence products to millions. In his 4 years of industry experience he’s worn plenty of hats- like the one of a Trainer, Embedded Engineer and Backend/Product Engineer and sometimes even helmets- when he’s out cycling.
When he’s not stirring up code, you can find him whipping up a delicious gluten-free treat or travelling/cycling. He likes being asked about his endless love for Python through the handle @DudeWhoCode

Links

Slides

http://dudewho.codes/blog/assets/slides/concurrency_vs_parallelism_45min.pdf

Comments

  • 2
    Kushal Das (@kushaldas) Reviewer a year ago

    Thank you for submitting the talk to PyCon Pune. The talk selection team will contact you here in case of any queries. Meanwhile, please make sure that you provide a link to the presentation slides.

    • 1
      Narendran (@dudewhocode) Proposer a year ago (edited 11 months ago)

      I have already added some slides which is just an outline. Now working on more comprehensive one with lots of asyncio concepts and code examples, will update it in few days.

    • 1
      Narendran (@dudewhocode) Proposer 11 months ago

      Hi @kushaldas, I have added my full slides for the talk and updated the abstract and outline too.
      Thanks

Login with Twitter or Google to leave a comment