Your task is to modify the scheduler in Project 8 so the jobs with higher priority are added before the jobs with lower priority. You will make the following change to the program: Modify the add_job function such that instead of adding to the end of the linked list, a job is added to an ordered linked list. A new job is added to an ordered linked list by priority. Jobs with higher priority are added before the jobs with lower priority. The list remains ordered by priority after the new job is added. If a new job has the same priority as other jobs, the new job will be added as the last one of the same priority. Example picture attached below

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question

Task (C Language)

Your task is to modify the scheduler in Project 8 so the jobs with higher priority are added before the jobs with lower priority. You will make the following change to the program:

Modify the add_job function such that instead of adding to the end of the linked list, a job is added to an ordered linked list. A new job is added to an ordered linked list by priority. Jobs with higher priority are added before the jobs with lower priority. The list remains ordered by priority after the new job is added. If a new job has the same priority as other jobs, the new job will be added as the last one of the same priority.

Example picture attached below

Example (your program must follow this format precisely)
List of operation codes:
'h' for help;
'a' for adding a job to the scheduler;
'p' for removing a job from the scheduler;
'u' for searching jobs per user;
'j' for searching jobs per capacity;
'1' for listing all jobs;
'q' for quit.
Enter operation code: a
Enter the name of the job: a
Enter the name of the user: a
Enter the number of CPUs: 1
Enter the number of GPUs: 1
Enter the amount of memory: 1
Enter the amount of time: 1
Enter the priority: 1
Enter operation code: a
Enter the name of the job: a
Enter the name of the user: a
Enter the number of CPUs: 2
Enter the number of GPUs: 2
Enter the amount of memory: 2
Enter the amount of time: 2
Enter the priority: 2
Enter operation code: a
Enter the name of the job: b
Enter the name of the user: b
Enter the number of CPUs: 1
Enter the number of GPUs: 1
Enter the amount of memory: 1
Enter the amount of time: 1
Enter the priority: 1
Enter operation code: a
Enter the name of the job: c
Enter the name of the user: c
Enter the number of CPUs: 3
Enter the number of GPUs: 3
Enter the amount of memory: 3
Enter the amount of time: 3
Enter the priority: 3
Transcribed Image Text:Example (your program must follow this format precisely) List of operation codes: 'h' for help; 'a' for adding a job to the scheduler; 'p' for removing a job from the scheduler; 'u' for searching jobs per user; 'j' for searching jobs per capacity; '1' for listing all jobs; 'q' for quit. Enter operation code: a Enter the name of the job: a Enter the name of the user: a Enter the number of CPUs: 1 Enter the number of GPUs: 1 Enter the amount of memory: 1 Enter the amount of time: 1 Enter the priority: 1 Enter operation code: a Enter the name of the job: a Enter the name of the user: a Enter the number of CPUs: 2 Enter the number of GPUs: 2 Enter the amount of memory: 2 Enter the amount of time: 2 Enter the priority: 2 Enter operation code: a Enter the name of the job: b Enter the name of the user: b Enter the number of CPUs: 1 Enter the number of GPUs: 1 Enter the amount of memory: 1 Enter the amount of time: 1 Enter the priority: 1 Enter operation code: a Enter the name of the job: c Enter the name of the user: c Enter the number of CPUs: 3 Enter the number of GPUs: 3 Enter the amount of memory: 3 Enter the amount of time: 3 Enter the priority: 3
Enter operation code: a
Enter the name of the job: c
Enter the name of the user: c
Enter the number of CPUs: 1
Enter the number of GPUs: 1
Enter the amount of memory: 1
Enter the amount of time: 1
Enter the priority: 1
Enter operation code: 1
I Job name
I c
|-
I a
I a
I b
|--
| C
|-
Enter operation code: q
I User name
I c
I a
I a
I b
| C
|
|
|
|
CPUs | GPUs | Mem. | Time | Priority I
‒‒‒‒‒‒ |‒‒‒‒‒‒‒‒‒‒‒‒|
3 1
31
21
1 I
1 I
11
21
1 I
1 I
1 I
31
21
1 I
1 |
1 I
3.00 I
2.00 I
1.00 I
1.00 I
1.00 I
21
Transcribed Image Text:Enter operation code: a Enter the name of the job: c Enter the name of the user: c Enter the number of CPUs: 1 Enter the number of GPUs: 1 Enter the amount of memory: 1 Enter the amount of time: 1 Enter the priority: 1 Enter operation code: 1 I Job name I c |- I a I a I b |-- | C |- Enter operation code: q I User name I c I a I a I b | C | | | | CPUs | GPUs | Mem. | Time | Priority I ‒‒‒‒‒‒ |‒‒‒‒‒‒‒‒‒‒‒‒| 3 1 31 21 1 I 1 I 11 21 1 I 1 I 1 I 31 21 1 I 1 | 1 I 3.00 I 2.00 I 1.00 I 1.00 I 1.00 I 21
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Concept of Threads
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr