HOMEWORK PROBLEM 7 INTRODUCTION TO Ada 95 PURPOSE: To learn about Ada tasking and how to use it. This is a two part homework. You will end up with a plane chasing a target and firing a missile. END RESULT: A complete Ada program that is a main procedure that WITH's a package you write containing the tasks. This is the first of a sequence of two assignments that will result in one program. (Nothing to turn in for this part.) PROBLEM: Plane, target and missile problem: HW7 is to get the target flying on your screen. HW8 is to get a plane to fire a missile at the target. Tasking will be used for the target, plane and missile and other tasks. A rendezvous task will be used to access Shared data. ( Report and Read_Out ) A special Plot task is needed that uses only one PUT to output the cursor position and character. You mat use X Windows or Microsoft Windows or VT100. The target is to be started as a task from the main procedure. The main procedure may have to be kept alive until the task terminates. Experiment is HW7. OBSERVE: All the tasks may be placed in a single package. The main program may be used to clean house at the end of execution or the Target task may clean house (abort). READING: BARNES 18. ISO 8652:1995 9. NOTES: Different compilers will have different algorithms for context switching while tasking. The context switch may or may not occur when any form of Put is executed. I/O takes a relatively long time, thus if one task has output then all parallel tasks that must be kept running must also have output ( or must be locked from execution some other way ). The main procedure is the sponsor of the Shared task and thus must be kept running until the Target, Plane, and Missile tasks are complete. The global time T is used to synchronize all tasks and main program termination. Any code can set T to a large number to stop the process. This works reliably because the only other action to change T is to increment it. It would seem reasonable if GET would suspend waiting for input and let parallel task run. It usually doesn't! Most compiler use run till blocked for tasks rather than time slicing. On a uniprocessor, only one task runs at a time. The entries Shared.Report and Shared.Read_Out are to ensure that the four values X,Y,VX,VY are a consistent set independent of the context switching algorithm. This is the standard Ada construct for Shared data in Ada 83, protected types can be used in Ada 95. EXTRA: Use Ada 95 protected in place of select in Shared task FILES: