<s>
In	O
information	B-General_Concept
technology	I-General_Concept
and	O
computer	B-General_Concept
science	I-General_Concept
,	O
a	O
system	O
is	O
described	O
as	O
stateful	B-Application
if	O
it	O
is	O
designed	O
to	O
remember	O
preceding	O
events	O
or	O
user	O
interactions	O
;	O
the	O
remembered	O
information	O
is	O
called	O
the	O
state	O
of	O
the	O
system	O
.	O
</s>
<s>
In	O
a	O
discrete	B-Application
system	I-Application
,	O
the	O
state	O
space	O
is	O
countable	O
and	O
often	O
finite	O
.	O
</s>
<s>
Examples	O
of	O
such	O
systems	O
are	O
digital	O
logic	O
circuits	O
and	O
components	O
,	O
automata	B-Application
and	O
formal	O
language	O
,	O
computer	B-Application
programs	I-Application
,	O
and	O
computers	O
.	O
</s>
<s>
The	O
output	O
of	O
a	O
digital	O
circuit	O
or	O
deterministic	B-General_Concept
computer	I-General_Concept
program	I-General_Concept
at	O
any	O
time	O
is	O
completely	O
determined	O
by	O
its	O
current	O
inputs	O
and	O
its	O
state	O
.	O
</s>
<s>
In	O
sequential	O
logic	O
,	O
information	O
from	O
past	O
inputs	O
is	O
stored	O
in	O
electronic	B-Architecture
memory	I-Architecture
elements	O
,	O
such	O
as	O
flip-flops	B-General_Concept
.	O
</s>
<s>
Since	O
each	O
binary	B-Architecture
memory	I-Architecture
element	I-Architecture
,	O
such	O
as	O
a	O
flip-flop	B-General_Concept
,	O
has	O
only	O
two	O
possible	O
states	O
,	O
one	O
or	O
zero	O
,	O
and	O
there	O
is	O
a	O
finite	O
number	O
of	O
memory	O
elements	O
,	O
a	O
digital	O
circuit	O
has	O
only	O
a	O
certain	O
finite	O
number	O
of	O
possible	O
states	O
.	O
</s>
<s>
Similarly	O
,	O
a	O
computer	B-Application
program	I-Application
stores	O
data	O
in	O
variables	O
,	O
which	O
represent	O
storage	O
locations	O
in	O
the	O
computer	B-General_Concept
's	I-General_Concept
memory	I-General_Concept
.	O
</s>
<s>
A	O
more	O
specialized	O
definition	O
of	O
state	O
is	O
used	O
for	O
computer	B-Application
programs	I-Application
that	O
operate	O
serially	O
or	O
sequentially	O
on	O
streams	B-Architecture
of	I-Architecture
data	I-Architecture
,	O
such	O
as	O
parsers	B-Language
,	O
firewalls	B-Application
,	O
communication	O
protocols	O
and	O
encryption	O
.	O
</s>
<s>
This	O
is	O
called	O
a	O
stateful	B-Protocol
protocol	I-Protocol
and	O
the	O
data	O
carried	O
over	O
from	O
the	O
previous	O
processing	O
cycle	O
is	O
called	O
the	O
state	O
.	O
</s>
<s>
In	O
others	O
,	O
the	O
program	O
has	O
no	O
information	O
about	O
the	O
previous	O
data	O
stream	O
and	O
starts	O
fresh	O
with	O
each	O
data	O
input	O
;	O
this	O
is	O
called	O
a	O
stateless	B-Protocol
protocol	I-Protocol
.	O
</s>
<s>
Imperative	B-Application
programming	I-Application
is	O
a	O
programming	O
paradigm	O
(	O
way	O
of	O
designing	O
a	O
programming	O
language	O
)	O
that	O
describes	O
computation	O
in	O
terms	O
of	O
the	O
program	O
state	O
,	O
and	O
of	O
the	O
statements	O
which	O
change	O
the	O
program	O
state	O
.	O
</s>
<s>
Changes	O
of	O
state	O
are	O
implicit	O
,	O
managed	O
by	O
the	O
program	O
runtime	O
,	O
so	O
that	O
a	O
subroutine	O
has	O
visibility	B-Application
of	O
the	O
changes	O
of	O
state	O
made	O
by	O
other	O
parts	O
of	O
the	O
program	O
,	O
known	O
as	O
side	O
effects	O
.	O
</s>
<s>
In	O
declarative	B-Language
programming	I-Language
languages	I-Language
,	O
the	O
program	O
describes	O
the	O
desired	O
results	O
and	O
does	O
n't	O
specify	O
changes	O
to	O
the	O
state	O
directly	O
.	O
</s>
<s>
In	O
functional	B-Language
programming	I-Language
,	O
state	O
is	O
usually	O
represented	O
with	O
temporal	O
logic	O
as	O
explicit	O
variables	O
that	O
represent	O
the	O
program	O
state	O
at	O
each	O
step	O
of	O
a	O
program	O
execution	O
:	O
a	O
state	O
variable	O
is	O
passed	O
as	O
an	O
input	O
parameter	O
of	O
a	O
state-transforming	O
function	O
,	O
which	O
returns	O
the	O
updated	O
state	O
as	O
part	O
of	O
its	O
return	O
value	O
.	O
</s>
<s>
A	O
pure	B-Application
functional	I-Application
subroutine	O
only	O
has	O
visibility	B-Application
of	O
changes	O
of	O
state	O
represented	O
by	O
the	O
state	O
variables	O
in	O
its	O
scope	O
.	O
</s>
<s>
The	O
output	O
of	O
a	O
sequential	O
circuit	O
or	O
computer	B-Application
program	I-Application
at	O
any	O
time	O
is	O
completely	O
determined	O
by	O
its	O
current	O
inputs	O
and	O
current	O
state	O
.	O
</s>
<s>
Since	O
each	O
binary	B-Architecture
memory	I-Architecture
element	I-Architecture
has	O
only	O
two	O
possible	O
states	O
,	O
0	O
or	O
1	O
,	O
the	O
total	O
number	O
of	O
different	O
states	O
a	O
circuit	O
can	O
assume	O
is	O
finite	O
,	O
and	O
fixed	O
by	O
the	O
number	O
of	O
memory	O
elements	O
.	O
</s>
<s>
The	O
concept	O
of	O
state	O
is	O
formalized	O
in	O
an	O
abstract	O
mathematical	O
model	O
of	O
computation	O
called	O
a	O
finite	B-Architecture
state	I-Architecture
machine	I-Architecture
,	O
used	O
to	O
design	O
both	O
sequential	O
digital	O
circuits	O
and	O
computer	B-Application
programs	I-Application
.	O
</s>
<s>
Similarly	O
,	O
the	O
television	O
also	O
stores	O
a	O
number	O
that	O
controls	O
the	O
level	O
of	O
volume	B-Algorithm
produced	O
by	O
the	O
speaker	O
.	O
</s>
<s>
Pressing	O
the	O
"	O
volume	B-Algorithm
up	O
"	O
or	O
"	O
volume	B-Algorithm
down	O
"	O
buttons	O
increments	O
or	O
decrements	O
this	O
number	O
,	O
setting	O
a	O
new	O
level	O
of	O
volume	B-Algorithm
.	O
</s>
<s>
Both	O
the	O
current	O
channel	O
and	O
current	O
volume	B-Algorithm
numbers	O
are	O
part	O
of	O
the	O
TV	O
's	O
state	O
.	O
</s>
<s>
They	O
are	O
stored	O
in	O
non-volatile	B-General_Concept
memory	I-General_Concept
,	O
which	O
preserves	O
the	O
information	O
when	O
the	O
TV	O
is	O
turned	O
off	O
,	O
so	O
when	O
it	O
is	O
turned	O
on	O
again	O
the	O
TV	O
will	O
return	O
to	O
its	O
previous	O
station	O
and	O
volume	B-Algorithm
level	O
.	O
</s>
<s>
As	O
another	O
example	O
,	O
the	O
state	O
of	O
a	O
microprocessor	B-Architecture
is	O
the	O
contents	O
of	O
all	O
the	O
memory	O
elements	O
in	O
it	O
:	O
the	O
accumulators	B-General_Concept
,	O
storage	O
registers	O
,	O
data	B-General_Concept
caches	I-General_Concept
,	O
and	O
flags	O
.	O
</s>
<s>
When	O
computers	O
such	O
as	O
laptops	O
go	O
into	O
a	O
hibernation	O
mode	O
to	O
save	O
energy	O
by	O
shutting	O
down	O
the	O
processor	O
,	O
the	O
state	O
of	O
the	O
processor	O
is	O
stored	O
on	O
the	O
computer	O
's	O
hard	B-Device
disk	I-Device
,	O
so	O
it	O
can	O
be	O
restored	O
when	O
the	O
computer	O
comes	O
out	O
of	O
hibernation	O
,	O
and	O
the	O
processor	O
can	O
take	O
up	O
operations	O
where	O
it	O
left	O
off	O
.	O
</s>
