Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Python Concurrency Simplified
Rating: 3.5 out of 5(28 ratings)
219 students

Python Concurrency Simplified

Practically understand concurrency in Python to write efficient programs
Last updated 12/2018
English

What you'll learn

  • This course is for Python developers who want to learn concurrency techniques to build high-performance applications with Python.

Course content

2 sections66 lectures5h 56m total length
  • The Course Overview3:30

    This video will give you an overview about the course.                       

  • Threads and Multithreading3:04

    In this video, we will take a brief look at what a thread is, as  well as, how we can use multiple threads in order to speed up the  execution of some of our programs.                         

    • Look at types of threads

    • Introduction to multithreading

    • Advantages and disadvantage of multithreading

     

  • Processes and Event-Driven Programming4:08

    Processes are very similar in nature to threads, they allow us to  do pretty much everything a thread can do but the one key advantage is  that they are not bound to a singular CPU core. Event-driven programming  is a huge part of our lives. In this video, we will study both the  concepts with examples and diagram.                         

    • Understand the properties, advantages and disadvantages of processes

    • Learn event driven programming with an image example

     

  • Concurrent Image Download4:54

    One excellent example of the benefits of multithreading is,  without a doubt, the use of multiple threads to download multiple images  or files. In this video, we will learn to download concurrent image  using two methods.                         

    • Execute a program for sequential download

    • Working example of concurrent download

     

  • Improving Number Crunching with Multiprocessing5:25

    In this video, we will look at the different mechanisms to improve the number crunching performance with Multiprocessing.                         

    • Execute the first method that is using sequential prime factorization

    • Execute the second method that is using concurrent prime factorization

     

  • Concurrency and I/O Bottlenecks4:35

    In this video, we will learn about concurrency and the major bottlenecks that impact our applications.                         

    • Understand the introduction to concurrency

    • Look at the properties of concurrent systems

    • Create a working example that requests a page and calculates the time taken

     

  • Understanding Parallelism1:45

    Parallelism is the art of executing two or more actions  simultaneously as opposed to concurrency in which you make progress on  two or more things at the same time. In this video, we will be  understanding parallelism and how does it differ from concurrency.                         

    • Learn the concept of parallelism with an example

    • Understand the concept of CPU-bound bottlenecks

     

  • Computer Memory Architecture Styles2:34

    In this video, we will look at two different architectural styles  employed by system designers, those are Uniform Memory Access pattern  (UMA) or a Non-uniform memory access (NUMA) pattern.                         

    • Understand the basic introduction of computer memory architecture and its type

    • Learn the features, advantages, and disadvantages of uniform memory access

    • Learn the features, advantages, and disadvantages of non- uniform memory access

     

  • Threads in Python5:36

    In this video, we will take a look at Thread state explained with a  flow chart and a working example. Then, we will discover the different  types of threads.                         

    • Look at all different type of thread states

    • Represent a diagram to explain five different states

    • Explore about different types of thread

     

  • Starting a Thread5:37

    In this video, we will take a look at best practices when it comes to starting a new threads.                         

    • Define a program to start a thread and inherit from the thread class

    • Learn the technique of forking with an example

    • Daemonizing a thread

     

  • Handling Threads in Python10:03

    In this video, we will learn effective ways to create and manage multiple threads in Python programs.                         

    • Run a program to start loads of threads

    • Slow down programs using threads

    • Get the total number of active threads

     

  • How Does the Operating System Handle Threads?3:09

    In this video, we will take a look at the performance impact of  spinning up multiple threads and compare this to the spinning up of  multiple processes.                         

    • Create processes versus threads

     

  • Deadlocks and Race Condition4:33

    In this video, we will take a look at concept of deadlock with the  example of dinning philosophers. Then we will learn about race  conditions also explaining process execution sequence.                         

    • Study Dining Philosophers problem with the help of an example

    • Implement our own version of the Dining Philosophers problem in Python using RLocks

    • Learn process execution sequence

     

  • Shared Resources and Data Races7:02

    In this video, we will give you brief overview of all of the  synchronization primitives available to you as well as few simple  examples of how you can use these within your programs.                         

    • Utilize the join method

    • Acquire a lock while it's in an "unlocked" state

    • Define two functions that both modify a and b

     

  • Conditions and Semaphores8:44

    In this video, first we will understand the detailed concept of Condition and semaphore explained along with working example.                         

    • Look at the definition of our condition object

    • Define a semaphore in class definition

    • Use a bounded semaphore as opposed to a normal semaphore

     

  • Events and Barriers4:22

    In this video, we will take a look at the concepts of  synchronization primitive such as Events and Barriers with respective  examples.                         

    • Modify and utilize Event public functions

    • Utilize barriers in order to block the execution of our threads

     

  • Sets and Decorator3:59

    In this video, we will take a look at few examples of locked set function, decorator and class decorators.                         

    • Extend the class

    • Extend other primitives

    • Implement a class decorator function

     

  • Queues6:10

    In this video, we will take a look at the basic concept of Queue and its objects along with the respective examples.                         

    • Utilize the queue.Queue() object in order to implement our own FIFO-based queue

    • Create a series of subscribers that retrieve all items from this queue until it is empty

    • Create PriorityQueue which we will populate with two sets of data.

     

  • Queue and Deque Objects6:17

    In this video, we will look at full or empty queue. Then we will see a working example of deque objects.                         

    • Create a series of publishers that attempt to publish to our queue object until it is full

    • Create a number of subscribers that subscribe to our queue object

    • Define our deque object by calling collections.deque()

     

  • Appending, Popping, and Inserting Elements4:31

    In this video, we will learn to interact with the objects in the  queue by appending, removing and inserting elements with the help of  working examples.                         

    • Run a code example that append to both the start and the end of our deque object

    • Pop items from both the start and the end of our queues using pop() and popleft()

    • Insert elements into anarray at specific points

     

  • Defining Your Own Thread-Safe Communication Structures6:35

    In this video, we are going to build a very simple multithreaded web Crawler.                         

    • List the requirements

    • Declare our Crawler’s constructor function which will set base_url

    • Utilize the atomicity of the queue object

     

  • Testing Strategies4:41

    In this video, we will learn to Test concurrent software systems. Then we will look at few examples of unit testing and PY unit.                         

    • Define SimpleFunctionTest class which inherits from unittest.TestCase

    • Follow a blend of different strategies while unit testing concurrent code

     

  • Debugging1:33

    In this video, we will learn to catch an exceptions in child threads.                         

    • Utilize the sys module to extract the information

     

  • Benchmarking5:02

    In this video, we will look at the benchmarking techniques along  with working example of ‘time it’ module, utilizing decorators and  timing context manager.                         

    • Utilize the timeit module to measure the time taken to execute two distinct functions

    • Retrieve the differences between these two calls and display this on the console

    • Define a Timer class which features a constructor, an entry point, and an exit point

     

  • Profiling10:59

    In this video, we are going to learn profiling techniques which  includes cProfile and Memory profiling with the help of few tools such  as line profiler tool and Kernprof.                         

    • Utilize the cProfile module in order to attain these attributes

    • Add @profile decorator in order to see what has gone wrong

     

  • Concurrent Futures6:50

    In this video, we will learn to create Thread pool executor with context manager and shutting down executor object.                         

    • Utilize the threading.current_thread() function in order to determine

    • Utilize our ThreadPoolExecutor as a context manager

    • Define a function which will essentially "work" for n number of seconds

     

  • Future Objects5:48

    In this video, we will learn about future objects and unit testing  with future objects along with associated methods such as set_result  method and set_exception method. Then we will look at few other methods  like cancelling callable, getting a result and as completed.                         

    • Use cancel() function on that specific task

    • Call executor.map to map every value in the array

    • Utilize the urllib.request module in order to request these URLs

     

  • Setting Callbacks and Exception Classes4:07

    In this video, we will create two programs, the first one will be  to utilize the callback functionality and in another program is to pass  the exception from child thread to another thread.                         

    • Specify a callback for the said function using the add_done_callback function

    • Add multiple callbacks to a single future object

    • Define an isEven function, which takes in a value

     

  • ProcessPoolExecutor4:37

    In this video, we will look at few working examples on Process  Pool Executor, context manager and for improving speed computationally  bound problems.                         

    • Use os module to find the current PID

    • Employ a context manager to make our code nicer and more readable

    • Utilize the timeit module

     

  • Improving Our Crawler3:48

    In this video, we will get to know few examples to improve our  crawlers. Then, we are going to look at refactoring our code and store  the results in a CSV file.                         

    • Manage the startup and shutdown of all our threads

    • define an appendToCSV function

     

  • Working Around the GIL and Daemon Processes4:01

    In this video, first we will learn to Utilizing sub-processes.  Then we will understand Daemon Processes with the help of working  example.                         

    • Spin up child processes using the multiprocessing module

    • Define and start your own daemon processes

     

  • Identifying and Terminating Processes5:24

    In this video, we will learn to identify the process using PID and terminating a process using terminate function                         

    • Spin up a single child process, and pass in childTask function

    • Simulate Executing something for 20 seconds

    • Retrieve current process identifier for the process

     

  • Multiprocessing Pools9:31

    In this video, we will get an overview of the multiprocessing  Pools. Then We will learn to interact with these pools in a number of  distinct ways.                         

    • Utilized ThreadPoolExecutors

    • Use a for loop to submit four tasks to our processing pool

    • Pass the maxtasksperchild parameter

     

  • Communication Between Processes3:43

    In this video, we will look at number of option helps to communicate with different processes.                         

    • Learn different options to communicate between threads

    • Look at an example of Pipes and its type

    • Create a child process, which, , subclasses the multiprocessing.Process class

     

  • Multiprocessing Manager7:40

    In this video, we will look at few multiprocessing managers which  includes Namespaces and queue. Then we will explore an example code in  greater detail to gain a basic understanding of communication using both  a listener and a client.                         

    • Utilize namespaces in order to share some data across both a main process and a child process

    • Define three separate processes that take in the myTask function

    • Use Listener as a context manager, and wait to accept a connection

     

  • Communicating Sequential Processes2:18

    In this video, we will learn interaction between multiple concurrent models.                         

    • Use pip to install pycsp

    • Define two distinct functions, Process1 and Process2

     

  • Event-Driven Programming3:12

    Before we dive deep into the working, let’s get introduced to the  event-driven programming concepts and how it comes at rescue for complex  tasks in our program.                         

    • Understand what event-driven programming is in a general sense

     

  • Getting Started with Asyncio16:00

    Asyncio was introduced to the Python programming language in  version 3.4 and added some excellent functionality and it has been an  overall hit with the Python community. Let’s get started with it.                         

    • Learn about events, tasks, and futures

    • Explore about coroutines and protocols

    • Perform synchronization between coroutines

     

  • Debugging Asyncio Programs2:23

    Thankfully, when it comes to debugging asyncio-based applications,  we have a couple of options to consider. It’s time to explore those  options in detail and how to work along with those.                         

    • Create a simple event loop

    • Submit some simple tasks to the event loop

     

  • Twisted2:43

    Will you like to use a powerful event-driven networking engine  that can be used for a huge range of different projects such as web  servers, mail clients, subsystems, and more? Yes! Let’s do it right now!                         

    • Set up a simple web server that serves local content from a tmp directory

     

  • Gevent4:24

    Let’s get familiar with another networking library which is based  purely on top of coroutines. This video will walk you through the use of  the gevent library.                         

    • Explore about Greenlets

    • Use gevent within your Python applications

     

  • Test Your Knowledge

Requirements

  • Prior knowledge of Python language is assumed.

Description

Python is a very high level, general purpose language that is utilized heavily in fields such as data science and research, as well as being one of the top choices for general purpose programming for programmers around the world. It features a wide number of powerful, high and low-level libraries and frameworks that complement its delightful syntax and enable Python programmers to create.

This course introduces some of the most popular libraries and frameworks and goes in-depth into how you can leverage these libraries for your own high-concurrent, highly-performant Python programs. You will learn the fundamental concepts of concurrency needed to be able to write your own concurrent and parallel software systems in Python. You will also learn the concepts such as debugging and exception handling as well as the libraries and frameworks that allow you to create event-driven and reactive systems.

Contents and Overview

This training program includes 2 complete courses, carefully chosen to give you the most comprehensive training possible.

The first course, Learning Concurrency in Python, introduces some of the most popular libraries and frameworks and goes in-depth into how you can leverage these libraries for your own high-concurrent, highly-performant Python programs. You will learn the fundamental concepts of concurrency needed to be able to write your own concurrent and parallel software systems in Python.

In the second course, Concurrent Programming in Python, you will skill-up with techniques related to various aspects of concurrent programming in Python, including common thread programming techniques and approaches to parallel processing.Filled with examples, this course will show you all you need to know to start using concurrency in Python. You will learn about the principal approaches to concurrency that Python has to offer, including libraries and tools needed to exploit the performance of your processor. Learn the basic theory and history of parallelism and choose the best approach when it comes to parallel processing.

By the end of this course, you will have learned the techniques to write incredibly efficient concurrent systems that follow best practices.

Meet Your Expert(s):

We have the best work of the following esteemed author(s) to ensure that your learning journey is smooth:

●        Elliot Forbes has worked as a full-time software engineer at a leading financial firm for the last two years. He graduated from the University of Strathclyde in Scotland in the spring of 2015 and worked as a freelancer developing web solutions while studying there. He has worked on numerous different technologies such as Golang, Node.js, and plain old Java, and he has spent years working on concurrent enterprise systems.Elliot has even worked at Barclays Investment Bank for a summer internship in London and has maintained a couple of software development websites for the last three years.

BignumWorks Software LLP is an India-based software consultancy that provides consultancy services in the area of software development and technical training. Our domain expertise includes web, mobile, cloud app development, data science projects, in-house software training services, and up-skilling services.

Who this course is for:

  • Increase your awareness of concurrency in Python
  • Distinguish between parallel programming and concurrent programming
  • Explore Python's threading module
  • Familiarize yourself with Python's Global Interpreter Lock (GIL)
  • Learn the similarities between thread and process management
  • Practice with open source libraries
  • Learn process synchronization and inter-process communication
  • Work with best practices and caveats
  • Know how to handle the hardest part in a concurrent system: shared resources
  • Build concurrent systems with Communicating Sequential Processes (CSPs)
  • Maintain all concurrent systems and master them