write a multi-threaded C program to find all prime numbers up to N using Sieve Eratosthenes Algorithm (where N is an integer greater than 1).

In this assignment, you will write a multi-threaded C program to find all prime numbers up to N using Sieve Eratosthenes Algorithm (where N is an integer greater than 1). To find the prime numbers up to N, your program will use Pthreads library to implement a pipelined parallelism model. Your program will read N as a command line argument (Usage: ./minor4 [N]). See references [1-5] and sample outputs for examples. The pipeline model is based directly on the same work model that is used in CPUs and on factory floors. Each processing element will do a certain amount of the job, and then pass the partially completed task on to the next element. Here the processing elements are threads, and each thread is going to do a portion of the task, then pass the partial results on to the next thread. A pipelined model of parallelism, is where: • A given thread T0 performs some computation and sends results to thread T1 • Then, T1 computes its computation and passes results to T2, and so on. The Sieve Eratosthenes algorithm is expressed as follow: PROGRAM PARTIAL PSEUDOCODE : Using a pipelined parallelism approach: • Each thread keeps the next prime number • And if a new number is not divisible by the prime at Ti send it to Ti+1 Thread T0 starts reading numbers, and checks if the number is divisible by 2 (the first prime number). If the number is not divisible, it is passed to T1. T1 will have the second prime number. T1 passes only the numbers that are not divisible to T2 and so on. 1. Create list of unmarked natural numbers 2, 3, …, n 2. k = 2 is the first in the list 3. Repeat (a) Mark all multiples of k between k2 and n (b) set k to the smallest unmarked number > k until k2 > n 4. The unmarked numbers are primes 2 An example of finding prime numbers up to N=61 using Sieve algorithm graphically is shown as follow: REQUIREMENTS: • Your code should be well documented in terms of comments. For example, good comments in general consist of a header (with your name, course section, date, and brief description), comments for each variable, and commented blocks of code. • Your program should correctly implement the Sieve algorithm (35 pts), along with proper implementation of the Pthreads library functions (35 pts), and Pipeline model (20 pts). • Your program should be named “minor4.c”, without the quotes. • Your program will be graded based largely on whether it works correctly on the CSE machines (e.g., cse01, cse02, …, cse06), so you should make sure that your program compiles and runs on a CSE machine. • This is an individual programming assignment that must be the sole work of the individual student. SUBMISSION: • You will electronically submit your program to the Minor Assignment 4 dropbox in Blackboard by the due date

Order from us and get better grades. We are the service you have been looking for.