Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives: write a program that simulates the service of jobs (process) by the CPU of a multi-user computer. Inputs should be taken from a text

Objectives: write a program that simulates the service of jobs (process) by the CPU of a multi-user computer. Inputs should be taken from a text file with command arguments. And results also should be written to output file and screen. Recommendations & Rules: The application must be written in C++ programming language and should be compiled on GNU/Linux Operating Systems. Dont use any special library for protocols when coding. Write your own functions if its necessary. Please run the application and show the pictures Details: 1. Program should have command argument options to get input data from a text file and command argument option for write output data. -f must be used for command argument and following text indicate the input file name and -o for the output file name.

student@db:~$ ./cpe351 f input.txt o output.txt

2. This file should have three columns and unlimited rows. Below table represent structure of this file.

Burst Time/ Arrival Time /Priority 10/ 0/ 0 5/ 0/ 0

Some data fields may not use at decision process so you can omit the values. But every process should have three of these values. At the Appendix section example file given. 3. After first time executing simulator should ask for the user to choose the simulation method. The menu should have at least five options. CPU Scheduler Simulator

1) Scheduling Method 2) Preemptive Mode 3) Non-preemptive Mode 4) Show Result 5) End Program Option >

a) Scheduling Method: In this mode program obtain scheduling method from user. You should implement: First Come, First Served Scheduling Shortest-Job-First Scheduling Priority Scheduling Round-Robin Scheduling (You should also obtain time quantum value)

b) Preemptive Mode: This is a clock-driven mode, in which the clock is a counter that is incremented each simulated second. The clock is initially 0 and continues "ticking" until all the jobs in the input have been serviced and left the system. This simulation runs until a particular number of jobs have been serviced. First jobs should obtain from the input file. And each step simulator asks the user if its need to put the new job to ready queue or Continue to execution. A new job should be added in pair format. Pair should consist of Burst time and Priority (10:1). This job should be taking into account by your program.

c) Non-preemptive Mode: This mode is similar to Step-by-Step mode but its difference is simulator dont ask the user at each time tick for a new job. The simulator should use the input file for the decision process.

d) Show Result: If the user chooses this option, the program shows the report to the user from the screen (As described Step 4).

e) End Program: If the user chooses this option, program show report to the user (As described Step

4) and write output file that given with the -o option and terminated.

f) Appendix section has a screen and file outputs. Please create the same output for your program.

4. Your program must gather statistics, compute, and report the following information:

a) The average waiting time that all jobs spend in the wait queue. b) The waiting time that each job spends in the wait queue. 5. You can get more information for CPU Scheduling methods from your textbook (chapter 5). Some Scheduling methods not run in Preemptive mode. So take care of it.

APPENDIX File Input.txt 5:0:3 4:1:2 3:1:1 4:2:2 3:3:1

output.txt/Screen output

Scheduling Method: First Come First Served Process Waiting Times: P1: 0 ms P2: 4 ms P3: 8 ms P4: 10 ms P5: 13 ms Average Waiting Time: 7 ms

Scheduling Method: Shortest Job First Non-Preemptive Process Waiting Times: P1: 0 ms P2: 10 ms P3: 4 ms P4: 13 ms P5: 5 ms Average Waiting Time: 6.4 ms

Scheduling Method: Shortest Job First Preemptive Process Waiting Times: P1: 6 ms P2: 10 ms P3: 0 ms P4: 13 ms P5: 1 ms Average Waiting Time: 6 ms

Scheduling Method: Priority Scheduling non-preemptive Process Waiting Times: P1: 0 ms P2: 10 ms P3: 4 ms P4: 13 ms P5: 5 ms Average Waiting Time: 6.4 ms

Scheduling Method: Priority Scheduling Preemptive Process Waiting Times: P1: 14 ms P2: 6 ms P3: 0 ms P4: 9 ms P5: 1 ms Average Waiting Time: 6 ms

Scheduling Method: Round Robin Scheduling time_quantum=2 Process Waiting Times: P1: 14 ms P2: 9 ms P3: 11 ms P4: 11 ms P5: 12 ms Average Waiting Time: 11.4 ms.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions