Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please post a screenshot of the program running with the code thanks. Use C + + please also please use a fstream file input called
Please post a screenshot of the program running with the code thanks. Use C please also please use a fstream file input called input.txt containing the following text as your input:INTERACTIVE new process
CPU
TTY
CPU
DISK
CPU
REALTIME new process
DEADLINE absolute time
CPU Objective
This assignment will introduce you to CPU scheduling
Specifications
You are to simulate the execution of processes by a computer system with a large
memory, one terminal per user, a CPU, and one disk drive. Each process will be
deacribed by its class REALTIME or INTERACTIVE and its start time followed by a
sequence of resource requests.
These resources requests will include CPU requests CPO disk reads DISK and
terminal accesses TTY In addition, all realtime processes will have a DRADLINE, by
which they must complete.
Your input will be a sequence of pairs as in:
All time will be expressed in milliseconds.
Your program should maintain separate ready queves for realtime and interactive
processes and give absolute priority to realtime processes over interactive processes:
a Your acheduler should never allocate the CPU to an interactive process as long as
there are one or more realtime processes in the ready state.
b When a realtime process returns to the ready queve and finds that the CPU is
currently allocated to an interactive process, the scheduler should take the CPU away
from the interactive process and give it to the realtime process. The preempted
process should retum to the end of the ready queve for interactive processes. When
this is the case your program should update the duration of the CPU request by
subtracting from the original duration the time the process has already spent in the
runing state.
Diak acheduling will be strictly furstcome furstserved FCFS without any distinction of
process classes.
To simplify your life, we will also assume that:
a there is enough memory space for all processes,
b context switch times can be neglected,
c nser think times are included in the terminal access times, and
d each process reads and writes to a different terminal.
Your program should read its input file name through input redirection as in:
Aegt input. txt
If by accident, two resources allocations need to be made at the same time, you should
allocate the CPU first then the disk. and then the terminals.
Your program should have one process table with one entry per process containing a
process sequence number, the process class, its process arrival time and its current status
READY RONNING, WAITING
It ahould print out one line of output every time a process starts or terminates. This line
should include the process sequence number, its class and the current simulated time in
milliseconds.
When all the processes in your input stream have completed, your simulator should print
a summary report listing:
a the number of realtime processes that have completed,
b the percentage of realtime processes that missed their deadline,
c the number of interactive processes that have completed,
d the total number of disk accesses,
e the average duration of a disk access including the waiting time in the disk queue
f the total time elapsed since the start of the first process,
g the CPU and disk utilizations, that is the fraction of time the CPU or the disk was
busy.Use
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started