Question: Please provide a step by step with code on how to complete this project using C in Putty. Thank you! Objective: In this assignment, you

Please provide a step by step with code on how to complete this project using C in Putty. Thank you!

Objective:

In this assignment, you will be writing a multithreaded program. You will demonstrate your knowledge of the POSIX Pthreads library and how to create, destroy, and wait for threads. You will also demonstrate how to pass data between parent and child threads.

Details:

You will create a multithreaded program that takes one or more numeric arguments from the command line and displays the prime factors (Links to an external site.)Links to an external site. of each number. Each child thread will be passed a number from the parent thread that should be factored by that thread. Each child thread will return a sorted integer array of prime factors for that number. The parent thread will wait for each thread to terminate. The parent thread will display the original number provided and all factors returned by the child thread to the console.

The child thread must not display any data. Your only output should be provided by the main thread, and only after waiting for the thread to complete.

There are many ways to find the prime factors (Links to an external site.)Links to an external site. of a number. The simplest algorithm is probably trial division (Links to an external site.)Links to an external site.. You are welcome to submit more complicated algorithms, but please do not sacrifice your assignment quality for a fancy factorization algorithm. There is no extra credit for complexity.

Output:

Here is some examples of what is expected:

# ./assn3 Usage:./assn3 ...

# ./assn3 12 12: 2 2 3

# ./assn3 7 12 25 7: 7 12: 2 2 3 25: 5 5

# ./assn3 {32..48} 32: 2 2 2 2 2 33: 3 11 34: 2 17 35: 5 7 36: 2 2 3 3 37: 37 38: 2 19 39: 3 13 40: 2 2 2 5 41: 41 42: 2 3 7 43: 43 44: 2 2 11 45: 3 3 5 46: 2 23 47: 47 48: 2 2 2 2 3

Note: The bracket notation in bash allows for a sequence of numbers, separated by spaces

Submission:

You should submit two files in a tarball. Those two files are:

Makefile - This should contain the necessary make commands to build your program

assn3.c - This is your main source file

You should not include your binary program. I will be deleting it and rebuilding it myself.

I highly recommend creating and using a git repository.

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!