In this assignment you will use the ring simulator to explore process scheduling and synchronization. Read the exercises after Program 4.1 in the text to get a feel for the problem. However, you will just be using the simulator and do not have to compile any programs.
Make a directory called assign3 for all of the files for this assignment.
You will be creating several log files. Each log file will have images that use the same filenames. Be sure to put each log file with the associated images in a different subdirectory so you do not write over the log and image files on the next run.
Part 0
Put the contents of this tar file
in your assign3 directory.
Modify the ringconfig file so the the user line contains
your name instead of Local User. Make sure that
/usr/local/courses/java/bin is in your path
(you did this in assignment 2) and run the ring simulator using
runring
The simulator should come up and you should be able to create a log file.
Part 1
Open a log file and keep a log of the output generated for each set of runs
described below.
You can display the output generated by the simulated program by clicking on
the Display Info button and then Display Output.
Run the program several times (at least 3)
with the configuration indicated and put the resulting output in the log
file. Push the Reset button between runs. After logging the
output, push the clr button on the output window before starting
the next set of runs.
Try each of the following and record the output generated by the simulated program.
After each of these, change back to the standard configuration:
After fork: parent
Choose Process: FCFS
Scheduling: no preempt
Print Atomic
After running each experiment (which consists of three or more runs with the same parameters) log the output and then clear the output.
After running all of the experiments, answer the following questions:
Part 2
For this part you will run the Tree program. Use the Change Program
button in the second column can choose the TreeOfProcesses program.
This is
similar to the tree of processes of Example 2.7 of PUP. This will be run
with nprocs equal to 5, generating 16 processes.
Make 1 run of the simulator for each of the following:
Part 3
For this part you will implement mutual exclusion using a semaphore.
Start with the original ring program.
Set the simulator for "Print Not Atomic, Probability 0.1"
and Scheduling, RR, quantum 5.
Run the program and confirm the the output is interleaved.
Run the new program and save the the program and output in a log file. The critical section should have been protected and the lines should be printed atomically. What determines the order in which the lines are output? Try changing the scheduling algorithm and determine whether it affects the order of the output.
Use the cover sheet to hand in your assignment. Your log files for parts 1 and 2 can be in several parts, but number the pages consecutively and fill in the index on the cover sheet. Then answer the questions on the cover sheet.