Question: Q.1: Write a multithreaded program in C++ that works as defined below: a.Create an integer type array of size 300 and populate it with radom

Q.1: Write a multithreaded program in C++ that works as defined below:

a.Create an integer type array of size 300 and populate it with radom numbers

b.Create three threads

c.The first thread examines the first 100 indexes of the array. For each index value, it calcula the total number of digits in it. In this way thread 1 finds the sum of digits in all values

d. Similarly, thread 2 finds the sum of digits in next 100 values while thread 3 finds the same last 100 values

e. Make it sure that if one thread is calculating the number of integers then no other thread start this operation

f. All of the threads share their result with parent thread and parent decided the winnrt wit maximum sum

Q.2= Write a shell script that reads a file name as input and finds how many integers are there in the file? Q.3= Write a shell script that takes a number as input and finds how many digits are there in the number?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!