- Asked 4/10
- 2074 Bhadra · 6 marks
- 2072 Magh · 6 marks
- 2071 Bhadra · 6 marks
- 2070 Bhadra · 3 marks
CPU simulation with example
Short answer
CPU simulation uses a queueing model: jobs queue for CPU under a policy like round‑robin. After a burst, jobs may go to disk. Example: arrivals mean 10ms, CPU 6ms, 30% go to disk (5ms). Run to compare quanta 2,4,8ms for best response time.
Explain CPU simulation with example (sketching a simulation model of a computer system).
CPU simulation models how a computer's processor handles the workload of jobs. It is done at a high level of abstraction as a queueing model: jobs arrive, wait in the ready queue, receive CPU service, use I/O devices, and leave. Its purpose is to estimate CPU utilisation, throughput and response time and to test scheduling policies without changing the real machine.
Model components
- Jobs (entities): arrive with an inter-arrival distribution (for example exponential).
- Ready queue: jobs waiting for the CPU.
- CPU (server): serves according to the scheduling policy (FCFS, SJF, round robin with quantum q).
- I/O devices (disk, printer) with their queues: a job leaves the CPU for I/O and returns.
- Statistics: utilisation, mean queue length, response time, throughput.
Sketch of the model
arrivals --> [ready queue] --> ( CPU ) --> exit
^ |
| quantum | I/O request
| expired v
+---------- [I/O queue] -> (Disk)
Logic (round robin, quantum 4 ms)
- A job arrives; if the CPU is free it starts, otherwise it joins the ready queue.
- CPU runs it for min(quantum, remaining burst).
- If it finishes, it leaves. If it needs I/O, it goes to the disk queue and returns to the ready queue later. If the quantum expires, it goes to the back of the ready queue.
- Events: arrival, CPU burst end, I/O completion.
Example
Jobs arrive every 10 ms on average. CPU time per job averages 6 ms; 30% of bursts end in a disk request with service time 5 ms.
- Offered CPU utilisation is about 6/10 = 0.6.
- By running a few thousand simulated jobs, we obtain mean waiting time in the ready queue and disk utilisation.
- The analyst repeats the run with quantum 2, 4 and 8 ms to select the quantum that gives the best response time.
Simulation is preferred when scheduling and I/O interaction make exact analysis difficult.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Simulation of computer system serving WWW · Simulation and Modeling, chapter 10 · asked 2×
- Continuous system simulation; analog computer example · Simulation and Modeling, chapter 3
- Define system, model, simulation · Simulation and Modeling, chapter 1
- Levels of abstraction in computer simulation · Simulation and Modeling, chapter 10
- CPU simulation at lower abstraction level · Simulation and Modeling, chapter 10
- Analog computer model of the liver · Simulation and Modeling, chapter 3 · asked 5×
- CPU and IOP communication · Computer Organization and Architecture, chapter 7 · asked 2×
- General register organization in CPU · Computer Organization and Architecture, chapter 2
- Components of CPU · Computer Organization and Architecture, chapter 2
- DMA vs CPU memory request · Computer Organization and Architecture, chapter 7