Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Develop a small program where a task is split into subtasks and executed by new threads. The results of the task must be collected

1. Develop a small program where a task is split into subtasks and executed by new threads. The results of the task must be collected in the main thread which will wait for all tasks to complete and all results to be gathered before reporting a final result. If you are stuck for ideas, generate a random number and block in each task, gather the random numbers in the main thread and sum their values.

2. Implement the program in a few different ways to explore the different approaches to sharing data between threads. Few of them for this task are, try using a container in a global variable, try storing values as instance variables, and try using a queue (do not write separate program, just apply these changes on the same program and then comment them so we can view it while marking). Sharing data between threads is central to almost all programs that implement concurrency via the threading module. After applying different approaches, explain the changes/difference you see in the program as comment.

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_2

Step: 3

blur-text-image_3

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 2 Lnai 9285

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Joao Gama ,Alipio Jorge ,Carlos Soares

1st Edition

3319235249, 978-3319235240

More Books

Students also viewed these Databases questions

Question

State the uses of job description.

Answered: 1 week ago

Question

Explain in detail the different methods of performance appraisal .

Answered: 1 week ago