World Library  
Flag as Inappropriate
Email this Article

State (computer science)

Article Id: WHEBN0000285512
Reproduction Date:

Title: State (computer science)  
Author: World Heritage Encyclopedia
Language: English
Subject: Comparison of programming paradigms, Persistence (computer science), Glossary of Unified Modeling Language terms, Process theory, Sequential logic
Publisher: World Heritage Encyclopedia

State (computer science)

In computer science and automata theory, the state of a digital logic circuit or computer program is a technical term for all the stored information, at a given instant in time, to which the circuit or program has access.[1] The output of a digital circuit or computer program at any time is completely determined by its current inputs and its state.

Digital logic circuit state

Digital logic circuits can be divided into two types: combinational logic, whose output signals are dependent only on its present input signals, and sequential logic, whose outputs are a function of both the current inputs and the past history of inputs.[2] In sequential logic, information from past inputs is stored in electronic memory elements, such as flip-flops and latches. The stored contents of these memory elements, at a given point in time, is collectively referred to as the circuit's "state" and contains all the information about the past to which the circuit has access.[3]

For example, the state of a microprocessor (computer chip) is the contents of all the memory elements in it: the accumulators, storage registers, data caches, and flags. When computers such as laptops go into a "hibernation" mode to save energy by shutting down the processor, the state of the processor is stored on the computer's disk, so it can be restored when the computer comes out of hibernation, and the processor can take up operations where it left off.

Program state

Similarly, a computer program stores data in variables, which represent storage locations in the computer's memory. The contents of these memory locations, at any given point in the program's execution, is called the program's state.[4][5][6]

Imperative programming is a programming paradigm (way of designing a programming language) that describes computation in terms of the program state and statements that change the program state. In contrast, in declarative programming languages the program describes the desired results, and doesn't specify changes to the state directly.

A more specialized definition of state is used in some computer programs that operate serially (sequentially) on streams of data, such as parsers, firewalls, communication protocols and encryption programs. In some of these programs, information about previous data characters or packets received is stored in variables and used to affect the processing of the current character or packet. This is called a "stateful protocol" and the data carried over from the previous processing cycle is called the "state". In others, the program has no information about the previous data stream and starts "fresh" with each data input; this is called a "stateless protocol".

Finite state machines

The output of a sequential circuit or computer program at any time is completely determined by its current inputs and current state. Since each binary memory element has only two possible states, 0 or 1, the total number of different states a circuit can assume is finite, and fixed by the number of memory elements. If there are N binary memory elements, a digital circuit can have at most 2N distinct states. The concept of state is formalized in an abstract mathematical model of computation called a finite state machine, used to design both sequential digital circuits and computer programs.

Types of states

Following states are distinguished:

  • Compatible states are states in a state machine that do not conflict for any input values. Thus for every input, both states must have the same output, and both states must have the same successor (or unspecified successors), or both must not change. Compatible states are redundant, if occurring in the same state machine.
  • Distinguishable states are states in a state machine that have at least one input sequence causing different output sequences - no matter which state is the initial state.
  • Equivalent states are states in a state machine which, for every possible input sequence, the same output sequence will be produced - no matter which state is the initial state.

See also


  1. ^ Harris, David Money; Sarah L. Harris (2007). Digital Design and Computer Architecture. USA: Morgan Kaufmann. p. 103.  
  2. ^ Kaeslin, Hubert (2008). Digital Integrated Circuit Design: From VLSI Architectures to CMOS Fabrication. UK: Cambridge University Press. p. 735.  
  3. ^ Srinath, N. K. (August 2005). 8085 Microprocessor: Programming and Interfacing. Prentice-Hall of India Pvt. Ltd. p. 326.  
  4. ^ Laplante, Philip A. (2000). Dictionary of Computer Science, Engineering and Technology. USA: CRC Press. p. 466.  
  5. ^ Misra, Jayadev (2001). A Discipline of Multiprogramming: Programming Theory for Distributed Applications. Springer. p. 14.  
  6. ^ Prata, Stephen Prata (2004). C Primer Plus, 5th Ed.. Pearson Education. pp. 113–114.  
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.