

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Two programming problems for java. The first problem involves implementing an airplanecontrol system with atomicity considerations and thread handovers. The second problem requires implementing real-time jobs using the rtsj framework and exploring various memory types and job priorities. An alternative problem is provided for those without access to a linux machine, which involves reading a paper on the synchronous data flow programming language lustre and submitting a summary and code examples.
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Homework: Due October 31, 2007 Problem 1: Concurrent programming in Java Consider an airplane control system which is composed of three control signals: Pitch (movement of the note up or down) Roll (rotation along a longitudinal axis) Yaw (rotation along a vertical axis) Implement an AirplaneControl class, which encapsulates these values. Implement five other classes, implementing the Runnable interface which can read or write these values as follows: BlackBox – can read the values (and record them) Pilot – can read and write CoPilot – can read and write QualifiedPassenger – can read and write AutoPilot – can read and write. Discuss the issues of atomicity in this application. Implement an application which implements the scenario from the movie “Airplane!”: -the airplane is controlled by the Pilot, the CoPilot reads the controls. -the Pilot falls sick, the plane is taken over by the CoPilot -the CoPilot falls sick. -after some time while the plane is not under the control of any thread, the AutoPilot takes over. -the QualifiedPassenger takes over from the AutoPilot, lands the plane and relinguishes control. -the AutoPilot takes over the plane, which takes off again. -during all this time, the BlackBox records the actions. Naturally, this is not quite a fully specified problem. I leave it to your creativity of how do you implement, for instance, the “handling over control” problem. Also, you might want to consider the effect of the environment: for instance, there might be random changes in the pitch, roll, yaw due to wind, etc. The pilots need to correct this to get back to the values they want. But certainly you want to make sure that there will be no situation where the Pilot changes the pitch and the AutoPilot changes the roll. Also, the BlackBox always needs to perform a consistent reading, so you should never record the result of a partial write.
Problem 2: Real time Java Implement using the RTSJ framework the following functionality: (a) Create a “job” of configurable difficulty and memory requirements, which you can instantiate like this: String label = “JobType”; long memoryReq = 5000; long difficulty = 10000; Job n = new Job(label, memoryReq, difficulty); n.doTheJob(); The memory should be actually allocated and “touched” in the doTheJob function. The difficulty should be proportional to the number of instructions necessary to do the job. (b) Through experimentation, find memoryReq and difficulty values such that the “doTheJob()” function will takes any desired value between 0.1 sec and 10 sec. (c) Implement an application which runs two types of jobs “Job1” and “Job2” through aynchronous event handling. Job1 should be run every 5 seconds while Job2 every 2 seconds. (d) Run a series of experiments through which Job1 has a constant time required of 1sec, while the time required by Job2 increases from 0.1 to 10 seconds. Discuss you observations. (e) Set the priority of the two jobs at different priority levels, repeat the experiments in (d), discuss the observations. (f) Run the programs in such a way that the memory is allocated using different types of memory (ImmortalMemory, ScopedMemory etc). Repeat the experiments in (d), discuss observations.