Question
Process Data: process goes {CPU burst, I/O time, CPU burst, I/O time, .., last CPU burst} P1 { 6, 21, 9, 28, 5, 26, 4,
Process Data: process goes {CPU burst, I/O time, CPU burst, I/O time, .., last CPU burst} P1 { 6, 21, 9, 28, 5, 26, 4, 22, 3, 41, 6, 45, 4, 27, 8 , 27, 3 } P2 { 19, 48, 16, 32, 17, 29, 6, 44, 8, 34, 21, 34, 19, 39, 10, 31, 7 } P3 { 12, 14, 6, 21, 3, 29, 7, 45, 8, 54, 11, 44, 9 } P4 { 11, 45, 5, 41, 6, 45, 8, 51, 4, 61, 13, 54, 11, 61, 10 } P5 { 16, 22, 15, 21, 12, 31, 14, 26, 13, 31, 16, 18, 12, 21, 10, 33, 11 } P6 { 20, 31, 22, 30, 25, 29, 11, 44, 17, 34, 18, 31, 6, 22, 16 } P7 { 3, 44, 7, 24, 6, 34, 5, 54, 4, 24, 7, 44, 6, 54, 5, 21, 6, 43, 4 } P8 { 15, 50, 4, 23, 11, 31, 4, 31, 3, 47, 5, 21, 8, 31, 6, 44, 9}
We are going to use an object-oriented programming language such as C++ to implement this simulation. The task information will be read from an input file and stored in a data structure. It will start simulating the scheduling algorithm accordingly, initially moving from process to process. The file will contain an array for the CPU bursts and IO times with all fields as integer type with the process ID being a unique number for each and pass it onto the structure. We will have an integer for the current CPU burst, current IO and to represent the current state, whether waiting in ready queue, executing, in IO or completed execution. When a task is chosen to run, the simulator will print out a message indicating what process ID is chosen. If no task is running, an idle message will print to let the user know. Variables will be used accordingly to represent the response time, wait time, and turn around time calculations. Variables will also be used to indicate the queue level in MLQF. We will implement a thread-safe ready queue using a linked list.
I want to write the FCFS in C++ using the information above.
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