Analysis of the scalability of the counter data structure

Now, let's consider the scalability of our current counter data structure—specifically, with changing numbers of active threads. We had three threads increment a shared counter for a total of 300 times; so, in our scalability analysis, we will have each of the active threads increment a shared counter 100 times, while changing the number of active threads in our program. Following the aforementioned specification of scalability, we will look at how the performance (speed) of the program that uses the counter data structure changes when the number of threads increases.

Consider the Chapter16/example3.py file, as follows:

# Chapter16/example3.pyimport threadingfrom concurrent.futures ...

Get Mastering Concurrency in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.