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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education