From the course: Complete Guide to Parallel and Concurrent Programming in Python
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Multiple threads: Python demo - Python Tutorial
From the course: Complete Guide to Parallel and Concurrent Programming in Python
Multiple threads: Python demo
- [Instructor] We'll start with a demonstration using Python's threading module to create several concurrent threads and investigate their impact on this computer's CPU usage. But before diving into code, let's first take a look at the number of processors that are available on this computer, which I'll be using for demonstrations throughout this course. To do that, I'll press Ctrl + Shift + Esc to open the Task Manager, and then select the Performance tab. Down at the bottom, I can see that this computer has 12 cores and 24 logical processors. Those numbers mean this computer has 12 separate complete physical processing cores, and each of those cores supports something called hyperthreading, which enables them to each run two independent applications at the same time. So the computer treats those 12 physical cores as 24 logical processors. Now, the hyperthreading in those 12 cores does not mean I'll get double the performance out of them. Hyperthreading takes advantage of unused…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Thread vs. process4m 35s
-
(Locked)
Concurrent vs. parallel execution4m 53s
-
(Locked)
Global interpreter lock: Python demo4m 35s
-
(Locked)
Multiple threads: Python demo5m 52s
-
(Locked)
Multiple processes: Python demo5m 42s
-
(Locked)
Execution scheduling3m 38s
-
(Locked)
Execution scheduling: Python demo2m 42s
-
(Locked)
Thread lifecycle3m 35s
-
(Locked)
Thread lifecycle: Python demo5m 38s
-
(Locked)
Daemon thread2m 48s
-
(Locked)
Daemon thread: Python demo2m 29s
-
-
-
-
-
-
-
-
-
-
-