The simulator will consists of following classes: (i) Process: The data members of this class should store process id, arrival time in the ready queue, CPU burst time, completion time, turn around time, waiting time, and response time. The member functions of this class should assign values to the data members and print them. A constructor should also be used. (ii) Process Creator: This class will create an array of processes and assign a random arrival time and burst time to each process. Data members, constructor and member functions can be written accordingly. (iii) Scheduler: This class will implement the scheduling algorithm. The class will maintain a ready queue of infinite capacity (i.e., any number of processes can be accommodated in the queue). The ready queue should be implemented using the min-Heap data structure where the highest priority process will be the root. The priority of the process will depend on the scheduling algorithm.

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
The simulator will consists of following classes:
(i) Process: The data members of this class should store process id, arrival time in the ready queue,
CPU burst time, completion time, turn around time, waiting time, and response time. The member
functions of this class should assign values to the data members and print them. A constructor
should also be used.
(ii) Process Creator: This class will create an array of processes and assign a random arrival time
and burst time to each process. Data members, constructor and member functions can be written
accordingly.
(iii) Scheduler: This class will implement the scheduling algorithm. The class will maintain a ready
queue of infinite capacity (i.e., any number of processes can be accommodated in the queue). The
ready queue should be implemented using the min-Heap data structure where the highest priority
process will be the root. The priority of the process will depend on the scheduling algorithm.
The ready queue (i.e., min-heap) should be implemented as a class where different heap operations
should be its member functions. Students have to implement three scheduling algorithms, viz., First
Come First Serve (FCFS), Round Robin and Completely Fair Scheduler (CFS). While running the
program, the user should be asked the choice of scheduling algorithm. The CFS scheduling will be
implemented using Red Black Tree. So, in case of CFS, ready queue will be implemented using Red
Black Tree. To understand the CFS Scheduling following youtube lecture can be followed.
https://www.youtube.com/watch?v=scfDO0f9pww
However, other internet sources can also be checked.
(iv) Simulator: This class will start the simulation. If the simulation time is 1 second and arrival
time and burst time of a process are in terms of milliseconds then the class will run a 'for' loop from
Transcribed Image Text:The simulator will consists of following classes: (i) Process: The data members of this class should store process id, arrival time in the ready queue, CPU burst time, completion time, turn around time, waiting time, and response time. The member functions of this class should assign values to the data members and print them. A constructor should also be used. (ii) Process Creator: This class will create an array of processes and assign a random arrival time and burst time to each process. Data members, constructor and member functions can be written accordingly. (iii) Scheduler: This class will implement the scheduling algorithm. The class will maintain a ready queue of infinite capacity (i.e., any number of processes can be accommodated in the queue). The ready queue should be implemented using the min-Heap data structure where the highest priority process will be the root. The priority of the process will depend on the scheduling algorithm. The ready queue (i.e., min-heap) should be implemented as a class where different heap operations should be its member functions. Students have to implement three scheduling algorithms, viz., First Come First Serve (FCFS), Round Robin and Completely Fair Scheduler (CFS). While running the program, the user should be asked the choice of scheduling algorithm. The CFS scheduling will be implemented using Red Black Tree. So, in case of CFS, ready queue will be implemented using Red Black Tree. To understand the CFS Scheduling following youtube lecture can be followed. https://www.youtube.com/watch?v=scfDO0f9pww However, other internet sources can also be checked. (iv) Simulator: This class will start the simulation. If the simulation time is 1 second and arrival time and burst time of a process are in terms of milliseconds then the class will run a 'for' loop from
t=0 to 1000. At each iteration, the class will execute all the necessary functions and capture the
required values. The class will also print the output in the following ways:
(a) A file named as processes.txt will be created which will contain a table as follows. The file
handling coding can be done using C programming.
Process Id Arrival Time Burst Time
Millisecond Number
1
1
2
5
5
5
8
Here, the number of rows will depend on the number of processes.
(b) A file named as status.txt which will print a table. For each millisecond, the file will show the
process id of the processes arrived in the system, running by the processor and exiting from the
system. The number of rows in the table will depend on the number of times the 'for' loop is
running, i.e., the number of milliseconds in the simulation time. However, if in a particular
millisecond, no process arrived or exited and the process being run by the processor is the same as
that of previous millisecond then the current millisecond can be skipped from printing in the table.
For example,
Completion
Time
Process Id
1
1
2
1
23
3
2
Turn Around Waiting
Time
Time
Status
Arrived
Running
Arrived
Exit
Response
Time
Running
Arrived
Exit
The main() function should take the following input from the user: (i) Simulation time (ii) Name of
scheduling algorithm (iii) Time quantum in case of Round Robin.
Transcribed Image Text:t=0 to 1000. At each iteration, the class will execute all the necessary functions and capture the required values. The class will also print the output in the following ways: (a) A file named as processes.txt will be created which will contain a table as follows. The file handling coding can be done using C programming. Process Id Arrival Time Burst Time Millisecond Number 1 1 2 5 5 5 8 Here, the number of rows will depend on the number of processes. (b) A file named as status.txt which will print a table. For each millisecond, the file will show the process id of the processes arrived in the system, running by the processor and exiting from the system. The number of rows in the table will depend on the number of times the 'for' loop is running, i.e., the number of milliseconds in the simulation time. However, if in a particular millisecond, no process arrived or exited and the process being run by the processor is the same as that of previous millisecond then the current millisecond can be skipped from printing in the table. For example, Completion Time Process Id 1 1 2 1 23 3 2 Turn Around Waiting Time Time Status Arrived Running Arrived Exit Response Time Running Arrived Exit The main() function should take the following input from the user: (i) Simulation time (ii) Name of scheduling algorithm (iii) Time quantum in case of Round Robin.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Software Development
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