winzip icon

Parallel Processing Programs

Submitted on: 1/7/2015 4:18:00 AM
By: Divyen Patel (from psc cd)  
Level: Intermediate
User Rating: By 9 Users
Compatibility: C
Views: 3114
     This program set consists of 36 Parallel Processing Programs, made on Linux Operating System and thoroughly tested on that. ------------------------------------ Practical -TermWork 1 ------------------------------------ (1) Create processes using fork() and check different states i.e. zombie, orphan, etc. (2) Header files: process creation and process joining (3) Sum of numbers from 1 to 10, by dividing the job into two processes(parent and one child) (4) Copy the contents of one array to another (5) Header files: create and remove shared memory block (6) Programs 3 and 4 by using shared memory (7) Sum of elements of an array by Loop Splitting (8) Maximum and minimum of an array using Loop Splitting ------------------------------------ Practical -TermWork 2 ------------------------------------ (1) Header files for locking the critical region (2) Sum of the elements of the array using self scheduling (3) Sum of the elements of the array by loop splitting ; each process adds its partial sum to the final sum (the overhead on the parent is removed) (4) Factorial using self scheduling (5) Matrix-vector multiplication (6) Histogram using self-scheduling and locking the whole bin. (7) Histogram using loop splitting and locking the each bin with a different lock. (8) Histogram by calculating the partial histograms and consolidating in the end to get the final histogram. ------------------------------------ Practical -TermWork 3 ------------------------------------ (1) Calculate average of the elements of an array and then the average deviation.(Race condition) (2) Header files for barrier (3) Same definition of program 1 using barrier (4) Overcome forward dependency using block scheduling (5) Overcome the forward dependency using block scheduling using the most equitable distribution of work (i.e. considering excess points) (6) Solving the dependency in the linear recurrence relation x[i] = x[i-1] + y[i] using block scheduling ------------------------------------ Practical -TermWork 4 ------------------------------------ (1) One way to find matching entries in two files is to sort the contents of the files and then step thru the files comparing entries. Analyze this method compared to simply comparing each entry of one file with each entry of the second file without sorting. Write a parallel program to find matching entries of two files by first sorting the files. (2) Create a singly linked list of numbers using threads (3) Using the POSIX threads library, write a 2-thread program for Linux. Once the thread spawning is done, the first thread (T1) should wait for user input. T1 should produce no output, but should shut down the whole process once the user types a q or a Q. T2 should take no input, but should generate a list of prime numbers starting at 2 and going as high as it can in the time allowed. From the user point of view, this program will generate primes until told to quit. (4) To find the sum of numbers from 1 to n using thread (5) To find the total no of prime numbers between 1 to n by using thread. (6) To find the maximum and minimum element in an array using threads. (7) To multiply two matrices using thread. (8) Solve the producer-consumer problem using thread (9) Implement a multi-access threaded queue with multiple threads inserting and multiple threads extracting from the queue. Use mutex-locks to synchronize access to the queue. ------------------------------------ Practical -TermWork 5 ------------------------------------ (1) Multiply matrix (10 x 10) with a vector using variation in Self Scheduling(Hint : assume that the total no of calculations are n*n) (2) Multiply matrix (10 x 10) with a vector using variation in Loop Splitting using single and multiple barriers.(Hint : use the division of labor constant idiv) (3) Multiply matrix (10 x 10) with a vector using Indirect Scheduling. (4) Expression Splitting using single and multiple barriers (5) To count the total no of characters in one or more character strings by any parallel technique.
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net

Other 4 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.