Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help. This is my last assignment to pass my class. PLEASE DO NOT SAY THAT YOU ARE ANSWERING IF YOU ARE NOT GOING

I need help. This is my last assignment to pass my class.

PLEASE DO NOT SAY THAT YOU ARE ANSWERING IF YOU ARE NOT GOING TO ANSWER!

PLEASE DO NO COPY SIMILAR ANSWER TO THIS QUESTIOIN AS THEY ARE WRONG.

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

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

Students also viewed these Databases questions