Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C language You are writing a (console) program in order to create an array of (simulated, fake, simplified) process control blocks. The program should
In C language
You are writing a (console) program in order to create an array of (simulated, fake, simplified) process control blocks. The program should read from a file (processes.txt), one line for each process control block (format given below). You can assume that there will be no more than 600 when creating the array in this program. After all input is read in, show all processes. Then prompt the user for a priority level and output all processes with that priority level, and also a count of how many of those processes there are. Each line of the file has the following (separated by a space) (I am providing two files of processes, one with 40, one with 500. The one with 40 should be plenty for testing this program) o int processld; int userld; o int arrival Time; // time units in simulation, not actual time oint priority; // base priority int expectedTime Remaining; int expected MemoryNeed; o int expectedPctCPU; // to get an idea of whether CPU bound or 10 bound o bool realTime; // 0 or 1 - whether a real-time process or not (real-time processes may need immediate attention) Create a struct to represent the PCB. Include all of the above information PLUS the following, which is not part of the input file: o State processState; // Not input - initially NEW o int currentPriority; // can be increased or lowered based on what has happened with the process - not input - initially same as base priority int timeWaitingSoFar; // Not input - initially zero o int timeProcessingLastRun; // Not input - initially zero o int timeProcessing SoFar; // Not input - initially zero O struct processblock* nextPtr; // not used in this program Use functions to divide up the task. Use the following functions: O A function to read a line from the file and fill up a PCB A function to find and display all PCBs with a given priority level A function to display one PCB with the following format: 0Step 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