SI411 Operating Systems Fall AY07

Team Programming Project 2

Deadlines:

1.      Teammate selection: 1500 Wednesday, 15 Nov, 2006.  Failure to send your instructor the required email (see below) indicating who your partner is by the deadline will result in a 10 point reduction in the project grade for both members of the team.

2.      Project due date: Close of Business, Thursday, 30 Nov, 2006.

 Close of business is defined as under my office door prior to my arriving to work the next day (usually around 0730). If you slide your project under my door after the due date, be sure to write the date and time that you slid it under my door to stop any late penalty computation, otherwise the project will be considered to have been placed under my door just moments before I arrived.

Team Programming Project Designation: For the purposes of COMPSCIDEPTINST 1531.1C (available from http://www.usna.edu/CS/academics/honor.htm) this programming project is designated as a Team Programming Project, and as such “Midshipmen may give no assistance whatsoever to any person not on their assigned team and may receive no assistance whatsoever from any person not on their assigned team other than the assigning instructor.  Further, midshipmen may not use information in any format, electronic or printed, other than their own or a teammate’s class notes, the course textbook, or materials distributed by the instructor.  If midshipmen wish to use additional sources, they must receive explicit permission from their instructor.”

 

Late Submissions: As per the course policy, projects turned in after the submission deadline will incur an automatic deduction of 3n points where n represents the number of work days (rounded up for fractions of days) after deadline passage.

Extra Credit Opportunity: The baseline project requires output only to a file. Up to 30 points of extra credit can be earned by teams that provide a graphical visualization of their program in action (planes flying in synch with the program’s execution, the Java monitor being accessed for the two missing items, threads made to wait until their items are available, etc). You must include an easy to use (including any necessary instructions, what certain keystrokes mean, etc) interface from which the user is informed of how to run the program and provide needed input (if needed).  Extra credit will only be awarded to projects that completely meet all baseline requirements.

 

Project Teams:  For this project, you may choose your own teammate.  You MUST work in a team of size 2.  One team member must e-mail me your team composition (cc to your teammate) no later than the above teammate selection deadline or your team will receive a 10 point reduction in your project grade.  If you cannot find a team mate, send me an e-mail prior to the teammate selection deadline and you will be assigned to a team without incurring the 10 point reduction. The below table will be filled in once teams submit their teammate selection e-mail.

Teammates

Hurst

Hamilton

Sung

Tantillo

Syme

Hartig

Fallon

Fernandez

Foster

Cosgrove

Hesch

Dailey

Rogers

Stolsig

Mott

Kysiak

 

Background:   Consider a system with three flight threads, and one flight scheduling agent.  Each flight thread constantly wants to go flying, but to go flying, each flight thread needs three items: A Pilot, an NFO, and an Aircraft.  One flight thread always has a Pilot, another always has an NFO, and the third always has an Aircraft.  The flight scheduler agent has an infinite supply of all three items.  The agent places two of the three items on the flight line.  The flight thread that has the remaining item grabs them, goes flying, eventually lands, and signals the agent upon completion.  The agent then puts another two of the three items on the flight line, and the cycle continues.

Assumptions: You may make the following assumptions:

·        As soon as a flight thread gets the two items it is missing, it goes flying.  After landing, it retains the original item that it started with. 

·        The agent randomly determines which two items to place on the table, but never puts two of the SAME item on the table.

·        Upon landing, a flight thread that has just landed immediately wants to go flying again.

Baseline Requirements:

  1. Write a deadlock-free program to synchronize the agent and the flight threads using Java constructs to realize Dijkstra’s concept of a monitor. Recall that a monitor in Java is a class instance with one or more synchronized methods and uses the object’s implicit object lock and entry and wait sets to coordinate the behavior of threads using the synchronized methods of the object.

 

  1. Your Java program is to be well commented, and use a descriptive naming convention. See project 1 for a discussion of comments and naming conventions.

 

  1. Write your program so that all output is directed to a file called “Flights.txt”. The first line of this file is to contain the names of the midshipmen on the team.  Each subsequent line of this file shows which two items the agent put on the flight line, and which flight thread took the two items to go flying as a result.

 

  1. Continue placing items on the flight line and completing flights until 20 total flights have been completed.  After this, your program is to stop.

Sample Program Output (Contents of Flights.txt):

This program written by Dr. Needham

1) Flight Line Has Available: Pilot Airframe     ***NFO Thread Is Flying***

