Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Process Scheduling Simulator

Simulation package available at http://vip.cs.utsa.edu/simulators


I. Overview The Process Scheduling Simulator will execute a collection of processes that demonstrate a scheduling algorithm of either First-Come/First-Served (FCFS), Shortest Job First (SJF), Preemptive Shortest Job First (PSJF), Shortest Job First Approximation (SJFA), or Round Robin (RR) and will then generate visual aids along with statistics to explain the results. II. Setup i. Windows XP/Vista 1. Right click on the downloaded zip file containing the simulator and choose extract all. 2. Choose Next till the wizard has finished. 3. Navigate to the directory named 'ps' which contains the unzipped simulator. 4. Edit 'psconfig' so that following the word 'user' is your first and last name. Note: WordPad is a sufficient editor for editing our files. 5. Double click 'runps.bat' to start the simulator. 6. Avoid closing the DOS prompt as this will also close the simulator. ii. Linux/Solaris 1. Execute the command 'unzip ps.zip -d ps' to unzip the simulator. 2. Navigate to the directory named 'ps' which contains the unzipped simulator. 3. Edit 'psconfig' so that following the word 'user' is your first and last name. 4. Now execute the shell script 'runps'. Note: You must have C Shell installed. 5. Avoid closing the terminal as this will also close the simulator. III. Exercises i. Introduction 1. The simulator operates by executing the same runs under one or more predefined algorithms. Those algorithms are FCFS, SJF, and RR #, where # is the quantum, which is defined as the number of units to execute for a process before it is removed from the processor. 2. First, execute the Process Scheduling Simulator and push the Run Experiment button. The default experiment should begin and display the current run being simulated in Event Log pane, which is located in the upper right of the simulator window. 3. The runs are located in a file named 'myexp.exp'. Notice that in the experiment file the runs are identified by the word 'run' with the following named run, keyword 'algorithm' preceding the respective predefined algorithm, and keyword 'key' preceding an identifier for that experiment. 4. Next, observe that all the runs are the same with the exception of differing algorithms. Returning to the simulator window we can view the statistics associated with each run by pushing Show All Table Data. In addition, we can view Gantt charts showing how each

process in a run executed by pushing Draw Gantt Chart and selecting the run we wish to view or graphs demonstrating one statistic that pertains to all the runs by cycling through the statistics by pushing Graph Type then viewing that graph by pushing Draw. 5. The last feature of importance to us is the simulator's logging capability. Push Open Log to activate logging. Now, push Log All Table Data as this will log the same data that can be viewed when pushing Show All Table Data. 6. Next, draw a Gantt Chart for FCFS and in the new window push the button labeled Log in the lower right corner. Once finished, push Hide in the lower left corner of the window and this will return you to the simulator. Lastly, cycle thorough the graph types till you reach Turnaround, then push Draw. This will show the Turnaround Times for each run. Similar to logging the Gantt Chart, push Log and then Hide. 7. Finally, back at the simulator window push Show Local Log and verify that what you logged shows up in the log exactly in the order in which it was added. Now, close the simulator by pushing Quit in the lower right corner of the simulator window. 8. Notice a 'logfile.html' shows up in the working directory of the simulator. Open it to verify that this file is the same as the local log file that you viewed earlier. There will also be gif images in the same directory as the log file. These images contain the graph data that you logged. If the log file is ever moved you have to make sure to move these images as well so that the graph data shows in the new log location. ii. Activity 1. Modify the 'myexp.exp' file to have 5 run lines that will use the following algorithms: FCFS, SJF, RR 1, RR 5, and RR 10. On each run line, make sure that both the algorithm and key are correctly identify each other. 2. Now modify the 'myrun.run' file so that there will be a total of 20 processes with the following properties: All processes arrive at time 0.0 All processes have a constant duration of 100 All have constant I/O bursts of 10 All have basepriority 1.0 The first set of 10 processes have CPU bursts uniformly distributed between 2 and 8 The last set of 10 processes have CPU bursts uniformly distributed between 30 and 40 Do not change the seed line of the run file as this will change the sample space. Example of 'myexp.exp': name myexp comment This experiment contains 5 runs run myrun algorithm FCFS key "FCFS" run myrun algorithm SJF key "SJF" run myrun algorithm RR 1 key "RR 1" run myrun algorithm RR 5 key "RR 5" run myrun algorithm RR 10 key "RR 10"

Example of 'myrun.run': name myrun comment This contains two types of processes

algorithm SJF seed 5000 numprocs 10 firstarrival 0.0 interarrival constant 0.0 duration constant 100.0 cpuburst uniform 2.0 8.0 ioburst constant 10.0 basepriority 1.0

numprocs 10 firstarrival 0.0 interarrival constant 0.0 duration constant 100.0 cpuburst uniform 30.0 40.0 ioburst constant 10.0 basepriority 1.0

3. Run the simulator and open a log file and add the tabular data and the 5 Gantt charts, one for each run. 4. Now let us analyze the results. SJF will have the best average waiting time. This is easily identifiable by graphing the Waiting. Why is this behavior evident with our chosen example? 5. Next, compare the trend in the Round Robin experiments as the quantum increases. For large values of the quantum which algorithm will Round Robin mimic and how large does the quantum need to be for our example?
th

6. Let us try to prove our conjecture by adding a 6 run to 'myexp.exp'. So to do this we must first Close Log and Quit our current session with the simulator. Now open the 'myexp.exp' and add an additional line defining a RR algorithm with your chosen quantum. Again, make sure the key correctly identifies the algorithm.
th

7. Run the simulator again and this time log the tabular data again but this time only log the 6 Gantt chart which should simulate the RR algorithm with a large quantum. So now, let us have the simulator Show Local Log which should correspond with our previous conjecture. 8. Finally, Close Log and Quit the simulator. Recall that the generated log can be viewed as an HTML file in the working directory of the simulator, and if the log file is moved so must the gif images be moved as well to the same destination directory. IV. Assignments 1. (Activity 4) 2. (Activity 5)

You might also like