Mathematical Foundation of Computer Science

Chapter 12
Stochastic Processes, Queues and Reliability

Post Graduate Program in Computer Science Engineering
Mathematical Foundation of Computer Science   •   Post Graduate

12. Stochastic Processes, Queues and Reliability

Introduction and Context

Computer systems operate in environments marked by uncertainty. Requests arrive at unpredictable times, network packets experience variable delays, cloud workloads rise and fall, and hardware components fail without exact warning. Mathematical models of randomness do not eliminate this uncertainty; they provide a disciplined way to describe it, estimate its consequences, and design systems that remain effective under variable demand and imperfect operation.

This chapter develops four closely related areas: Markov chains, Poisson processes, random walks, and queuing and reliability models. Together they support the analysis of cloud platforms, communication networks, distributed services, storage systems, manufacturing systems, and service-capacity decisions. A queueing model can estimate response time and server utilization, while a reliability model can estimate the probability that a replicated service remains available. Markov models can represent changing system states, and Poisson processes can describe event arrivals such as requests, failures, or packet transmissions.

The models studied here are abstractions. Their usefulness depends on whether their assumptions are appropriate for the system being investigated. A mathematically elegant model can produce poor engineering decisions if arrival patterns, service mechanisms, dependence, or failure behavior are represented incorrectly.

Learning Objectives

After completing this chapter, a student should be able to:

1. Explain stochastic processes and distinguish discrete-time from continuous-time models.

2. Construct and analyze transition matrices for finite Markov chains.

3. Determine stationary behavior, communicating classes, recurrence, and absorption.

4. Apply Poisson-process properties to arrival and failure-event modeling.

5. Explain random walks and their relevance to algorithms and network behavior.

6. Derive and interpret fundamental results for single-server and multiserver queues.

7. Model series, parallel, standby, and repairable reliability structures.

8. Select suitable models for cloud capacity planning and communication systems.

9. Evaluate assumptions, limitations, operational risks, and ethical implications of stochastic analysis.

1. Stochastic Processes as Models of Changing Systems

A stochastic process is a family of random variables \(\{X(t):t\in T\}\), where \(t\) represents time or another ordered index. The value \(X(t)\) is the state of a system at time \(t\). If time takes integer values, the process is discrete-time; if time varies continuously, it is continuous-time. The state space may also be discrete, such as the number of jobs in a queue, or continuous, such as processor temperature.

A useful classification is therefore based on two dimensions:

  • discrete time and discrete state, as in a daily inventory model;
  • discrete time and continuous state, as in sampled sensor measurements;
  • continuous time and discrete state, as in a birth–death queue;
  • continuous time and continuous state, as in certain physical or financial models.

The central modeling question is how much of the past is required to predict the future. A process has the Markov property when, conditional on its present state, its future is independent of its past. Formally,

\[P(X_{t+1}=j\mid X_t=i,X_{t-1},\ldots,X_0)=P(X_{t+1}=j\mid X_t=i).\]

The Markov property is not a claim that systems have no history. It is a modeling decision that the current state contains sufficient information about relevant history. If it does not, the state description can sometimes be expanded—for example, by including the age of a job or the previous operating mode.

Important terminology includes state, transition, sample path, transition probability, initial distribution, and state space. The initial distribution describes uncertainty about the starting state. A transition law describes how the process evolves. A sample path is one possible realization of the process over time.

2. Markov Chains: State Transitions and Long-Run Behavior

2.1 Discrete-time Markov chains

For a finite Markov chain, let

\[p_{ij}=P(X_{n+1}=j\mid X_n=i).\]

The transition matrix \(P=[p_{ij}]\) satisfies \(p_{ij}\geq 0\) and each row sums to one. If the current probability distribution is the row vector \(\pi_n\), then

\[\pi_{n+1}=\pi_nP, \qquad \pi_n=\pi_0P^n.\]

The entry \((P^n)_{ij}\) is the probability of being in state \(j\) after \(n\) steps when starting in state \(i\). Matrix powers therefore provide a direct method for finite-horizon prediction.

Consider a service with states Available (A), Degraded (D), and Failed (F), with transition matrix

\[P=\begin{bmatrix}0.90&0.08&0.02\\0.20&0.60&0.20\\0&0&1\end{bmatrix}.\]

The failed state is absorbing: once entered, it cannot be left in this simplified model. The probability of failure within a specified number of steps can be obtained from the corresponding matrix power or from first-passage calculations.

2.2 Communication, recurrence, and periodicity

State \(i\) communicates with state \(j\) if each can be reached from the other in a finite number of transitions with positive probability. Communication partitions states into communicating classes. A class is closed if the process cannot leave it once entered. A finite chain must eventually enter a closed recurrent class, although it may spend a long time in transient states.

A state is recurrent if, starting from that state, the process returns to it with probability one. It is transient if there is a positive probability that it will never return. Periodicity concerns the possible return times. A state has period \(d\) if the greatest common divisor of all possible positive return times is \(d\). An irreducible finite chain is aperiodic when its period is one.

These ideas matter operationally. A chain representing a system that alternates deterministically between two modes is periodic; it does not converge to a single state distribution at every step, even though a long-run average may exist. Random self-transitions often remove such oscillations.

2.3 Stationary distributions

A stationary distribution \(\pi\) satisfies

\[\pi=\pi P,\qquad \sum_i\pi_i=1,\qquad \pi_i\geq0.\]

When an irreducible, finite, aperiodic chain is used, the distribution at time \(n\) converges to \(\pi\), regardless of the initial distribution. The stationary probability of a state can represent the long-run proportion of time that a server is busy, a network link is congested, or a component is degraded.

Stationarity is not the same as short-term stability. A system can have a well-defined long-run distribution while experiencing unacceptable transient delays. Capacity planning must therefore examine both transient and stationary behavior.

2.4 Absorbing chains

An absorbing state can be reached and, once reached, cannot be left. Absorbing chains are useful for modeling failure, task completion, security compromise, or customer abandonment. If transient states are placed first, the transition matrix has the form

\[P=\begin{bmatrix}Q&R\\0&I\end{bmatrix}.\]

The fundamental matrix is

\[N=(I-Q)^{-1}=I+Q+Q^2+\cdots.\]

The entry \(N_{ij}\) gives the expected number of visits to transient state \(j\) when starting in transient state \(i\). The matrix of absorption probabilities is \(B=NR\), and expected time to absorption is \(N\mathbf{1}\). These quantities can estimate expected time to service completion or expected time until an unrecoverable failure.

2.5 Continuous-time Markov chains

In a continuous-time Markov chain (CTMC), transitions occur at random times. For a finite state system, the generator matrix \(Q\) has nonnegative off-diagonal entries \(q_{ij}\), and diagonal entries

\[q_{ii}=-\sum_{j\ne i}q_{ij}.\]