2) Flight Line Has Available: NFO Airframe       ***Pilot Thread Is Flying***

3) Flight Line Has Available: NFO Airframe       ***Pilot Thread Is Flying***

4) Flight Line Has Available: Pilot Airframe     ***NFO Thread Is Flying***

5) Flight Line Has Available: Pilot NFO  ***AirFrame Thread Is Flying***

6) Flight Line Has Available: Pilot NFO  ***AirFrame Thread Is Flying***

7) Flight Line Has Available: Pilot Airframe     ***NFO Thread Is Flying***

8) Flight Line Has Available: NFO Airframe       ***Pilot Thread Is Flying***

9) Flight Line Has Available: Pilot NFO  ***AirFrame Thread Is Flying***

10) Flight Line Has Available: Pilot Airframe  ***NFO Thread Is Flying***

11) Flight Line Has Available: Pilot NFO         ***AirFrame Thread Is Flying***

12) Flight Line Has Available: Pilot Airframe  ***NFO Thread Is Flying***

13) Flight Line Has Available: NFO Airframe      ***Pilot Thread Is Flying***

14) Flight Line Has Available: Pilot NFO         ***AirFrame Thread Is Flying***

15) Flight Line Has Available: Pilot NFO         ***AirFrame Thread Is Flying***

16) Flight Line Has Available: NFO Airframe      ***Pilot Thread Is Flying***

17) Flight Line Has Available: Pilot NFO         ***AirFrame Thread Is Flying***

18) Flight Line Has Available: NFO Airframe      ***Pilot Thread Is Flying***

19) Flight Line Has Available: NFO Airframe      ***Pilot Thread Is Flying***

20) Flight Line Has Available: Pilot Airframe  ***NFO Thread Is Flying***

 

Program has completed 20 Flights, shutting down, have a fine Navy day.

Deliverables: Turn in ONE of each of the following PER TEAM by the deadline.

1. Source Code: Paper copy of all source code. Include the following as comments at the top of each file you turn in:

·         the names of the midshipmen in your software development team,

·         the filename of the source code, and

·         a brief description of the source code in the file.

2.      Output files: A paper copy of each of the output files from the requirements section above.

3.      Written Analysis of your output:  Analyze your program’s output in terms of the total number of each thread that successfully flew, whether the monitor gave preference to any particular thread, and whether any deadlock or starvation occurred.  For example, the above sample output shows that the pilot thread flew 7 times, the NFO thread flew 6 times, and the airframe thread flew 7 times. You must support your conclusions by directly citing the output you collected in Flights.txt.  Your discussion should be no more than one page in length.

4.      Cover Sheet. A paper copy of the below cover sheet with your team’s information filled in.

5.      Extra Credit: If your team is attempting the Visualization extra credit, include screen captures of your program in execution showing both your interface and the graphical visualization(s) of your program in action.

6.      E-mail. In addition to the above, send your instructor one e-mail message per team with the subject line of “SI411 Project 2 Delivery”.  Include as attachments your final (to be graded) source files and .txt file discussed above.

--------------------------------------------------------------------------------------------------------------------------------------------

SI411 Project 2 Cover Sheet

Printed Names & Alpha codes

 

 

 

 

Date Submitted

 

Time Submitted

 

Visualization

Extra Credit

 

Yes     No  (Circle one)

 

If you circled yes, attach screen captures of your program displaying the extra credit AND briefly describe in the below space what your program does to fulfill the extra credit requirements.

 

 

 

 

Extra Credit description (if applicable):