S
Stephen Sprunk
Guest
"Active8" <reply2group@ndbbm.net> wrote in message
news:vy7fvhinae51$.dlg@news.individual.net...
is often best described as an FSM. A drink vending machine is probably on
the degenerate end since it only has two or three states, but imagine a
ticket vending machine that requires several steps to determine the correct
ticket to print and fare to collect.
Also, drawing a state diagram is often useful (as opposed to, say, drawing
flowcharts) even if one chooses not to actually use an FSM in the
implementation. It clarifies what is acceptable input at each stage,
whereas many coders neglect handling error conditions or illegal state
transitions.
FSMs are almost indispensible when writing software that needs to handle
multiple client connections per server thread. IRC servers, for instance,
handle tens of thousands of connections with a single server thread via an
FSM, whereas common HTTP server implementations require dozens of server
threads yet still grind to a halt when the number of active clients exceeds
the size of the thread pool.
S
--
Stephen Sprunk "Stupid people surround themselves with smart
CCIE #3723 people. Smart people surround themselves with
K5SSS smart people who disagree with them." --Aaron Sorkin
news:vy7fvhinae51$.dlg@news.individual.net...
Anything that interacts with the outside world (including external software)On Fri, 14 May 2004 12:54:35 GMT, Fred Bloggs wrote:
pdx wrote:
Why would a finite state machine be an appropriate method of
implementing
the control logic of a drinks vending machine?
The answer is that the desired vending machine operation can be
configured into a finite sequence of events each of which is conditioned
on a well-defined state of partial completion of operation and inputs
that assume exactly one of two values such as YES/NO, TRUE/FALSE,
GO/NOGO.
Wow! Well put. I'm glad I skipped to your post. Everyone else was
blathering on without answering the question.
I might add for future reference that the finite state machine can
be visualized with the aid of a state diagram which will aid in
defining the logic to be implemented.
is often best described as an FSM. A drink vending machine is probably on
the degenerate end since it only has two or three states, but imagine a
ticket vending machine that requires several steps to determine the correct
ticket to print and fare to collect.
Also, drawing a state diagram is often useful (as opposed to, say, drawing
flowcharts) even if one chooses not to actually use an FSM in the
implementation. It clarifies what is acceptable input at each stage,
whereas many coders neglect handling error conditions or illegal state
transitions.
FSMs are almost indispensible when writing software that needs to handle
multiple client connections per server thread. IRC servers, for instance,
handle tens of thousands of connections with a single server thread via an
FSM, whereas common HTTP server implementations require dozens of server
threads yet still grind to a halt when the number of active clients exceeds
the size of the thread pool.
S
--
Stephen Sprunk "Stupid people surround themselves with smart
CCIE #3723 people. Smart people surround themselves with
K5SSS smart people who disagree with them." --Aaron Sorkin