Persistence (computer science): Difference between revisions

Content deleted Content added
No edit summary
Line 1:
Picture editing programs or word processors, for examplexample, achieve [[State (computer science)|state]] persistence by saving their documents to files.
{{Unreferenced|date=October 2008}}
'''Persistence''' in [[computer science]] refers to the characteristic of [[State (computer science)|state]] that outlives the [[Process (computing)|process]] that created it. Without this capability, [[State (computer science)|state]] would only exist in [[RAM]], and would be lost when this RAM loses power, such as a computer shutdown.{{Citation needed|date=December 2009}}
 
This is achieved in practice by storing the [[State (computer science)|state]] as data in non-volatile storage such as a [[hard drive]] or [[flash memory]].
 
Picture editing programs or word processors, for example, achieve [[State (computer science)|state]] persistence by saving their documents to files.
 
== Orthogonal or transparent persistence==
Line 16 ⟶ 11:
===System images===
{{Main|System image}}
Using [[System image|system images]] is the simplest persistence technique. Notebook [[Hibernate (OS feature)|hibernation]] is an example of orthogonal persistence using a system image because it does not require any actions by the programs running on the machine. An example of non-orthogonal persistence using a system image is a simple text editing program executing specific instructions to save an entire document to(Computer a file.Science)}}
 
'''Shortcomings''': State changes made to a system after its last image was saved are lost in the case of a system failure or shutdown. Saving an image for every single change would be too time-consuming for most systems, so images are not used as the single persistence technique for critical systems.
 
===Journals===
{{Main|Journal (computing)}}
Using journals is 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 a picture editing program, for example, when written to a file, constitutes a journal capable of recovering the state of an edited picture at any point in time.
 
Journals are used by [[journaling file system]]s and [[database management system]]s where they are also called "transaction logs" or "redo logs".
 
'''Shortcomings''': 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.
 
===System prevalence===
{{Main|System Prevalence}}
System prevalence is a technique that combines system images and transaction journals, mentioned above, to overcome their limitations.
 
'''Shortcomings:''' A prevalent system must have enough [[RAM]] to hold the entire system state.
 
===Dirty writes===
Dirty writes refer to the writing out to storage of only those portions of system state that have been modified (are dirty) since their last write. Sophisticated document editing applications, for example, will use dirty writes to save only those portions of a document that were actually changed since the last save.
 
'''Shortcomings:''' This technique requires state changes to be intercepted within a program. This is achieved in a non-transparent way by requiring specific storage-API calls or in a transparent way with automatic [[program transformation]]. This results in code that is slower than native code and more complicated to debug.
 
== Persistence layers ==
Any [[Layer (object-oriented design)|software layer]] that makes it easier for a program to persist its state is generically called a persistence layer. Most persistence layers will not achieve persistence directly but will use an underlying [[database management system]].
 
== Database management systems (DBMSs) ==
{{Main|DBMS}}
[[DBMS]]s use a combination of the dirty writes and transaction journaling techniques mentioned above. They provide not only persistence but also other services such as queries, auditing and access control.
 
==Persistent operating systems==
Persistent operating systems are [[operating system]]s 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
* [[Extremely Reliable Operating System|EROS]], the successor to KeyKOS
* [[KeyKOS]]
* [[Multics]] with its [[single-level store]]
* [[Phantom (operating system)|Phantom]]
 
== See also==
* [[Create, read, update and delete|CRUD]]
* [[Java Data Objects]]
* [[Java Persistence API]]
* [[System Prevalence]]
* [[Orthogonality#Computer science|Orthogonality]]
* [[Persistent data structure]]
* [[Service Data Object]]
 
 
{{DEFAULTSORT:Persistence (Computer Science)}}
[[Category:Persistence| ]]
[[Category:Computing terminology]]