Question: Using C or C++, can use STD library. Priority-based quantum code with the fork() function Please post a screenshot of the output for a quick
Using C or C++, can use STD library. Priority-based quantum code with the fork() function
Please post a screenshot of the output for a quick thumbs-up.
Using the example input file presented before, the scheduling queue is process creation mechanism in UNIX using the fork function PID Execution Priority Specifications Time You must write a program that generates an offline scheduling solution based on a priority queue mechanism. After your parent process determines the order of execution of the processes, it will create and execute them based on this order 15 Implementation Input Format: Your program should read its input from stdin (C++ cin) and use input redirection as in: You will have two types of processes: 1. Parent process: is the process that reads the input file, generates the scheduling queue, prints the priority queue, creates the child processes (one at a time), and waits for all the child processes to assignment1 input1.txt This input will look like: Il Quantum Il Execution time and Priority complete before ending its execution 4 9 3 9 2 15 2. Child processes: these are the processes created by the parent process. Each child process will perform the following operations: prints its information (PID, execution time, priority), sleeps for the number of seconds based on the execution time, and prints . The quantum represents the maximum amount of time that a process can use the processor The execution time is the amount of time (in seconds) needed by the process to complete its execution. This parameter will have a value between that it has completed its execution. 1 and quantum *2. Based on the previous example, the corresponding output is The priority will be used to sort the processes in the ready queue (the higher the value, the lower the . Scheduling queue The parent process will assign a process identifier The PID is a unique integer value that starts in 0 and increments by one priority). (PID) to each child process per child process in the input file Process 0: exec time-3, priority9 Process 1: exec time-3, priority9 Process 1 ends Process 0: exec time-1, priority9 Process 0 ends Process 2: exec time- 2, priority15 Process 2 ends After reading the input file and assigning the PID to the child processes, the parent process will generate the scheduling queue that defines the order of execution of the child processes. HINTS Note: If a child process has an execution time greater than the quantum, it will be divided into two processes. will take its normal place in the priority queue, while the second part of the process The first part of the process * You can safely assume that the input files will will be considered as the last element of the with the same priority always be in the proper format and that the maximum number of processes is 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
