Question: 1 a ) ( 5 points ) As briefly illustrated in class, a Python application can have several threads. Is this consistent with the basic
a points As briefly illustrated in class, a Python application can have several threads. Is this
consistent with the basic notion of threads in an operating system? Explain.
b points Describe the steps the OS must perform to support the creation and execution of the
main program and the corresponding threads.
def taskid:
printfStarting Task ID: id
sleeptime random.randrange
printfTask: id sleeping for: sleeptime
sleepsleeptime
printfFinished Task ID: id
if namemain:
starttime perfcounter
#create two threads
t Threadtargettask, args
#start the threads
tstart
#wait for each thread to finish
tjoin
endtime perfcounter
printfTotal time to complete: endtimestarttime sec
c points Alter the above code to create and start more Thread instances for a total of Add the
required code below:
points What is the PCB used for?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
