---
title: "Simulation of computer system serving WWW"
subject: "Simulation and Modeling"
chapter: 10
key: "semester_8/simulation_and_modeling:computer-system-www-request"
source: https://www.bctengineer.com/q/semester_8/simulation_and_modeling/computer-system-www-request
site: BCT Engineering
---

# Simulation of computer system serving WWW

Simulation and Modeling · Chapter 10: Simulation of computer systems

- Asked in: 2073 Magh, 6 marks; 2070 Magh, 6 marks (asked 2 times)
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_8/simulation_and_modeling/computer-system-www-request
- Whole chapter: https://www.bctengineer.com/md/semester_8/simulation_and_modeling/chapter-10

## Question

Explain the simulation model of a computer system that services requests from WWW (high level, by sketching a simulation model).

## Short answer

A web server is modelled as queues: client requests arrive, pass through CPU (check cache hit), and may queue for disk on a miss. Response leaves via NIC. The simulation estimates response time, throughput, and CPU/disk utilisation under given loads.

## Answer

A computer system serving WWW requests (a web server) can be modelled at a high level as a **network of queues**: client requests arrive over the network, are processed by the server's CPU, memory and disk, and responses are sent back through the network interface. The model estimates response time, throughput and utilisation of resources, and helps to size the server.

#### Components
- **Request source**: users (clients) generating HTTP requests, with an arrival process (Poisson) or a fixed population with think time.
- **Network / connection queue**: the listen queue, where connections wait for a server thread.
- **CPU**: parses requests, runs scripts.
- **Memory / cache**: a file or page cache; hit means no disk access.
- **Disk**: serves cache misses.
- **Network interface**: sends the response (service time depends on file size and bandwidth).

#### High-level sketch
```text
 Clients --> [Listen queue] --> ( CPU )
 (requests)                        |
                         cache hit?|
                         +--yes----+--no--> [Disk queue]->(Disk)
                         |                         |
                         v                         v
                      [NIC queue] --> (Network out) --> Clients
```

#### Model parameters
- Arrival rate (requests/s) and its distribution.
- CPU service time per request, probability of cache hit (for example 0.8), disk service time, file size distribution (heavy tailed), bandwidth.
- Limits: maximum number of threads or connections; requests beyond this are rejected.

#### Simulation procedure
1. Generate request arrivals with random inter-arrival times.
2. Each request seizes a thread, then queues for the CPU.
3. With probability 0.8 it is a cache hit; otherwise it goes to the disk.
4. It then queues for the network interface and sends the response; the response time is recorded at departure.
5. Repeat for many requests, with warm-up removed.

#### Outputs
Average and 95th-percentile response time, throughput, utilisation of CPU, disk and network link, queue lengths and number of rejected requests. The analyst can change the model (a faster CPU, a larger cache, more bandwidth) and find the bottleneck resource.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. How is a web server modelled at a high level in this answer?
   A. As a single M/M/1 queue with no other resources
   B. As a network of queues for CPU, disk and network interface
   C. As a gate-level circuit of the server hardware
   D. As a deterministic formula with no random inputs
   Answer: B. The server is a network of queues: requests move through CPU, memory/cache, disk and NIC, each a resource with a queue. (Key point: Network of queues)

2. In the model, what happens to a request after CPU processing when the page is found in the cache (hit)?
   A. It goes to the disk queue before the NIC
   B. It is rejected
   C. It skips the disk and goes to the network interface queue
   D. It returns to the listen queue
   Answer: C. A cache hit means no disk access is needed, so the request goes directly to the NIC queue; only misses use the disk. (Key point: Cache hit/miss routing)

3. Which order of steps matches the simulation procedure?
   A. Seize thread, queue for CPU, cache check (disk if miss), queue for NIC, record response time
   B. Queue for NIC, queue for CPU, disk, seize thread
   C. Disk, CPU, thread, NIC
   D. Record response time, generate arrival, queue for CPU, disk
   Answer: A. Arrivals are generated, a thread is seized, CPU is used, disk only on a miss, then NIC; response time is recorded at departure. (Key point: Simulation procedure)

4. What is the purpose of changing the model (faster CPU, larger cache, more bandwidth) and rerunning?
   A. To remove the need for random arrivals
   B. To find the bottleneck resource and size the server
   C. To make the warm-up period unnecessary
   D. To prove that the cache hit probability is always 0.8
   Answer: B. By altering parameters and watching response time and utilisation, the analyst finds the bottleneck and sizes the server. (Key point: Outputs and bottleneck)

## Related in Simulation and Modeling

- [Continuous system simulation; analog computer example](https://www.bctengineer.com/question.md?key=semester_8%2Fsimulation_and_modeling%3Acontinuous-simulation-analog-example) — Simulation and Modeling, chapter 3
- [Define system, model, simulation](https://www.bctengineer.com/question.md?key=semester_8%2Fsimulation_and_modeling%3Asystem-model-simulation-define) — Simulation and Modeling, chapter 1
- [Levels of abstraction in computer simulation](https://www.bctengineer.com/question.md?key=semester_8%2Fsimulation_and_modeling%3Acomputer-system-abstraction-levels) — Simulation and Modeling, chapter 10
- [Analog computer model of the liver](https://www.bctengineer.com/question.md?key=semester_8%2Fsimulation_and_modeling%3Aanalog-computer-liver-model) — Simulation and Modeling, chapter 3, asked 5×
- [CPU simulation at lower abstraction level](https://www.bctengineer.com/question.md?key=semester_8%2Fsimulation_and_modeling%3Acpu-lower-level-abstraction) — Simulation and Modeling, chapter 10
- [CPU simulation with example](https://www.bctengineer.com/question.md?key=semester_8%2Fsimulation_and_modeling%3Acpu-simulation-example) — Simulation and Modeling, chapter 10, asked 4×

## Related in other subjects

- [High level vs low level languages](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Ahigh-low-level-languages) — Computer Programming, chapter 1, asked 2×
- [High level languages; C versus FORTRAN](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Ahll-types-c-vs-fortran) — Computer Programming, chapter 1
- [High level languages and natural language](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Ahll-similar-natural-language) — Computer Programming, chapter 1
- [Rate analysis: WC commode, high level cistern](https://www.bctengineer.com/question.md?key=semester_7%2Festimating_and_costing%3Arate-wc-high-level-cistern) — Estimating and Costing, chapter 4
