Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ OR C PROGRAM/ Describe code and document Giorgio's Discrete Event Simulator Description The programs that we execute require different services from our machines at

C++ OR C PROGRAM/ Describe code and document

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Giorgio's Discrete Event Simulator Description The programs that we execute require different services from our machines at different times: sometimes they're crunching numbers using the CPU. Other times, they read from a disk or network device. Still other times they're doing nothing but waiting for something to happen, for example: a disk read to finish, a packet to arrive from a network device, a user to click on something with a mouse, or simply waiting for some other running program to finish using some needed component. In this assignment, you'll create a discrete event simulation e in C that models the very simplified machine pictured. Some additional information about discrete event simulation is at Supplemental Information Discrete-Event Simulation Problem ] INPUT CPU OUTPUT disk1 The purpose of the assignment is to gain some understanding of how processes move through a computing system and to put into practice some things that you've learned in 2107 and 2168, but might not have had a chance to use in a while. When a job arrives (perhaps because a user double-clicked on an icon to start a program), it needs to spend some amount of time executing using the CPU. It then either performs 1/O on one of two disks and returns to use the CPU, or the job is finished. Jobs alternate between the CPU and I/O devices in this manner until they're finished It's possible that when a job arrives to use a device, the device is busy servicing another program. In this case, the job must wait in a queue until the device is no longer busy. In this assignment, all of your device queues are FIFO, however, this is not necessarily the case in real systems. For this assignment, we'll frequently note or record the time; however, we'll use a "logical clock" and think of things in terms that sound like, "at time 37, job 6 spent 5 units of time at the CPU" rather than "at 2:30:01 PM, job 6 spent 300 microseconds at the CPU". In your simulation, the amount of time that a job spends using the CPU, whether or not it's finished (has more computing), which disk contains the file a job needs, and many other properties are determined at runtime, at random. To generate random numbers in C, take a look at the Standard C Library functions rand) and srand) (so that your program doesn't use the same pseudo-random numbers in each run Basic Mechanism The system behaves as follows: The system runs from INIT_TIME (usually O) to FIN TIME .Jobs enter the system with an interarrival time that is uniformly distributed between ARRIVE MIN and ARRIVE MAX Once a job has finished a round of processing at the CPU, the probability that it exits the system (instead of doing a disk read and then further computation) is QUIT PROB. When a job needs to do disk I/O, it uses the disk that's the least busy, i.e., the disk whose queue is the shortest. (This might seem a bit silly, but we can pretend that each disk has the same information.) If the disk queues are of equal length, choose one of the disks at random Giorgio's Discrete Event Simulator Description The programs that we execute require different services from our machines at different times: sometimes they're crunching numbers using the CPU. Other times, they read from a disk or network device. Still other times they're doing nothing but waiting for something to happen, for example: a disk read to finish, a packet to arrive from a network device, a user to click on something with a mouse, or simply waiting for some other running program to finish using some needed component. In this assignment, you'll create a discrete event simulation e in C that models the very simplified machine pictured. Some additional information about discrete event simulation is at Supplemental Information Discrete-Event Simulation Problem ] INPUT CPU OUTPUT disk1 The purpose of the assignment is to gain some understanding of how processes move through a computing system and to put into practice some things that you've learned in 2107 and 2168, but might not have had a chance to use in a while. When a job arrives (perhaps because a user double-clicked on an icon to start a program), it needs to spend some amount of time executing using the CPU. It then either performs 1/O on one of two disks and returns to use the CPU, or the job is finished. Jobs alternate between the CPU and I/O devices in this manner until they're finished It's possible that when a job arrives to use a device, the device is busy servicing another program. In this case, the job must wait in a queue until the device is no longer busy. In this assignment, all of your device queues are FIFO, however, this is not necessarily the case in real systems. For this assignment, we'll frequently note or record the time; however, we'll use a "logical clock" and think of things in terms that sound like, "at time 37, job 6 spent 5 units of time at the CPU" rather than "at 2:30:01 PM, job 6 spent 300 microseconds at the CPU". In your simulation, the amount of time that a job spends using the CPU, whether or not it's finished (has more computing), which disk contains the file a job needs, and many other properties are determined at runtime, at random. To generate random numbers in C, take a look at the Standard C Library functions rand) and srand) (so that your program doesn't use the same pseudo-random numbers in each run Basic Mechanism The system behaves as follows: The system runs from INIT_TIME (usually O) to FIN TIME .Jobs enter the system with an interarrival time that is uniformly distributed between ARRIVE MIN and ARRIVE MAX Once a job has finished a round of processing at the CPU, the probability that it exits the system (instead of doing a disk read and then further computation) is QUIT PROB. When a job needs to do disk I/O, it uses the disk that's the least busy, i.e., the disk whose queue is the shortest. (This might seem a bit silly, but we can pretend that each disk has the same information.) If the disk queues are of equal length, choose one of the disks at random

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions