the process node (otur process s) struct maintains their state using the state member. this 16-bit unsigned short that contains information that have been combined together using bitwise operations. you are required to use bitwise operators to change the states. | & ^ >> << description high field name H bit number 15 state flags crit unused (all Os) for defunct processes) URD C 000 exit code 876543210 14 13 12 11 10 9 all flags are individual bits inside of the unsigned short called state in the struct. each bit will either be 0 or a 1. if the bit is a 1, it represents that flag is set. if the bit is a 0, it means that flag is not set. state flags: bits 12-14 represent the current state of the process. (1-bit values) u=running state r = ready state d =defunct state critical flag: bit 11 is a flag representing if the process was set with critical run. (-c) c = critical flag high flag: bit 15 is a flag representing if the process was set with high priority. (-h) h = high flag Bits 0-7 are the lower 8 bits of the Exit Code when the process finished running on the CPU. otur process s *otur select(otur schedule s *schedule); choose the best process, remove it from the appropriate ready queue, then return its pointer. • algorithm to find the best process to choose: if there are any processes in the ready queue - high linked list, start there: if there are critical processes, the best is the first one in the list. if not, then the best is the first process in the list. only if there are none in ready queue - high, then go to ready queue - normal: the best is the first process in the list. • once you have found the best process, remove that process from the linked list it is in. remember to update the pointers! • then set the selected process' age to 0 (it was just picked) • set the running state bit of the state member to a 1. only one of the three state flags should be set (1) at any given time. this means ready and defunct bits should be Os. make sure to set this without changing the critical or high bits. • then set the selected process' next to null. • finally, return a pointer to that same process you just removed from the linked list. return pointer to the same selected process or return a null if the two ready queues were both empty or if any error conditions were found

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

write the code for this function

Otur_process_s *otur_select(Otur_schedule_s *schedule) {
}
the process node (otur process s) struct maintains their state using the state member. this 16-bit
unsigned short that contains information that have been combined together using bitwise operations.
you are required to use bitwise operators to change the states.
| & ^ >> <<
description high
field name H
bit number 15
state flags crit unused (all Os) for defunct processes)
URD C 000
exit code
876543210
14 13 12 11 10 9
all flags are individual bits inside of the unsigned short called state in the struct. each bit will either be
0 or a 1. if the bit is a 1, it represents that flag is set. if the bit is a 0, it means that flag is not set.
state flags: bits 12-14 represent the current state of the process. (1-bit values)
u=running state r = ready state d =defunct state
critical flag: bit 11 is a flag representing if the process was set with critical run. (-c)
c = critical flag
high flag: bit 15 is a flag representing if the process was set with high priority. (-h)
h = high flag
Bits 0-7 are the lower 8 bits of the Exit Code when the process finished running on the CPU.
Transcribed Image Text:the process node (otur process s) struct maintains their state using the state member. this 16-bit unsigned short that contains information that have been combined together using bitwise operations. you are required to use bitwise operators to change the states. | & ^ >> << description high field name H bit number 15 state flags crit unused (all Os) for defunct processes) URD C 000 exit code 876543210 14 13 12 11 10 9 all flags are individual bits inside of the unsigned short called state in the struct. each bit will either be 0 or a 1. if the bit is a 1, it represents that flag is set. if the bit is a 0, it means that flag is not set. state flags: bits 12-14 represent the current state of the process. (1-bit values) u=running state r = ready state d =defunct state critical flag: bit 11 is a flag representing if the process was set with critical run. (-c) c = critical flag high flag: bit 15 is a flag representing if the process was set with high priority. (-h) h = high flag Bits 0-7 are the lower 8 bits of the Exit Code when the process finished running on the CPU.
otur process s *otur select(otur schedule s *schedule);
choose the best process, remove it from the appropriate ready queue, then return its pointer.
• algorithm to find the best process to choose:
if there are any processes in the ready queue - high linked list, start there:
if there are critical processes, the best is the first one in the list.
if not, then the best is the first process in the list.
only if there are none in ready queue - high, then go to ready queue - normal:
the best is the first process in the list.
• once you have found the best process, remove that process from the linked list it is in.
remember to update the pointers!
• then set the selected process' age to 0 (it was just picked)
• set the running state bit of the state member to a 1.
only one of the three state flags should be set (1) at any given time.
this means ready and defunct bits should be Os.
make sure to set this without changing the critical or high bits.
• then set the selected process' next to null.
• finally, return a pointer to that same process you just removed from the linked list.
return pointer to the same selected process or return a null if the two ready queues were
both empty or if any error conditions were found
Transcribed Image Text:otur process s *otur select(otur schedule s *schedule); choose the best process, remove it from the appropriate ready queue, then return its pointer. • algorithm to find the best process to choose: if there are any processes in the ready queue - high linked list, start there: if there are critical processes, the best is the first one in the list. if not, then the best is the first process in the list. only if there are none in ready queue - high, then go to ready queue - normal: the best is the first process in the list. • once you have found the best process, remove that process from the linked list it is in. remember to update the pointers! • then set the selected process' age to 0 (it was just picked) • set the running state bit of the state member to a 1. only one of the three state flags should be set (1) at any given time. this means ready and defunct bits should be Os. make sure to set this without changing the critical or high bits. • then set the selected process' next to null. • finally, return a pointer to that same process you just removed from the linked list. return pointer to the same selected process or return a null if the two ready queues were both empty or if any error conditions were found
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Knowledge Booster
Fundamentals of Computer System
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
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