0% found this document useful (0 votes)
126 views6 pages

Threading Exercise 1: - : 1:write Python Script Create Three Different Threads Belonging To Different Thread Classes

The document discusses threading in Python. It provides exercises to 1) create threads belonging to different classes and check if threads are alive, 2) create a queue of processes to ensure no thread can interrupt another thread performing an activity, and 3) explain code handling two threads to complete before exiting.

Uploaded by

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

Threading Exercise 1: - : 1:write Python Script Create Three Different Threads Belonging To Different Thread Classes

The document discusses threading in Python. It provides exercises to 1) create threads belonging to different classes and check if threads are alive, 2) create a queue of processes to ensure no thread can interrupt another thread performing an activity, and 3) explain code handling two threads to complete before exiting.

Uploaded by

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

SWALEH ALAM 48456 LAB NO: 10

Threading

Exercise 1: -
1:Write python script create three different threads belonging to different thread classes

1
SWALEH ALAM 48456 LAB NO: 10

2:Enhance example 3 code adding few more functions to the class and then check if the
thread alive at a particular instance of time.

2
SWALEH ALAM 48456 LAB NO: 10

3: Explain the given code.


Answer: The given code handles the two threads in order to ensure they have completed before exiting
the desire process. The thread includes the current thread, and since joining the current thread is not
allowed (it introduces a deadlock situation), it must be skipped.

Exercise 2: -

1:Write a python program to create a queue of processes (threads) and ensure that when one
process will be doing a particular activity no other thread could interrupt the thread.

3
SWALEH ALAM 48456 LAB NO: 10

4
SWALEH ALAM 48456 LAB NO: 10

5
SWALEH ALAM 48456 LAB NO: 10

You might also like