MCS 730 Parallel Programming I Instructor Jeremy Johnson Practice Assignment 1 Not to be handed in 1) Exercise 4 of Chapter 3 of the textbook (CG). Test your program in the following way: Write a main program that first creates a list in tuplespace and then evals several processes that simultaneously count the number of atoms in the list (when finished counting, each process should print the total number of atoms in the list). A list should never be modified while another process is reading the list. Nor should two processes be allowed to simultaneously modify a list. How can you ensure that this never happens while still allowing multiple processes to simultaneously read the list? 2) Implement a bounded buffer using Linda. You should eval several producer processes and a single consumer process. The producer processes should produce tuples of the form ("buffer",id), where id is some integer that distinguishes each of the producer processes. The consumer process should read buffer tuples and print them out. There should never be more than N (some constant you can choose) buffer tuples in tuple space at any given time. You should decide when the consumer process has obtained enough tuples (e.g. a specified number of tuples have been consumed) and at that time the consumer process should inform the producer processes to stop production and quit. When all producer processes have finished the consumer process should print a message. You must guarantee that your program never enters deadlock (e.g. if a producer is blocked due to a full buffer when the consumer informs the producer to quit production deadlock will occur)