This project must target a Unix platform and execute properly on our Unix apache server.
The project must be written in C, C++, or Java.
If using C or C++, you must use a Unix fork to create child processes and a Unix pipe for communication.
If using Java, you must use the Runtime exec method to create child processes and use streams for communication.
Any other method requires instructor approval.
The purpose is to demonstrate a reduction in elapsed time by dividing a problem between two child processes running in parallel versus a single child process. To magnify the difference, a slow O(N^3) algorithm will be used to find the maximum subsequence sum of a list. In this case, a list half as large should take around 1/8 as long to process. So, the approach will be to measure the time using one process working on the entire list, versus two processes each working on half the list and demonstrate the time reduction.
Because the maximum subsequence sum could span across the two lists, the center-spanning sum must also be found by the parent process, but this is done in O(N) time so it will not noticeably affect the overall results.
The user will provide a filename containing data to process and how many processes should be used (1 or 2) as command-line inputs. The program will read the data from the file into a list. The list is then divided among the number of child processes. Each child process will use the maximum subsequence sum algorithm to process its portion and write the result to a separate pipe (or stream in Java). The parent will read from the pipes (streams) to get the results. The parent will then compute the center-spanning sum (in the two-child case) and print the maximum subsequence sum to the screen.
The data file will contain integer data, one integer per line. It will be a Unix file, with only a newline at the end of each line. The data file provided is an example. Your program should support files as large as 500 numbers.
The filename and number of child processes to create must be command line arguments where the first argument is the filename and the second argument is the number of processes.
To get the running time, follow the examples posted in eLearning. The elapsed time should exclude the time to read the input file.
The maximum subsequence sum code can be found at: http://users.cis.fiu.edu/~weiss/dsaa...axSumTest.java
Can anyone please help me and let me know how i start doing this program.
Please do help me.
thanks a lot in advance.