[SOLVED] A Program with multiple Threads

Program with multiple threads/processesSubmission Instructions1. Submit two files for each problem: 1) your C program, and 2) a screenshot in jpg format showing that your program really works.2. Name your scripts using the pattern NJITID#_Problem#.c, and name your screenshots using the pattern NJITID#_Problem#.jpg. NJITID# is the eight-digit NJIT ID (Not your UCID, Rutgers students also have NJIT IDs). Problem# is the problem number (e.g., 1, 2, 3, 4etc).3. Submit individual files. DO NOT SUBMIT A ZIP FILE.Objectives1. To learn how to divide computation tasks and distribute tasks into different threads/processes.2. To learn how to solve problems using multiple threads, particularly how to synchronize the execution of threads to avoid race condition.2. To learn how to solve problems using multiple processes, particularly how to exchange data between processes.3. To gain more experience with accessing files using memory mapping.Problem 1: Write a program that creates multiple worker threads to calculate the sum of float point values saved in a file. Each thread calculates a partial sum, and the main thread adds up the partial sums. Your program will read the float point values from a file and print out the sum on the screen. The number of worker threads, as well as the file containing the float point values, are specified in the command line. For example.problem_1 4 ./file_containing_valuesYou may use gendata.c attached with the assignment to generate the file. Your main thread can memory-map the file, such that the worker threads can access the float point values in the file easily.Problem 2: Write a program that creates multiple processes to multiply two matrices of float point values. One matrix is saved in a file. The other matrix is an identity matrix (https://en.wikipedia.org/wiki/Identity_matrix) of the same size. Your program should save the product matrix into another file. Because the product should be the same as the first matrix, you can easily check whether your program produce correct results by comparing the product matrix against the first matrix. Use cmp command to compare (https://linux.die.net/man/1/cmp).The number of processes, the file containing the first matrix, and the file saving the product matrix, should be specified in the command line. The identity matrix should be generated dynamically ( determine the size based on the size of the input file (i.e., the one containing the first matrix)).problem_2 4 ./file_containing_one_matrix ./file_saving_product_matrixYou may use gendata.c attached with the assignment to generate the file for the first matrix. To ensure correctness, your program can assume that each matrix is square (NxN). So, when you generate the input file, ensure that the number of float point values in the file is a square number (https://en.wikipedia.org/wiki/Square_number).To check the results, use cmpcmp ./file_containing_one_matrix ./file_saving_product_matrixRead manual of cmp for more on how to use it (https://linux.die.net/man/1/cmp).Hint:Your processes can memory-map the files to share data easily.Refer to the multi-threaded matrix multiplication program in the slides for how to multiple two matrices in parallel.Problem 3: Write a program that create multiple processes to calculate an approximation of ?. Refer to the multi-threaded program calculating an an approximation of ? in the slides. The number of processes and the number of terms required to calculate the approximation should be specified in the command line (refer to the program in the slides). You may choose an IPC method (pipe, FIFO, or shm) you like in your implementation. But, pipe fits most. FIFO and shm are over-kills.

Don't use plagiarized sources. Get Your Custom Essay on
[SOLVED] A Program with multiple Threads
Get a 15% discount on this Paper
Order Essay
Quality Guaranteed

With us, you are either satisfied 100% or you get your money back-No monkey business

Check Prices
Make an order in advance and get the best price
Pages (550 words)
$0.00
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know that being a student these days is hard. Because of this, our prices are some of the lowest on the market.

Instead, we offer perks, discounts, and free services to enhance your experience.
Sign up, place your order, and leave the rest to our professional paper writers in less than 2 minutes.
step 1
Upload assignment instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
s
Get personalized services with My Paper Support
One writer for all your papers
You can select one writer for all your papers. This option enhances the consistency in the quality of your assignments. Select your preferred writer from the list of writers who have handledf your previous assignments
Same paper from different writers
Are you ordering the same assignment for a friend? You can get the same paper from different writers. The goal is to produce 100% unique and original papers
Copy of sources used
Our homework writers will provide you with copies of sources used on your request. Just add the option when plaing your order
What our partners say about us
We appreciate every review and are always looking for ways to grow. See what other students think about our do my paper service.
Philosophy
excellent job i will be coming back for any future papers if I have too.
Customer 452611, October 11th, 2021
Nursing
Great work! Thank you so much.
Customer 452707, July 15th, 2022
Psychology
Thanks so very much. The paper is well-researched and adequately referenced. You have been of great help during the pandemic!
Customer 452467, January 31st, 2021
Social Work and Human Services
Thank You, Don!!! :)
Customer 452587, November 9th, 2021
Technology
I can work with it and massage it to what I need. Thank You
Customer 452827, July 19th, 2022
Human Resources Management (HRM)
Thank you so much. Well written paper.
Customer 452701, September 25th, 2023
Social Work and Human Services
Thank You!
Customer 452587, November 17th, 2021
Human Resources Management (HRM)
Thank you.
Customer 452701, April 24th, 2023
Psychology
Good mastery of ABA concepts. Excellent!
Customer 452469, May 14th, 2022
Other
Great Work!
Customer 452587, March 10th, 2022
Human Resources Management (HRM)
Thank you for your service.
Customer 452701, March 6th, 2023
Other
GOOD
Customer 452813, July 5th, 2022
Enjoy affordable prices and lifetime discounts
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Order Now Order in Chat

Ensure originality, uphold integrity, and achieve excellence. Get FREE Turnitin AI Reports with every order.