I need to write a program that uses multiple processes to comput the sum of a set of (small) positive integers. It’s not a very traditional way of implementing the addition operation on a set of integers, but it’s meant for me to learn and better grasp the concept of processes and how they’re related.
- A set of “worker” processes. Each worker process reads two small integers from its argv, computes its sum and returns the result using exit system calls. So, for every sum a worker process is creted.
- Second item A “coordinator” process, is responsible for creating the “worker processes, and coordinating the computation. Note: that all the computation is done by the “worker” processes. All the numbers are provided in the command line (argv).
Also, the coordinator process also sets a timer at the start of a computation to a reasonable limit (say 10 seconds). If computation has not finished by that time, the coordinator process kills all the workers and then terminates itself.
I need to make sure that I print appropriate message(s) on the console screen for my homework for the cases described above.
In addition, the coordinator process should print a message when an interrupt (^C) is recieved. However, it should NOT be terminated. The worker processes just ignore the interrupt signals. Note that the processes must handle multiple interrupts correctly. As a precaution, I need to include this feature only after my program has been thorougly debugged.
Note:The coordinator may have to create multiple sets of processes. For example, if there are 8 numbers, the coordinator will first create 4 workers and get the results from them. At this point, there are 4 numbers, and it creates 2 workers. Finally, one worker is created to compute the overall sum. To make it simpler, if the number of integers to add is odd, then the coordinator needs to add 0 to the list of numbers. *Note:This might happen at any step during the computation.
I am *required to use Sun Workstations of the Computer Science Department to work on the programming assignments. Within my workstation, I will want to create a subdirectory called cs4630, in my home directory. Within, the newly created subdirectory, there will need to be another subdirectory called assign1 in my cs4630 directory. This is where all the files concerning assignment will be stored, and nothing else.
I need to name the two source files worker.c and coordinator.c. The code for worker process should be compiled seperately and its executable called worker.The executable for the coordinator process should be named coordinator.
Since the results are passed around by the exit keep, the numbers need to be single digits. Also, this is not a good way for communicating between processes, my professor writes. Each worker process should print its pricess id, its operands, and their sum. Each time the coordinator gets from a worker, it must print the pid of the worker, and the result received from that worker.
Dr. Gopalakrishnan says: Achieve maximum “parallelism” in your implementation.If you are not using makefile, please include the name of the compiler you are using and any special options needed as comments (along with other traditional comments) at the beginning of your source code.
*note from me: I don’t have too much time to accomplish this goal, and I currently and unable to logon to my account on the UNIX workstations here at the lab. I e-mailed my professor and sent in a work order, so hopefully I’ll be able to work on it tomorrow morning. I guess that tonight I will work on my cryptography assignment.