0% found this document useful (0 votes)
7 views5 pages

Lecture 19 Threading Basics(Python notes)

The document discusses the basics of threading in Python, explaining that every process can have multiple threads running simultaneously. It highlights the use of the built-in 'threading' module, particularly the Thread class, and its key methods: start() to initiate threads and join() to wait for their termination. Threading is especially useful for tasks that involve waiting, such as networking and web-related operations.

Uploaded by

Gareth Matina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views5 pages

Lecture 19 Threading Basics(Python notes)

The document discusses the basics of threading in Python, explaining that every process can have multiple threads running simultaneously. It highlights the use of the built-in 'threading' module, particularly the Thread class, and its key methods: start() to initiate threads and join() to wait for their termination. Threading is especially useful for tasks that involve waiting, such as networking and web-related operations.

Uploaded by

Gareth Matina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Lecture 19: Threading Basics

Eng. Emanuel Rashayi


Faculty of Engineering, Dept of Electrical & Electronics Engineering , University of Zimbabwe
[email protected]
Python 3 - Threading Basics
 Every process running inside an operating system contains at least one thread and
can further initiate multiple threads, which are then executed simultaneously, in the
same process space.
 This is similar to executing multiple applications, at the same time.
 In Python, threading can be used to run several function calls or other tasks
concurrently, especially if those tasks involve some waiting times.
 This is the case for networking and web-related tasks, among others.
 Python provides a specific module for threading purposes; this module is simply called
threading and it is a built-in module.
Python 3 - Threading Basics
 We will use the Thread class from within the threading module, written with a capital T,
prepended, of course, by the module name.
 From within this class, the most useful and used methods are start() and join().
 The start() method simply starts or initiates the thread.
 The join() method makes sure the program waits for all threads to terminate
Python 3 - Threading Basics
Python 3 - Threading Basics

You might also like