Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODE IN C++ AND PLEASE DO NO COPY SIMILAR ANSWER TO THIS QUESTIOIN AS THEY ARE WRONG. Please I Need help. 1. The program shall

CODE IN C++ AND PLEASE DO NO COPY SIMILAR ANSWER TO THIS QUESTIOIN AS THEY ARE WRONG. Please I Need help.

1. The program shall be invoked as ./threads where is the number of threads. For example, ./threads 10 will create 10 threads.

2. The program will then create the specified number of threads and each thread will then generate 100 random numbers in range of 0 -- 100000 and insert them into the same shared binary search tree that is shared between all threads.

3. All threads should be allowed to insert the numbers at the same time while ensuring proper synchronization using pthread mutexes (i.e., no two threads will be modifying the tree at the same time).

4. While the created threads are busy inserting numbers, the main thread waits for the other threads to terminate. Once all threads terminate the main thread will print all numbers in the binary tree. Correctly printed numbers should be in order (as that is the point of the binary search tree).

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

Big Data 29th British National Conference On Databases Bncod 2013 Oxford Uk July 2013 Proceedings Lncs 7968

Authors: Dan Olteanu ,Georg Gottlob ,Christian Schallhart

2013th Edition

3642394663, 978-3642394669

More Books

Students also viewed these Databases questions

Question

Identify conflict triggers in yourself and others

Answered: 1 week ago