  We investigate an M/M/1 queue operating in two switching environments, where
the switch is governed by a two-state time-homogeneous Markov chain. This model
allows to describe a system that is subject to regular operating phases
alternating with anomalous working phases or random repairing periods. We first
obtain the steady-state distribution of the process in terms of a generalized
mixture of two geometric distributions. In the special case when only one kind
of switch is allowed, we analyze the transient distribution, and investigate
the busy period problem. The analysis is also performed by means of a suitable
heavy-traffic approximation which leads to a continuous random process. Its
distribution satisfies a partial differential equation with randomly
alternating infinitesimal moments. For the approximating process we determine
the steady-state distribution, the transient distribution and a
first-passage-time density.