The transition matrix at time \(t\) is \(P(t)=e^{Qt}\), and the distribution satisfies the forward equation \(\pi'(t)=\pi(t)Q\). CTMCs are particularly useful when events occur continuously, such as arrivals, departures, repairs, and failures.

3. Poisson Processes and Random Event Streams

A Poisson process \(\{N(t),t\geq0\}\) with rate \(\lambda\) counts events occurring up to time \(t\). It has independent increments, stationary increments, and the probability of two or more events in a sufficiently small interval is negligible compared with the probability of one event. Consequently,

\[P(N(t)=n)=e^{-\lambda t}\frac{(\lambda t)^n}{n!}.\]

The interarrival times are independent exponential random variables with mean \(1/\lambda\). The exponential distribution is memoryless:

\[P(T>s+t\mid T>s)=P(T>t).\]

This property makes Poisson and exponential assumptions analytically convenient, but real systems may exhibit burstiness, seasonality, correlation, or heavy tails.

The superposition of independent Poisson processes with rates \(\lambda_1,\ldots,\lambda_k\) is Poisson with rate \(\sum_i\lambda_i\). If each event in a Poisson process is independently classified as type 1 with probability \(p\), the type-1 events form a Poisson process of rate \(p\lambda\); this is called thinning. These results support the separation of request streams by region, tenant, or service class.

A nonhomogeneous Poisson process allows a time-dependent rate \(\lambda(t)\). The expected number of events in \([a,b]\) is \(\int_a^b\lambda(u)du\). Such a model is more appropriate for a service whose traffic varies by hour. A compound Poisson process associates a random size or cost with each event and can model aggregate data volume or batch workload.

4. Random Walks and State-Space Exploration

A random walk is a process formed by successive random increments. In a one-dimensional simple random walk,

\[S_n=S_0+Y_1+\cdots+Y_n,\]

where \(Y_i=+1\) with probability \(p\) and \(-1\) with probability \(1-p\). Its expected position is \(E[S_n]=S_0+n(2p-1)\), and its variance is \(4np(1-p)\).

Random walks model packet movement, queue-length approximations, load balancing, search procedures, and randomized algorithms. With absorbing boundaries, a walk can represent a process that terminates when a resource limit or success condition is reached. The classical gambler’s ruin model asks for the probability of reaching an upper boundary before a lower boundary. For an unbiased walk beginning at position \(i\) between 0 and \(N\), the probability of reaching \(N\) before 0 is \(i/N\). For biased walks, the probability is

\[\frac{1-(q/p)^i}{1-(q/p)^N},\quad p\ne q.\]

Random walks also reveal why local randomness can produce substantial global variation. A balanced process has zero expected drift, yet its typical displacement grows on the order of \(\sqrt n\), not as a constant. This is relevant when estimating fluctuations around average workload.

5. Queueing Systems: From Arrival Rates to Service Quality

A queueing system consists of an arrival process, one or more servers, a waiting area, a service discipline, and a rule governing admission or abandonment. Kendall’s notation \(A/S/c/K/D\) describes the arrival distribution, service distribution, number of servers, system capacity, and service discipline. The common notation M/M/1 represents Poisson arrivals, exponential service times, and one server.

Let \(\lambda\) be the mean arrival rate and \(\mu\) the mean service rate of one server. For an M/M/1 queue, utilization is

\[\rho=\frac{\lambda}{\mu}.\]

A stable steady state requires \(\rho<1\). The stationary probability of finding \(n\) customers in the system is \(P_n=(1-\rho)\rho^n\). Important performance measures are

\[L=\frac{\rho}{1-\rho},\qquad L_q=\frac{\rho^2}{1-\rho},\]

\[W=\frac{1}{\mu-\lambda},\qquad W_q=\frac{\lambda}{\mu(\mu-\lambda)}.\]

Here, \(L\) and \(L_q\) are the mean numbers in the system and queue, while \(W\) and \(W_q\) are the corresponding mean times. Little’s law states

\[L=\lambda W,\qquad L_q=\lambda W_q,\]

under steady-state conditions. It applies far beyond M/M/1, provided the relevant average rates and populations are defined consistently.

The formulas demonstrate a nonlinear capacity effect. As \(\rho\) approaches one, waiting time increases sharply. Operating a service at nearly 100 percent utilization may appear efficient, but it leaves little capacity for variability and causes large delays.

For an M/M/c system with \(c\) identical servers, stability requires \(\lambda<c\mu\). The Erlang-C analysis estimates the probability that an arrival must wait and the expected delay. In practice, a multiserver model may represent API workers, database connection pools, or network service instances.

Other disciplines produce different experiences even when average throughput is unchanged. First-come, first-served is usually perceived as fair. Processor sharing can suit interactive computing. Priority queues can protect latency-sensitive traffic but may starve low-priority work. Preemptive priority allows an urgent job to interrupt a lower-priority one; nonpreemptive priority waits until the current service completes.

Finite-capacity queues and loss systems are important when requests cannot wait indefinitely. In an M/M/1/ K system, arrivals finding the system full are blocked or dropped. The blocking probability can be used to estimate rejected calls, dropped packets, or autoscaling overflow.

6. Reliability and Availability of Computing Systems

Reliability is the probability that a component or system performs its required function for a specified time under stated conditions. Availability is the proportion of time a repairable system is operational. These concepts are related but not identical: a system can have high reliability over a short mission and poor long-run availability if repairs are slow.

For an exponential lifetime with failure rate \(\lambda\), reliability is

\[R(t)=P(T>t)=e^{-\lambda t},\]

and the mean time to failure is \(1/\lambda\). The hazard rate is the instantaneous failure intensity conditional on survival up to that time. Exponential models have constant hazard, whereas real components may show infant mortality, a useful-life period, and wear-out behavior.

For independent components in series, every component must function:

\[R_{series}(t)=\prod_{i=1}^nR_i(t).\]

For independent components in parallel, at least one must function:

\[R_{parallel}(t)=1-\prod_{i=1}^n[1-R_i(t)].\]

Replication therefore improves reliability, but only when failures are sufficiently independent. Shared power, software defects, correlated overload, or common configuration errors can defeat nominal redundancy. A k-out-of-n system operates when at least k of n components function; its reliability is obtained by summing the probabilities of all acceptable operating combinations.

For a repairable component with failure rate \(\lambda\) and repair rate \(\mu\), a two-state CTMC gives steady-state availability

\[A=\frac{\mu}{\lambda+\mu}.\]

The mean time to failure is approximately \(1/\lambda\), and mean time to repair is approximately \(1/\mu\). Consequently, availability improves either by reducing failures or by shortening detection, diagnosis, recovery, and repair time. In cloud systems, automated failover may reduce repair time, but it can also introduce correlated or cascading failures if poorly controlled.

Fault-tree analysis begins with a system-level failure and decomposes it into logical combinations of causes. Reliability block diagrams represent success relationships. Markov reliability models are useful when components change states, undergo repair, or depend on operational modes. Simulation becomes valuable when the system includes non-exponential distributions, dependencies, maintenance policies, or large state spaces.

7. Integrated Application: Capacity and Reliability in a Cloud API

The following is an illustrative case rather than a report of a particular organization.

Background

A cloud-based API serves mobile and web clients. Requests arrive at an average rate of 180 requests per second during a peak period. Each service instance processes requests at an average rate of 70 requests per second. The platform currently runs three instances behind a load balancer. Each instance has an estimated independent availability of 0.995 over the planning interval.

Situation and analysis

The nominal service capacity is \(3(70)=210\) requests per second, giving utilization \(\rho=180/210\approx0.857\). This leaves only 14.3 percent nominal headroom. Because queueing delay increases rapidly as utilization approaches one, a temporary burst or an instance slowdown could cause a substantial latency increase. A model based solely on average capacity would therefore be misleading.

If requests are approximately Poisson and service times are approximately exponential, an M/M/3 model can estimate the probability of waiting and mean queue delay. If measurements show heavy-tailed service times, the exponential assumption should be replaced or validated using simulation. The team should also examine time-varying rates rather than treating the entire day as stationary.

For independent instance availability, the probability that at least two of three instances are available is

\[\binom{3}{2}(0.995)^2(0.005)+(0.995)^3.\]

This calculation is only a baseline. A common software release, shared database, network control plane, or load-balancer defect could produce correlated failures and make the actual availability lower.

Approach and solution

The team can combine several measures: maintain a larger warm pool during predicted peaks, autoscale using queue length and latency rather than CPU alone, impose admission control for noncritical requests, and separate critical from best-effort traffic through priority policies. Reliability analysis should include dependency mapping and failure-injection tests. Observability should record arrival rate, service-time percentiles, queue depth, rejection rate, instance health, and recovery time.

Outcome and learning points

The appropriate decision is not simply “add servers.” Capacity, latency objectives, cost, failure independence, scaling delay, and recovery behavior must be considered together. Queueing analysis identifies congestion risk, while reliability analysis identifies the probability and duration of service loss. Their combination supports service-level objectives and economically defensible capacity planning.

8. Practical Modeling Workflow

A professional analysis generally proceeds as follows:

1. Define the system boundary, performance objective, time horizon, and unit of analysis.

2. Identify states, events, arrivals, services, failures, repairs, and dependencies.

3. Estimate parameters from traces, experiments, monitoring data, or domain knowledge.

4. Test assumptions, including independence, stationarity, exponential times, and unlimited waiting space.

5. Derive analytical measures where possible.

6. Validate predictions against historical observations and use simulation when analytical assumptions are inadequate.

7. Perform sensitivity and scenario analysis for bursts, failures, demand growth, and maintenance delays.

8. Translate results into operational decisions, thresholds, staffing, redundancy, and escalation policies.

Common mistakes include confusing average rate with guaranteed capacity, using utilization as the only performance metric, ignoring transient behavior, assuming replicated components fail independently, and interpreting a confidence interval as a guarantee. Parameter uncertainty can be as important as random variation. A model should therefore report assumptions and uncertainty rather than presenting a single number as unquestionable truth.

9. Governance, Ethics, and Emerging Practice

Stochastic models influence resource allocation, user experience, and sometimes access to services. If a priority queue systematically delays a particular customer group, the policy may have fairness implications. Capacity models based on historical demand can reproduce unequal service provision. Reliability monitoring may involve personal or sensitive operational data, so data minimization, access control, retention limits, and auditability are important.

Automated scaling and remediation should include safeguards against oscillation, runaway cost, and unsafe recovery actions. Model outputs should be reviewed by responsible engineers, and critical decisions should retain human oversight. Regulatory or contractual service-level commitments may require evidence about availability, incident response, data location, and operational resilience.

Current practice increasingly combines analytical queueing models with discrete-event simulation, telemetry-driven forecasting, and machine-learning predictors. AI can estimate demand or detect anomalies, but it does not remove the need for interpretable assumptions, uncertainty quantification, and validation under conditions different from the training data. Digital twins and trace-based simulation can evaluate proposed architectures before deployment, while adaptive control systems can tune capacity in response to observed queue lengths and service-level indicators.

Best Practices

Use the simplest model that answers the decision question, but not a simpler one. Measure distributions rather than averages alone; track percentiles for latency and repair time. Separate aleatory randomness from epistemic uncertainty about parameters and assumptions. Model common-cause failures explicitly when redundancy is claimed. Validate models with operational data, test extreme scenarios, and connect mathematical outputs to clear actions. Finally, review models after major architectural, workload, or policy changes.

Chapter Summary

Stochastic processes provide mathematical representations of systems evolving under uncertainty. Markov chains describe state transitions when the present state summarizes relevant history; stationary distributions describe long-run behavior, while absorbing-chain methods quantify termination and failure. Poisson processes model random event counts and exponential interarrival times, with extensions for time-varying and marked events. Random walks describe cumulative random movement and boundary-hitting behavior.

Queueing theory connects arrival rates, service capacity, utilization, waiting, and congestion. Little’s law provides a powerful relationship among population, throughput, and time, while M/M/1 and multiserver models provide useful benchmarks. Reliability theory analyzes survival, redundancy, repair, availability, and common-cause risks. In cloud and communication systems, queueing and reliability must be considered together: excess demand creates delay, and failures reduce capacity precisely when demand may be difficult to serve. Sound practice therefore combines analytical models, measurement, simulation, sensitivity analysis, governance, and professional judgment.

Key Terms

Stochastic process: A time-indexed collection of random variables describing system evolution.

Markov property: The property that the future is conditionally independent of the past given the present state.

Transition matrix: A matrix whose entries give one-step state-transition probabilities.

Stationary distribution: A probability distribution unchanged by application of the transition matrix.

Absorbing state: A state that, once entered, cannot be left.

Communicating class: A set of states mutually reachable from one another.

Continuous-time Markov chain: A Markov process with transitions occurring at continuous-time event epochs.

Poisson process: A counting process with independent stationary increments and Poisson-distributed counts.

Rate: The expected number of events, arrivals, or failures per unit time.

Exponential distribution: A continuous distribution characterized by the memoryless property.

Random walk: A process formed by cumulative random increments.

Queue: A system in which entities wait, receive service, or are blocked when capacity is unavailable.

Utilization: The fraction of service capacity demanded or occupied, commonly denoted by \(\rho\).

Little’s law: The relationship \(L=\lambda W\) between average population, throughput, and time.

Reliability: The probability that a system performs its required function for a stated interval.

Availability: The proportion of time that a repairable system is operational.

Hazard rate: The instantaneous conditional failure intensity given survival to a specified time.

Series system: A system that operates only when every required component operates.

Parallel system: A system that operates when at least one redundant component operates.

Common-cause failure: A failure mechanism that affects multiple supposedly independent components.

Review Questions

Short Answer Questions

1. What is the Markov property, and why is state definition important?

2. State the principal assumptions of a homogeneous Poisson process.

3. Define utilization in an M/M/1 queue and state the stability condition.

4. Distinguish reliability from availability.

5. What does Little’s law express?

Long Answer Questions

1. Explain communicating classes, recurrence, periodicity, and stationary distributions in finite Markov chains.

2. Derive and interpret the main performance measures of an M/M/1 queue.

3. Explain absorbing Markov chains and the role of the fundamental matrix.

4. Compare series, parallel, and repairable reliability models.

5. Discuss why independence and stationarity assumptions must be examined in cloud-system modeling.

Analytical / Application Questions

1. A service receives 45 requests per second and one server processes 60 requests per second. Using an M/M/1 model, calculate utilization, mean number in the system, and mean time in the system. Interpret the result.

2. A system has three independent components, each with reliability 0.98 over a mission interval, and operates if at least two components function. Calculate its reliability.

3. A platform has arrival rate 180 requests per second and three instances, each serving 70 requests per second. Analyze its utilization, identify the risks of operating near capacity, and recommend measurements and controls beyond simply adding servers.

22. Multiple Choice Questions with Answers

Question 1

For a finite irreducible and aperiodic Markov chain, what does the stationary distribution represent?

A. The distribution that remains unchanged under the transition matrix

B. The distribution of the first state only

C. The probability that every state is absorbing

D. The exact state occupied at every future step

Correct Answer: A. The distribution that remains unchanged under the transition matrix

Question 2

An M/M/1 queue has arrival rate 8 jobs per second and service rate 10 jobs per second. What is its utilization?

A. 0.20

B. 0.80

C. 1.25

D. 18

Correct Answer: B. 0.80

Question 3

Which condition is necessary for a steady-state M/M/1 queue?

A. λ = 0

B. λ > μ

C. λ < μ

D. μ = 0

Correct Answer: C. λ < μ

Question 4

If independent Poisson streams have rates 4 and 7 events per minute, what is the rate of their superposition?

A. 3 events per minute

B. 4 events per minute

C. 7 events per minute

D. 11 events per minute

Correct Answer: D. 11 events per minute

Question 5

In an M/M/1 queue, what happens to mean waiting time as utilization approaches one from below?

A. It approaches zero

B. It increases sharply without bound

C. It remains exactly one time unit

D. It becomes independent of arrival rate

Correct Answer: B. It increases sharply without bound

Question 6

A system operates when at least one of two independent components operates. If each component has reliability 0.9, what is system reliability?

A. 0.81

B. 0.90

C. 0.99

D. 1.80

Correct Answer: C. 0.99

Question 7

Which statement best describes Little’s law?

A. Average number equals throughput multiplied by average time

B. Failure rate always equals repair rate

C. Queue length is always equal to utilization

D. Arrival counts must be normally distributed

Correct Answer: A. Average number equals throughput multiplied by average time

Question 8

A Markov model includes an absorbing failure state. Which quantity is especially useful for estimating expected time until failure?

A. The fundamental matrix of transient states

B. The number of servers only

C. The Poisson thinning probability only

D. The parallel-system product of reliabilities

Correct Answer: A. The fundamental matrix of transient states

Question 9

Why can replication fail to provide the reliability predicted by a parallel model?

A. Parallel systems never improve reliability

B. Common-cause failures may affect all replicas

C. Reliability is unrelated to component failures

D. Replication always increases repair time to infinity

Correct Answer: B. Common-cause failures may affect all replicas

Question 10

A repairable component has failure rate λ and repair rate μ under a two-state exponential model. What is its steady-state availability?

A. λ/(λ+μ)

B. μ/(λ+μ)

C. λμ

D. 1/(λ−μ)

Correct Answer: B. μ/(λ+μ)

Mathematical Foundation of Computer Science
Chapter 12 of 15