Question: #include #include #include #include / / Headers as needed typedef enum { false , true } bool; / / Allows boolean types in C /
#include
#include
#include
#include
Headers as needed
typedef enum false true bool; Allows boolean types in C
Defines a job struct
typedef struct Process
uintt A; A: Arrival time of the process
uintt B; B: Upper Bound of CPU burst times of the given random integer list
uintt C; C: Total CPU time required
uintt M; M: Multiplier of CPU burst time
uintt processID; The process ID given upon input read
uintt status; is unstarted, is ready, is running, is blocked, is terminated
intt finishingTime; The cycle when the the process finishes initially
uintt currentCPUTimeRun; The amount of time the process has already run time in running state
uintt currentIOBlockedTime; The amount of time the process has been IO blocked time in blocked state
uintt currentWaitingTime; The amount of time spent waiting to be run time in ready state
uintt IOBurst; The amount of time until the process finishes being blocked
uintt CPUBurst; The CPU availability of the process has to be to move to running
intt quantum; Used for schedulers that utilise preemption
bool isFirstTimeRunning; Used to check when to calculate the CPU burst when it hits running mode
struct Process nextInBlockedList; A pointer to the next process available in the blocked list
struct Process nextInReadyQueue; A pointer to the next process available in the ready queue
struct Process nextInReadySuspendedQueue; A pointer to the next process available in the ready suspended queue
process;
uintt CURRENTCYCLE ; The current cycle that each process is on
uintt TOTALCREATEDPROCESSES ; The total number of processes constructed
uintt TOTALSTARTEDPROCESSES ; The total number of processes that have started being simulated
uintt TOTALFINISHEDPROCESSES ; The total number of processes that have finished running
uintt TOTALNUMBEROFCYCLESSPENTBLOCKED ; The total cycles in the blocked state
const char RANDOMNUMBERFILENAME "randomnumbers";
const uintt SEEDVALUE ; Seed value for reading from file
Additional variables as needed
Reads a random nonnegative integer X from a file with a given line named randomnumbers in the current directory
uintt getRandNumFromFileuintt line, FILE randomnumfilep tr
uintt end, loop;
char str;
rewindrandomnumfileptr; reset to be beginning
forend loop ;loop
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
