Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.5x 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 faster version.

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

Algorithmic Trading Navigating The Digital Frontier

Authors: Alex Thompson

1st Edition

B0CHXR6CXX, 979-8223284987

More Books

Students also viewed these Databases questions

Question

c. What were you expected to do when you grew up?

Answered: 1 week ago

Question

4. Describe how cultural values influence communication.

Answered: 1 week ago

Question

3. Identify and describe nine cultural value orientations.

Answered: 1 week ago