Problem Statement: (The following problem is based on problem statements in a number of operating systems texts) For this lab, you'll be setting up 2 queues of PCBs. A process control block (PCB) is an internal structure that is used to hold information associated with a process. A process is an instance of a program that is brought into random-access memory (RAM) for execution. To simplify matters, you'll be setting up 2 queues: a ready queue and a wait queue and, PCBs each PCB will have 2 fields: a process ID or PID (a positive integer) a link field to point to the next PCB on a queue   The ready queue will have the PCBs for the processes that will be run in a first-come, first-served fashion. The wait queue will have the PCBs for the processes that will be waiting for a resource in a first-come, first-served fashion.   If the PCB at the head of the ready queue needs some resource (for example, I/O) then it will be removed from the ready queue and moved to the rear of the wait queue.  This happens, when the user selects option #2 from the menu. Otherwise, the process at the head of the ready queue is to be executed (its PCB removed from the head of the ready queue). This happens, when the user selects option #3 from the menu. Assuming the resource need for the PCB at the head of the wait queue has been met, then it will be removed from the wait queue and moved to the rear of the ready queue.  This happens, when the user selects option #1 from the menu. Set up a demo program, where you Set up the initial ready queue and wait queue Get PIDs from a data file or at the keyboard. Then, use a menu like the following to proceed:               Utility Menu:          1.) Add a PCB to the Ready Queue         2.) Add a PCB to the Wait Queue         3.) Run a process         4.) Display all of the Processes         5.) Display the Ready Queue         6.) Display the Wait Queue         7.) Exit                   Please make a selection: Input Data: Repeatedly, enter one PID at a time at the keyboard alternatively, you may set up an input data file and get the data from the file If you place a PCB with this PID on the Wait Queue, then add the next PCB to the ReadyQueue That is, as PIDs are entered at the keyboard, populate the two queues in an alternate fashion Stop the inputting, when the user does not want to enter any additional PIDs Provide an appropriate option, each time that the above menu of options is presented to the user   Processing: Set up: methods to initially populate the queues (used during the inputting) and the methods that will be called from within the above menu of options.   Output Data:  Prior to displaying contents of one or more queues, display an appropriate message to identify what is being displayed. Example 1: If option 5 is chosen from the above menu, then display a message like the following: The processes on the ready queue are: 876, 45, 1090, 231, 459 Example 2: If option 4 is chosen from the above menu, then display a message like the following: The processes on both queues are: 876, 45, 1090, 231, 459, 375, 802, 190, 621, 1023, 7643

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

Problem Statement:

(The following problem is based on problem statements in a number of operating systems texts)

For this lab, you'll be setting up 2 queues of PCBs.

A process control block (PCB) is an internal structure that is used to hold information associated with a process.

A process is an instance of a program that is brought into random-access memory (RAM) for execution.

To simplify matters, you'll be setting up

  • 2 queues:
    • a ready queue and
    • a wait queue
  • and, PCBs
    • each PCB will have 2 fields:
      • a process ID or PID (a positive integer)
      • a link field to point to the next PCB on a queue

 

The ready queue will have the PCBs for the processes that will be run in a first-come, first-served fashion.

The wait queue will have the PCBs for the processes that will be waiting for a resource in a first-come, first-served fashion.

 

If the PCB at the head of the ready queue needs some resource (for example, I/O) then it will be removed from the ready queue and moved to the rear of the wait queue.  This happens, when the user selects option #2 from the menu.

Otherwise, the process at the head of the ready queue is to be executed (its PCB removed from the head of the ready queue). This happens, when the user selects option #3 from the menu.

Assuming the resource need for the PCB at the head of the wait queue has been met, then it will be removed from the wait queue and moved to the rear of the ready queue.  This happens, when the user selects option #1 from the menu.

Set up a demo program, where you

  • Set up the initial ready queue and wait queue
    • Get PIDs from a data file or at the keyboard.
  • Then, use a menu like the following to proceed:

              Utility Menu:

         1.) Add a PCB to the Ready Queue
         2.) Add a PCB to the Wait Queue
         3.) Run a process
         4.) Display all of the Processes
         5.) Display the Ready Queue
         6.) Display the Wait Queue
         7.) Exit         

         Please make a selection:

Input Data:

  • Repeatedly, enter one PID at a time at the keyboard
      • alternatively, you may set up an input data file and get the data from the file
    • If you place a PCB with this PID on the Wait Queue, then add the next PCB to the ReadyQueue
      • That is, as PIDs are entered at the keyboard, populate the two queues in an alternate fashion
  • Stop the inputting, when the user does not want to enter any additional PIDs
  • Provide an appropriate option, each time that the above menu of options is presented to the user

 

Processing:

Set up:

      • methods to initially populate the queues (used during the inputting) and
      • the methods that will be called from within the above menu of options.

 

Output Data:

 Prior to displaying contents of one or more queues, display an appropriate message to identify what is being displayed.

Example 1:

If option 5 is chosen from the above menu, then display a message like the following:

The processes on the ready queue are:

876, 45, 1090, 231, 459

Example 2:

If option 4 is chosen from the above menu, then display a message like the following:

The processes on both queues are:

876, 45, 1090, 231, 459, 375, 802, 190, 621, 1023, 7643

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Race Condition
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