Q1. Write a program in C++ to implement the Priority based Scheduling algorithm (Non-preemptive). Assuming arrival...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Q1. Write a program in C++ to implement the Priority based Scheduling algorithm (Non-preemptive). Assuming arrival time for all processes is zero, the program should ask the user to input the following (ignore the explanation in brackets). 1. Number of processes (not more than 10 processes) 2. The CPU time required by each process (CPU Burst Time) 3. The priority of each process (the integer values between 1 and 10, inclusive). The lower the value, the higher the priority. In case of equal priorities (conflict resolution), always give preference to the lowest indexed process. The program should then calculate the following: 1. Waiting time for each process 2. Average waiting time 3. Turnaround time for each process 4. Average turnaround time Note: 1. You are NOT allowed to use any readymade library constructs (linked lists, queues, etc.) or C++ Standard Template Library (STL) functions. Marks shall be deducted for violation. 2. Your program output format must match the sample input/output given on the next page. Sample input/output: Enter Total Number of Process:4 Enter Burst Time and Priority P[1] Burst Time: 14 Priority: 5 P[2] Burst Time:22 Priority:1 P[3] Burst Time: 17 Priority:3 P[4] Burst Time:5 Priority:2 Process P[2] P[4] P[3] P[1] Burst Time 22 5 17 14 Average Waiting Time=23 Average Turnaround Time=37 Waiting Time 0 22 27 44 Turnaround Time 22 27 44 58 Q1. Write a program in C++ to implement the Priority based Scheduling algorithm (Non-preemptive). Assuming arrival time for all processes is zero, the program should ask the user to input the following (ignore the explanation in brackets). 1. Number of processes (not more than 10 processes) 2. The CPU time required by each process (CPU Burst Time) 3. The priority of each process (the integer values between 1 and 10, inclusive). The lower the value, the higher the priority. In case of equal priorities (conflict resolution), always give preference to the lowest indexed process. The program should then calculate the following: 1. Waiting time for each process 2. Average waiting time 3. Turnaround time for each process 4. Average turnaround time Note: 1. You are NOT allowed to use any readymade library constructs (linked lists, queues, etc.) or C++ Standard Template Library (STL) functions. Marks shall be deducted for violation. 2. Your program output format must match the sample input/output given on the next page. Sample input/output: Enter Total Number of Process:4 Enter Burst Time and Priority P[1] Burst Time: 14 Priority: 5 P[2] Burst Time:22 Priority:1 P[3] Burst Time: 17 Priority:3 P[4] Burst Time:5 Priority:2 Process P[2] P[4] P[3] P[1] Burst Time 22 5 17 14 Average Waiting Time=23 Average Turnaround Time=37 Waiting Time 0 22 27 44 Turnaround Time 22 27 44 58
Expert Answer:
Answer rating: 100% (QA)
Below is an example of a simple C program implementing the Priority based Scheduling algorithm Nonpreemptive based on your requirements include using ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Write a program in C that will display an integer multiplication table. It will take two inputs from the user the X and Y which is the number of rows and columns for the table. For example, if the...
-
Read the case study about Joy Jowie Inc and write a detailed paper about it
-
The J&B Card Shop sells calendars featuring a different Colonial picture for each month. The once-a-year order for each year's calendar arrives in September. From past experience the...
-
Determine the tax liability, marginal tax rate, and average tax rate (rounded to two decimal places) in each of the following cases. Use the tax tables to determine tax liability. a. Single taxpayer,...
-
Explain how an auditor could perform a transaction walk-through for purchases and cash disbursements.
-
The Dahlia Medical Center has 30 labor rooms, 15 combination labor and delivery rooms, 3 delivery moms, and I special delivery room reserved for complicated births. All of these facilities operate...
-
Compare and contrast microkernel and monolithic kernel architectures. What are the fundamental trade-offs between these two design paradigms in terms of performance, security, and maintainability ?
-
Fill in the missing values in the table below: Nominal Interest Real Interest Rate Inflation ate 4 3 12 |
-
Resources Manager Mr. Ray Ben, that upcoming board meeting has been postponed from May 10, 2022 to May 15, 2022 due to some changes in Comparany's major staffing events. Tell Mr. Ben that you want...
-
Decision Point: Motivating Others You task Mario with improving guide morale during this important last week. He tells you several of his ideas and his reasoning behind each. Which one of the...
-
Case II. qa= qb= +6.5 C and qc = qd=-6.5 C. O qa Oqc (e) Due to symmetry the direction of the net force is D. In the -y direction. N qb Oqd (d) In your notebook, draw the forces on q due to qar 9b,...
-
In the figure below q1 = -7.10 \mu C, q2 = +8.00 \mu C, and q3 = magnitude of the net force in newtons on q3 ? k = 9.00 x 109 N.m2.C-2 longrightarrow +6.00 \mu C. Find the
-
Answer questions 1-3 & 5 in terms of M and I only. Assume the objects below rotate in the horizontal plane, start from rest and there is no friction. 1. Two identical balls each of mass M are...
-
2. Three charges are located at the corners of an equilateral triangle as shown. Each side of the triangle has a length 2.75 cm. Each charge has a magnitude of 5.0 C. The signs of the charges are...
-
AMZ Supergloves Co produces rubber gloves for export market. In one f the recent quality testing, 200 rubber gloves were subjected to 7,000 hours of testing. After 3,000 hours, 10 of the gloves tore...
-
Find the volume of the described solid S. A frustum of a right circular cone with height h, lower base radius R, and top radius r -r- --R
-
Create the following matrix by typing one command. Do not type individual elements explicitly. 10 01 1020 002 8 26 00 3 6 32
-
A cross section of a river with measurements of its depth at intervals of 40 ft: is shown in the figure. Use numerical integration to estimate the cross-sectional area of the river. 607179 49442794 62
-
Write a user-defined function that plots a triangle and the circle that circumscribes the triangle, given the coordinates of its vertices. For the function name and arguments, use TriCirc (A, B, C)....
-
Using the demand and cost curves of an individual firm in oligopoly, demonstrate the effects of each of the following: a. The Clean Air Act b. The Nutrition and Labeling Act c. A ban on smoking...
-
Which of the three types of government policiesantitrust, social regulation, and economic regulationis the basis for each of the following? a. Beautician education standards b. Certified Public...
-
Explain why a market in which broadcast licenses can be purchased might be more efficient than having the FCC assign licenses on some basis designed by the FCC.
Study smarter with the SolutionInn App