Question
Write a program in C that takes 4 CLI arguments (A, B, C, and D) and creates 20 POSIX threads. These threads each are responsible
Write a program in C that takes 4 CLI arguments (A, B, C, and D) and creates 20 POSIX threads. These threads each are responsible for generating A random numbers between B and C and counting how many of these numbers are evenly divisible by D. These threads are also responsible for writing the numbers that are divisible by D into files named numbers0.txt, numbers1.txt... as well. When these threads are done, the main thread must print the results on the screen.
Sample Run $ ./program1 100000 1000 50000 42
Thread 0 - 2341
Thread 1 - 2419
Thread 2 2325 . . .
Thread 17 - 2284
Thread 18 - 2388
Thread 19 - 2284
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