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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started