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 {
uint32_t A; // A: Arrival time of the process
uint32_t B; // B: Upper Bound of CPU burst times of the given random integer list
uint32_t C; // C: Total CPU time required
uint32_t M; // M: Multiplier of CPU burst time
uint32_t processID; // The process ID given upon input read
uint8_t status; //0 is unstarted, 1 is ready, 2 is running, 3 is blocked, 4 is terminated
int32_t finishingTime; // The cycle when the the process finishes (initially -1)
uint32_t currentCPUTimeRun; // The amount of time the process has already run (time in running state)
uint32_t currentIOBlockedTime; // The amount of time the process has been IO blocked (time in blocked state)
uint32_t currentWaitingTime; // The amount of time spent waiting to be run (time in ready state)
uint32_t IOBurst; // The amount of time until the process finishes being blocked
uint32_t CPUBurst; // The CPU availability of the process (has to be >1 to move to running)
int32_t quantum; // Used for schedulers that utilise pre-emption
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;
uint32_t CURRENT_CYCLE =0; // The current cycle that each process is on
uint32_t TOTAL_CREATED_PROCESSES =0; // The total number of processes constructed
uint32_t TOTAL_STARTED_PROCESSES =0; // The total number of processes that have started being simulated
uint32_t TOTAL_FINISHED_PROCESSES =0; // The total number of processes that have finished running
uint32_t TOTAL_NUMBER_OF_CYCLES_SPENT_BLOCKED =0; // The total cycles in the blocked state
const char* RANDOM_NUMBER_FILE_NAME= "random-numbers";
const uint32_t SEED_VALUE =200; // Seed value for reading from file
// Additional variables as needed
/**
* Reads a random non-negative integer X from a file with a given line named random-numbers (in the current directory)
*/
uint32_t getRandNumFromFile(uint32_t line, FILE* random_num_file_p tr){
uint32_t end, loop;
char str[512];
rewind(random_num_file_ptr); // reset to be beginning
for(end = loop =0;loop

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!