Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

stuck with question can someone do one as example please and language is pyton 1. Devise a small Python program that executes a repetitive task,

stuck with question can someone do one as example please and language is pyton
image text in transcribed
1. Devise a small Python program that executes a repetitive task, such as calling the same function multiple times in a loop. Execute this program and record how long it takes to complete. The specifics of the task do not matter. You can try to complete something practical (you can write a function of your choice for example a function to calculate the sum of numbers (this is just an example, do not use it.)) with the sleep() function. 2. Now update the program to execute each task using a separate thread. Record how long it takes to execute. 3. Compare the execution time between the serial and concurrent versions of the program. Calculate the difference in seconds (e.g. it is faster by 5 seconds). Calculate the ratio that the second program is faster than the first program (e.g. it is 2.5 faster). Your program should calculate and display the result, do not count it manually. These calculations may help: - difference = serial time concurrent time - ratio = serial time / concurrent time If it turns out that the concurrent version of the program is not faster, perhaps change or manipulate the task so that the serial version is slower than the fastersion. 4. Comment your code, all sections of the code should be clearly explained

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

Use Thevenins Theorem to find Io in the network shown 2mA 12V Io

Answered: 1 week ago

Question

Compare and contrast verbal and nonverbal codes

Answered: 1 week ago