Ask Computer Engineering Expert

ASSIGNMENT

Exercise I

There are three processes in the scheduling queue and assume that all three of them are ready to run. Assume that P1 arrived a little before P2; and P2 arrived a little before P3. Scheduling starts at time t = 0. The CPU and I/O burst patterns of the three processes are as shown below:

Given the following processes that arrived in the order shown

 

CPU Burst Time

IO Burst Time

CPU Burst Time

IO Burst Time

CPU Burst Time

P1

4

2

4

2

4

P2

5

2

5

 

 

P3

2

2

2

2

2

Each process exits the system once its CPU and I/O bursts as shown above are complete.
Show the activity in the processor and the I/O area using the FCFS, SJF, and Round Robin (time quantum = 2) algorithms

For each algorithm, compute the average waiting time, the average response time, and the throughput.

Exercise II

Recall that Shortest Remaining Job First (SRJF) is a variant of Shortest Job First (SJF) with preemption added in. Consider the following three processes vying for the CPU. The scheduler uses SRJF. The scheduler re-evaluates which process to run only upon the arrival of a new process into the scheduling queue, or the completion of a process. The table shows the arrival time of each process.

Process

Arrival Time

Execution Time

P1

To

5 ms

P2

To + 2 ms

4 ms

P3

To + 3 ms

1 ms

The scheduling starts at time To.

Fill in the table below with the process that is executing on the processor during each time slot. Be sure to show your work as to how you arrived at schedule.

To+

0

1

2

3

4

5

6

7

8

9

10

11

12

Running

 

 

 

 

 

 

 

 

 

 

 

 

 

SIMULATION ASSIGNMENT: Process Scheduling Simulator

Text Book- Operating Systems: Internals and Design Principles by William Stallings, Sixth Edition, ISBN-10: 0-13-600632-9 ISBN-13: 978-0-13-600632-9.

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.

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?

6. Let us try to prove our conjecture by adding a 6th 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.

7. Run the simulator again and this time log the tabular data again but this time only log the 6th 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)

V. Acknowledgments

The activities were adapted for Dr. William Stallings with permission from Dr. Steven Robbins. The original activities were written for the Operating Systems course taught at The University of Texas at San Antonio. These simulation exercises were developed by Adam Critchley (University of Texas at San Antonio).

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92671188

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As