Persistence (computer science)
Persistence in computer science refers to the characteristic of data that outlives the execution of the program that created it. Without this capability, data would only exist in RAM, and would be lost when this RAM loses power, such as on computer shutdown.
This is achieved in practice by storing the data in non-volatile storage such as a hard drive or flash memory.
Image editing programs or word processors, for example, achieve data persistence by saving their documents to files to avoid data loss in the event of power failures.
Orthogonal or Transparent Persistence
Persistence is said to be "orthogonal" or "transparent" when it is implemented as an intrinsic property of the execution environment of a program. An orthogonal persistence environment does not require any specific actions by programs running in it to retrieve or save their state.
Non orthogonal persistence environments require data to be written and read to and from storage using specific instructions in the program, resulting in the use of persist as a transitive verb: On completion, the program persists the data.
The advantage of orthogonal persistence environments is simpler and less error-prone programs.
Snapshots are the simplest persistence technique. A snapshot is a copy of the entire state of a program that is written to storage. Notebook hibernation, for example, uses a stored snapshot of the entire machine's RAM. It is an example of orthogonal persistence because it does not require any specific actions by the programs running on the machine.
An example of non orthogonal snapshotting is a simple text editing program executing specific instructions to save the entire text document to a file.
The Smalltalk and Lisp programming languages provide orthogonal snapshot functionality in the form of system images.
Shortcomings: State changes made to a system after its last snapshot are lost in the case of a system failure or shutdown. Taking a snapshot for every single change would be too time-consuming for most systems, so snapshots are not used as the single persistence technique for critical systems.
Journals are the second simplest persistence technique. Journaling is the process of storing events in a log before each one is applied to a system. Such logs are called journals.
On startup, the journal is read and each event is reapplied to the system, avoiding data loss in the case of system failure or shutdown.
The entire "Undo/Redo" history of user commands in an image editing program, for example, when written to a file, constitutes a journal capable of recovering the state of an edited image at any point in time.
Journals are used by journaling file systems and database management systems where they are also called "transaction logs" or "redo logs".
Shorcomings: Journals are often combined with other persistence techniques so that the entire (potentially large) history of all system events does not have to be reapplied on system startup.
Persistent Operating Systems
- operating systems that remain persistent even after a crash or unexpected shutdown. The computer stays in the same state even if you turn it off, behaving much like a TV or similar device. Operating systems that employ this ability include
- CapROS, revisions of EROS
- Coyotos, successor to EROS
- EROS, the successor to KeyKOS
- Multics with its single-level store
- Hibernate (Java)
- Java Persistence API
- Live USB
- Object Prevalence
- Persistent data structure
- Service Data Object
|This article does not cite any references or sources. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (October 2008)|