SlideShare una empresa de Scribd logo
1 de 32
Descargar para leer sin conexión
Doctoral course: 
object technologies 
IMO Group 
Department of computer science 
University of Vigo 
J. Baltasar García Perez-Schofield 
http://webs.uvigo.es/jbgarcia/
Persistence
Persistence 
➲ Persistence is the term employed for desig-ning 
the storing and retrieval of data. In ob-ject- 
oriented programming languages, this 
data are objects. 
➲ Many applications follow a very simple way 
of working: they restore data from a previous 
session, process them, and store them.
Terminology 
➲ Serialization: save the state of the object di-rectly, 
as a sequence of bytes. 
➲ Swizzling: converting pointers, from their 
format in memory to their format on disk, 
and viceversa. 
➲ Activation: Retrieve an object stored on 
disk. 
➲ Pasivation: Storing on disk of an object in 
memory.
Persistence 
➲ The recovery process is known as unflattening, 
while the storing process is called flattening. 
➲ What is really happening in both processes is a 
decoding and a coding process, respectively. 
➲ Why not directly save the needed objects, and re-cover 
them when necessary?
Object storing 
➲ Depending on the programming language: 
● JAVA: it has a serializing process to disk, more or 
less automatic. 
● C++: it does not have any serialization mecha-nism, 
you just can use the average record seriali-zation: 
● fwrite( &object, sizeof( object ), 1, file );
Object retrieval 
➲ In programming languages such as C++, it is only 
possible to recover the state of an object stored 
prevously; however, it is not known to what class 
the object pertains, or even whether it is an object. 
➲ In programming languages such as Java, the reco-very 
is slightly better, since we can obtain 
the .class archive and the stored state archive; 
however, the recovery and management of these 
files is only simple if the same application that sto-red 
them is the one that is going to use them.
Persistence support: difficulties in 
current object-oriented program-ming 
languages 
➲ The most of them allow you to serialize the state of 
an object to a file on disk. 
➲ However, simple serialization of the state is not 
enough in order to work with a stored object. Seria-lization 
is needed in order to obtain persistence, but 
it is not persistence by itself. 
➲ Most of these serialization mechanisms, including 
the one present in Java, are in practice limited to 
simple objects (i.e., objects that do not store refe-rences 
to other objects), and not complex ones.
The true nature of persistence 
➲ Research in persistence tries to go one step further 
from the idea of just storing objects in files (in the 
same fashion that other data is stored). 
➲ The objective is to build an storing and retrieval 
mechanism, as automatic and transparent as pos-sible, 
making obsoletes the concepts of: 
● File: is not needed any more. 
● Distinction between primary (RAM) and secondary (disk) 
memory.
Brief historic survey 
➲ Object-oriented databases begun to be de-veloped 
and researched at the end of the 
70's. 
➲ Since then, the concept of persistence went 
from the database field to the operating sys-tems 
field, and finally, to the programming 
languages field. 
➲ Research in persistence lost its strength in 
mid 90's, and it was absorbed by research 
in Aspect Oriented Programming.
Orthogonal persistence 
➲ An object can be persistent, regardless its 
type (i.e., the class it pertains to). 
➲ Objects should be managed homogene-ously, 
regardless whether they are persis-tent 
or not. 
➲ The decision of whether an object is persis-tent 
or not is made by the system. It just 
cheks whether it is reachable (by following 
references) from a persistent root or not.
Persistence: why did not it 
triumph? 
➲ Backwards compatibility: a lot of running ap-plications 
are based on a file system. 
➲ Change of programming style: the trust-worthy 
file concept disappears, becoming a 
different programming fashion. 
➲ Performance: persistent systems are not so 
efficient as traditional ones.
Mechanisms needed for persist-ence 
➲ Swizzling (pointer conversion) 
➲ Clustering (object grouping in the persistent 
store) 
● How is it possible to group objects in the persist-ent 
store, so when a cluster is read, all (or most 
of them) the related objects are in memory for the 
next processes? 
➲ Schema evolution 
● How to react when a class changes? 
➲ Object caching. 
➲ Integrity of the persistent store.
Clustering 
➲ Clustering or grouping, is about how to store 
together objects in the persistent store. 
➲ In relational databases, a record is never 
read in read operation, but a cluster (group) 
of them. This is also appliable to average 
operating system files. 
➲ This way, it is expected that the read objects 
are going to be the ones used in later opera-tions, 
without the need to read from disk.
Clustering 
➲ Thus, objects are stored in clusters, so when 
an object of this cluster is read, the entire 
cluster is brought to primary memory, and 
when an object is modified, the entire cluster 
is written to disk. 
➲ The key point would be to find a grouping 
policy minimizing the number of reads 
needed in order to work with that objects.
Clustering 
➲ We should find an ideal 
grouping implying the min-imal 
number of disk ac-cesses. 
➲ With the first policy, there 
is only one cluster in-volved. 
➲ In the second one, two 
clusters. 
➲ ... as well as two clusters 
in the third one.
Clustering 
➲ The first policy (putting all classes and ob-jects 
altogether) is the best one, however it 
is not possible to group all objects in one 
cluster in a real world application. 
➲ The second policy stores all classes in a 
cluster and all objects in another one. It is 
not very feasible as well. 
➲ The third one is very common, and it has to 
do with the moment of the creation of ob-jects: 
each class is saved with its objects.
Clustering 
➲ There are some adaptative technics, that 
group objects based on statistical calculus 
accounting which objects are used together. 
➲ While these techniques always give the best 
possible clustering, it has been demon-strated 
that they are very slow.
Clustering 
➲ An intermediate solution is to ask the user 
which objects should be grouped together. 
● The ODMG 3.0 standard includes syntax to let 
the user manage the grouping policies. This is 
not transparent at all. 
● Other systems just group those objects that were 
created in the same session. 
● Barbados uses a metaphor of directories, in 
which each container is a directory. Users organ-ize 
their objects in directories, and, this way, they 
are transparently managing the clustering policy. 
● Zero uses containers that can be, as Barbados, 
identified with folders, but that behave as collec-tions 
of objects.
Swizzling 
➲ Swizzling, means to translate pointers from 
its natural form, in memory, to a codified 
form in disk, and viceversa. 
➲ A pointer (in C++, or a reference in Java) is 
normally substituted by an OID (Object Iden-tifier), 
so the object structure in memory can 
be rebuilt. 
➲ There are two basic strategies for converting 
pointers in the recovery stage: 
● Eager 
● Lazy
Swizzling 
➲ When objects are 
stored, their point-ers 
are substituted 
by OID's. 
➲ The reverse pro-cess 
happens when 
those objects are re-loaded 
in memory.
Swizzling eager/lazy 
➲ Eager 
● When an object is loaded, all its pointers are swizzled. 
● Barbados employs a mixed system: when a container is 
loaded, all references inside it are converted. However, the 
container is just a part of the persistent store. 
➲ Lazy 
● Objects are loaded and only the minimal number of 
references are swizzled. Only when those references 
are going to be used, are swizzled. 
● Oberon-D uses lazy swizzling. When a reference raises an er-ror 
of “object not found”, Oberon-D examines whether it is un-swizzled. 
In the later case, swizzles it, unmarks the error, and 
resumes execution.
Schema Evolution 
➲ It is the same problem that happens when in 
a relational database a table is changed: all 
its records must be adapted. 
➲ In an object-oriented database (or a persist-ent 
store), this problem happens when a 
class changes, i.e., it is modified. All its ob-jects 
must be adapted as well.
Schema Evolution 
➲ There are also two possible policies for 
schema evolution, very similars to the swizz-ling 
mechanism. 
● Eager: All objects are adapted at the time the 
modification of the class is detected. 
● Lazy: Objects are adapted as long as they are 
used.
Schema Evolution 
➲ Eager: 
● PJama has a command line tool that accepts 
a .class file and a text file describing the adapta-tion 
for its objects, and runs all over the persist-ent 
store making the necessary changes. 
● This tool allows programmers to apply very complex 
schema evolutions, but it implies that the persistent 
store cannot be in use while the tool is running. 
● The main benefit is that, once the tool is finished, the 
conversion has also been made and all objects are 
synchronised.
Schema Evolution 
➲ Lazy: 
● O2 takes note about every conversion in any 
class, and converts objects when they are used, 
but not before. 
● This means that it supports a versioning system, which 
keeps trace of every single modification in a class, and 
applies all adaptations for each modification in order, 
when an object of that class is used. 
● This is an extremely complex system, which makes 
various objects of different versions of the same class 
coexist in the same persistent store. 
● The main advantage is that the system is never offline, 
and that objects are only converted when used, so the 
conversion does not have to stop the system.
Schema Evolution 
➲ A mixture between eager and lazy: 
● In Barbados, when a class is changed, all objects 
of that class pertaining to the container currently 
in use are changed. The remaining objects in 
other containers are pending of change. When a 
container is loaded, the objects of that class are 
converted. 
● It tries to get the advantages of both systems: it 
does not have to put the system offline, but the 
objects in the same container are synchronised.
Applications of persistence 
➲ OOOS (Object-Oriented Operating Systems): 
● EROS (http://www.eros-os.org/) 
● GRASSHOPPER ( 
http://www.gh.cs.su.oz.au/Grasshopper/) 
➲ OOPPS (Object-Oriented Persistent Programming Sys-tems) 
● Barbados ( 
http://www.lsi.uvigo.es/lsi/erosello/imo/Imospain/pers.html 
) 
● Pjama (http://www.dcs.gla.ac.uk/pjava/) 
● Oberon-D ( 
http://www.ssw.uni-linz.ac.at/Research/Projects/OberonD.html) 
➲ OODBMS (Object-Oriented Database Management Sys-tems): 
● O2 ( 
http://www.dbis.informatik.uni-frankfurt.de/REPORTS/GOODSTEP/goodstep.html)
References 
➲ Orthogonal persistence 
● Atkinson M.P., Morrison R. (1995). “Orthogonality 
Persistent Object System”, VLDB Journal v4 n3, 
pp319-401, ISSN: 1066-8888 
● The first publication trying to state three basic prin-ciples 
for standard persistence. 
● Orthogonality (independence) of: 
● type 
● management 
● designation of persistent objects
References 
➲ ODMG 3.0 
● http://www.odmg.org 
● Cattel R., Barry D., (eds.), (2003). “The Object 
Data Standard: ODMG 3.0”. Morgan Kaufmann 
Publishers. ISBN 1-55860-647-4 
● ODMG is the stadnard followed by many firms 
that sell relational databases with abstraction 
layers based in objects, such as ORACLE. 
● There are also JDBC implementations of this 
standard for Java.
References 
➲ PJama 
● Sun research: 
● http://www.sunlabs.com/forest/index.html 
● University of Glasgow: 
● http://www.dcs.gla.ac.uk/pjava/ 
● PJama, or persistent Java, was a project finisedh 
in September 2000, trying to give persistence 
support for Java. 
● It was directed by historical experts in persist-ence. 
● It is not completely orthogonal (it violates the 
second and third rule), as it tries to keep back-wards 
compatibility with existing Java programs.
Doctoral course: 
object technologies 
IMO Group 
Department of computer science 
University of Vigo 
J. Baltasar García Perez-Schofield 
http://webs.uvigo.es/jbgarcia/

Más contenido relacionado

Similar a Post-graduate course: Object technology: Persistence.

The Oxford Common File Layout: A common approach to digital preservation
The Oxford Common File Layout: A common approach to digital preservationThe Oxford Common File Layout: A common approach to digital preservation
The Oxford Common File Layout: A common approach to digital preservationSimeon Warner
 
Intro to oop.pptx
Intro to oop.pptxIntro to oop.pptx
Intro to oop.pptxUmerUmer25
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP conceptsAhmed Farag
 
Rook: Storage for Containers in Containers – data://disrupted® 2020
Rook: Storage for Containers in Containers  – data://disrupted® 2020Rook: Storage for Containers in Containers  – data://disrupted® 2020
Rook: Storage for Containers in Containers – data://disrupted® 2020data://disrupted®
 
Post-graduate course: Object technology: Prototype-based object-oriented prog...
Post-graduate course: Object technology: Prototype-based object-oriented prog...Post-graduate course: Object technology: Prototype-based object-oriented prog...
Post-graduate course: Object technology: Prototype-based object-oriented prog...Baltasar García Perez-Schofield
 
Lecture 2 cst 205-281 oop
Lecture 2   cst 205-281 oopLecture 2   cst 205-281 oop
Lecture 2 cst 205-281 oopktuonlinenotes
 
ObjectLayout: Closing the (last?) inherent C vs. Java speed gap
ObjectLayout: Closing the (last?) inherent C vs. Java speed gapObjectLayout: Closing the (last?) inherent C vs. Java speed gap
ObjectLayout: Closing the (last?) inherent C vs. Java speed gapAzul Systems Inc.
 
Elasticsearch Architechture
Elasticsearch ArchitechtureElasticsearch Architechture
Elasticsearch ArchitechtureAnurag Sharma
 
Grasp oose week 14.pdf
Grasp oose week 14.pdfGrasp oose week 14.pdf
Grasp oose week 14.pdfNaveedChughtai
 

Similar a Post-graduate course: Object technology: Persistence. (20)

The Oxford Common File Layout: A common approach to digital preservation
The Oxford Common File Layout: A common approach to digital preservationThe Oxford Common File Layout: A common approach to digital preservation
The Oxford Common File Layout: A common approach to digital preservation
 
Intro to oop.pptx
Intro to oop.pptxIntro to oop.pptx
Intro to oop.pptx
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
 
Rook: Storage for Containers in Containers – data://disrupted® 2020
Rook: Storage for Containers in Containers  – data://disrupted® 2020Rook: Storage for Containers in Containers  – data://disrupted® 2020
Rook: Storage for Containers in Containers – data://disrupted® 2020
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Javasession6
Javasession6Javasession6
Javasession6
 
Hibernate using jpa
Hibernate using jpaHibernate using jpa
Hibernate using jpa
 
Post-graduate course: Object technology: Prototype-based object-oriented prog...
Post-graduate course: Object technology: Prototype-based object-oriented prog...Post-graduate course: Object technology: Prototype-based object-oriented prog...
Post-graduate course: Object technology: Prototype-based object-oriented prog...
 
Hibernate3 q&a
Hibernate3 q&aHibernate3 q&a
Hibernate3 q&a
 
Principles of OOPs.pptx
Principles of OOPs.pptxPrinciples of OOPs.pptx
Principles of OOPs.pptx
 
Lecture 2 cst 205-281 oop
Lecture 2   cst 205-281 oopLecture 2   cst 205-281 oop
Lecture 2 cst 205-281 oop
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Unit 5
Unit 5Unit 5
Unit 5
 
Ooad
OoadOoad
Ooad
 
Ooad
OoadOoad
Ooad
 
Oos Short Q N
Oos Short Q NOos Short Q N
Oos Short Q N
 
ObjectLayout: Closing the (last?) inherent C vs. Java speed gap
ObjectLayout: Closing the (last?) inherent C vs. Java speed gapObjectLayout: Closing the (last?) inherent C vs. Java speed gap
ObjectLayout: Closing the (last?) inherent C vs. Java speed gap
 
Elasticsearch Architechture
Elasticsearch ArchitechtureElasticsearch Architechture
Elasticsearch Architechture
 
Grasp oose week 14.pdf
Grasp oose week 14.pdfGrasp oose week 14.pdf
Grasp oose week 14.pdf
 

Más de Baltasar García Perez-Schofield

Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...
Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...
Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...Baltasar García Perez-Schofield
 
Post-graduate course: Object technology: Implementation of object-oriented pr...
Post-graduate course: Object technology: Implementation of object-oriented pr...Post-graduate course: Object technology: Implementation of object-oriented pr...
Post-graduate course: Object technology: Implementation of object-oriented pr...Baltasar García Perez-Schofield
 
Learning object-oriented programming trough a visual tool at Cisti 2008
Learning object-oriented programming trough a visual tool at Cisti 2008Learning object-oriented programming trough a visual tool at Cisti 2008
Learning object-oriented programming trough a visual tool at Cisti 2008Baltasar García Perez-Schofield
 
Charla invitada en oviedo: Evolución del soporte de persistencia
Charla invitada en oviedo: Evolución del soporte de persistenciaCharla invitada en oviedo: Evolución del soporte de persistencia
Charla invitada en oviedo: Evolución del soporte de persistenciaBaltasar García Perez-Schofield
 

Más de Baltasar García Perez-Schofield (7)

Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...
Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...
Curso de doctorado Tecnología de Objetos: Implementación de lenguajes orienta...
 
Post-graduate course: Object technology: Implementation of object-oriented pr...
Post-graduate course: Object technology: Implementation of object-oriented pr...Post-graduate course: Object technology: Implementation of object-oriented pr...
Post-graduate course: Object technology: Implementation of object-oriented pr...
 
Prototype-based programming with PROWL.
Prototype-based programming with PROWL.Prototype-based programming with PROWL.
Prototype-based programming with PROWL.
 
Prototype-based, object-oriented programming
Prototype-based, object-oriented programmingPrototype-based, object-oriented programming
Prototype-based, object-oriented programming
 
Learning object-oriented programming trough a visual tool at Cisti 2008
Learning object-oriented programming trough a visual tool at Cisti 2008Learning object-oriented programming trough a visual tool at Cisti 2008
Learning object-oriented programming trough a visual tool at Cisti 2008
 
Charla invitada en oviedo: Evolución del soporte de persistencia
Charla invitada en oviedo: Evolución del soporte de persistenciaCharla invitada en oviedo: Evolución del soporte de persistencia
Charla invitada en oviedo: Evolución del soporte de persistencia
 
Cp3-- A module support tool for C++
Cp3-- A module support tool for C++Cp3-- A module support tool for C++
Cp3-- A module support tool for C++
 

Último

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxNikitaBankoti2
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 

Último (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

Post-graduate course: Object technology: Persistence.

  • 1. Doctoral course: object technologies IMO Group Department of computer science University of Vigo J. Baltasar García Perez-Schofield http://webs.uvigo.es/jbgarcia/
  • 3. Persistence ➲ Persistence is the term employed for desig-ning the storing and retrieval of data. In ob-ject- oriented programming languages, this data are objects. ➲ Many applications follow a very simple way of working: they restore data from a previous session, process them, and store them.
  • 4. Terminology ➲ Serialization: save the state of the object di-rectly, as a sequence of bytes. ➲ Swizzling: converting pointers, from their format in memory to their format on disk, and viceversa. ➲ Activation: Retrieve an object stored on disk. ➲ Pasivation: Storing on disk of an object in memory.
  • 5. Persistence ➲ The recovery process is known as unflattening, while the storing process is called flattening. ➲ What is really happening in both processes is a decoding and a coding process, respectively. ➲ Why not directly save the needed objects, and re-cover them when necessary?
  • 6. Object storing ➲ Depending on the programming language: ● JAVA: it has a serializing process to disk, more or less automatic. ● C++: it does not have any serialization mecha-nism, you just can use the average record seriali-zation: ● fwrite( &object, sizeof( object ), 1, file );
  • 7. Object retrieval ➲ In programming languages such as C++, it is only possible to recover the state of an object stored prevously; however, it is not known to what class the object pertains, or even whether it is an object. ➲ In programming languages such as Java, the reco-very is slightly better, since we can obtain the .class archive and the stored state archive; however, the recovery and management of these files is only simple if the same application that sto-red them is the one that is going to use them.
  • 8. Persistence support: difficulties in current object-oriented program-ming languages ➲ The most of them allow you to serialize the state of an object to a file on disk. ➲ However, simple serialization of the state is not enough in order to work with a stored object. Seria-lization is needed in order to obtain persistence, but it is not persistence by itself. ➲ Most of these serialization mechanisms, including the one present in Java, are in practice limited to simple objects (i.e., objects that do not store refe-rences to other objects), and not complex ones.
  • 9. The true nature of persistence ➲ Research in persistence tries to go one step further from the idea of just storing objects in files (in the same fashion that other data is stored). ➲ The objective is to build an storing and retrieval mechanism, as automatic and transparent as pos-sible, making obsoletes the concepts of: ● File: is not needed any more. ● Distinction between primary (RAM) and secondary (disk) memory.
  • 10. Brief historic survey ➲ Object-oriented databases begun to be de-veloped and researched at the end of the 70's. ➲ Since then, the concept of persistence went from the database field to the operating sys-tems field, and finally, to the programming languages field. ➲ Research in persistence lost its strength in mid 90's, and it was absorbed by research in Aspect Oriented Programming.
  • 11. Orthogonal persistence ➲ An object can be persistent, regardless its type (i.e., the class it pertains to). ➲ Objects should be managed homogene-ously, regardless whether they are persis-tent or not. ➲ The decision of whether an object is persis-tent or not is made by the system. It just cheks whether it is reachable (by following references) from a persistent root or not.
  • 12. Persistence: why did not it triumph? ➲ Backwards compatibility: a lot of running ap-plications are based on a file system. ➲ Change of programming style: the trust-worthy file concept disappears, becoming a different programming fashion. ➲ Performance: persistent systems are not so efficient as traditional ones.
  • 13. Mechanisms needed for persist-ence ➲ Swizzling (pointer conversion) ➲ Clustering (object grouping in the persistent store) ● How is it possible to group objects in the persist-ent store, so when a cluster is read, all (or most of them) the related objects are in memory for the next processes? ➲ Schema evolution ● How to react when a class changes? ➲ Object caching. ➲ Integrity of the persistent store.
  • 14. Clustering ➲ Clustering or grouping, is about how to store together objects in the persistent store. ➲ In relational databases, a record is never read in read operation, but a cluster (group) of them. This is also appliable to average operating system files. ➲ This way, it is expected that the read objects are going to be the ones used in later opera-tions, without the need to read from disk.
  • 15. Clustering ➲ Thus, objects are stored in clusters, so when an object of this cluster is read, the entire cluster is brought to primary memory, and when an object is modified, the entire cluster is written to disk. ➲ The key point would be to find a grouping policy minimizing the number of reads needed in order to work with that objects.
  • 16. Clustering ➲ We should find an ideal grouping implying the min-imal number of disk ac-cesses. ➲ With the first policy, there is only one cluster in-volved. ➲ In the second one, two clusters. ➲ ... as well as two clusters in the third one.
  • 17. Clustering ➲ The first policy (putting all classes and ob-jects altogether) is the best one, however it is not possible to group all objects in one cluster in a real world application. ➲ The second policy stores all classes in a cluster and all objects in another one. It is not very feasible as well. ➲ The third one is very common, and it has to do with the moment of the creation of ob-jects: each class is saved with its objects.
  • 18. Clustering ➲ There are some adaptative technics, that group objects based on statistical calculus accounting which objects are used together. ➲ While these techniques always give the best possible clustering, it has been demon-strated that they are very slow.
  • 19. Clustering ➲ An intermediate solution is to ask the user which objects should be grouped together. ● The ODMG 3.0 standard includes syntax to let the user manage the grouping policies. This is not transparent at all. ● Other systems just group those objects that were created in the same session. ● Barbados uses a metaphor of directories, in which each container is a directory. Users organ-ize their objects in directories, and, this way, they are transparently managing the clustering policy. ● Zero uses containers that can be, as Barbados, identified with folders, but that behave as collec-tions of objects.
  • 20. Swizzling ➲ Swizzling, means to translate pointers from its natural form, in memory, to a codified form in disk, and viceversa. ➲ A pointer (in C++, or a reference in Java) is normally substituted by an OID (Object Iden-tifier), so the object structure in memory can be rebuilt. ➲ There are two basic strategies for converting pointers in the recovery stage: ● Eager ● Lazy
  • 21. Swizzling ➲ When objects are stored, their point-ers are substituted by OID's. ➲ The reverse pro-cess happens when those objects are re-loaded in memory.
  • 22. Swizzling eager/lazy ➲ Eager ● When an object is loaded, all its pointers are swizzled. ● Barbados employs a mixed system: when a container is loaded, all references inside it are converted. However, the container is just a part of the persistent store. ➲ Lazy ● Objects are loaded and only the minimal number of references are swizzled. Only when those references are going to be used, are swizzled. ● Oberon-D uses lazy swizzling. When a reference raises an er-ror of “object not found”, Oberon-D examines whether it is un-swizzled. In the later case, swizzles it, unmarks the error, and resumes execution.
  • 23. Schema Evolution ➲ It is the same problem that happens when in a relational database a table is changed: all its records must be adapted. ➲ In an object-oriented database (or a persist-ent store), this problem happens when a class changes, i.e., it is modified. All its ob-jects must be adapted as well.
  • 24. Schema Evolution ➲ There are also two possible policies for schema evolution, very similars to the swizz-ling mechanism. ● Eager: All objects are adapted at the time the modification of the class is detected. ● Lazy: Objects are adapted as long as they are used.
  • 25. Schema Evolution ➲ Eager: ● PJama has a command line tool that accepts a .class file and a text file describing the adapta-tion for its objects, and runs all over the persist-ent store making the necessary changes. ● This tool allows programmers to apply very complex schema evolutions, but it implies that the persistent store cannot be in use while the tool is running. ● The main benefit is that, once the tool is finished, the conversion has also been made and all objects are synchronised.
  • 26. Schema Evolution ➲ Lazy: ● O2 takes note about every conversion in any class, and converts objects when they are used, but not before. ● This means that it supports a versioning system, which keeps trace of every single modification in a class, and applies all adaptations for each modification in order, when an object of that class is used. ● This is an extremely complex system, which makes various objects of different versions of the same class coexist in the same persistent store. ● The main advantage is that the system is never offline, and that objects are only converted when used, so the conversion does not have to stop the system.
  • 27. Schema Evolution ➲ A mixture between eager and lazy: ● In Barbados, when a class is changed, all objects of that class pertaining to the container currently in use are changed. The remaining objects in other containers are pending of change. When a container is loaded, the objects of that class are converted. ● It tries to get the advantages of both systems: it does not have to put the system offline, but the objects in the same container are synchronised.
  • 28. Applications of persistence ➲ OOOS (Object-Oriented Operating Systems): ● EROS (http://www.eros-os.org/) ● GRASSHOPPER ( http://www.gh.cs.su.oz.au/Grasshopper/) ➲ OOPPS (Object-Oriented Persistent Programming Sys-tems) ● Barbados ( http://www.lsi.uvigo.es/lsi/erosello/imo/Imospain/pers.html ) ● Pjama (http://www.dcs.gla.ac.uk/pjava/) ● Oberon-D ( http://www.ssw.uni-linz.ac.at/Research/Projects/OberonD.html) ➲ OODBMS (Object-Oriented Database Management Sys-tems): ● O2 ( http://www.dbis.informatik.uni-frankfurt.de/REPORTS/GOODSTEP/goodstep.html)
  • 29. References ➲ Orthogonal persistence ● Atkinson M.P., Morrison R. (1995). “Orthogonality Persistent Object System”, VLDB Journal v4 n3, pp319-401, ISSN: 1066-8888 ● The first publication trying to state three basic prin-ciples for standard persistence. ● Orthogonality (independence) of: ● type ● management ● designation of persistent objects
  • 30. References ➲ ODMG 3.0 ● http://www.odmg.org ● Cattel R., Barry D., (eds.), (2003). “The Object Data Standard: ODMG 3.0”. Morgan Kaufmann Publishers. ISBN 1-55860-647-4 ● ODMG is the stadnard followed by many firms that sell relational databases with abstraction layers based in objects, such as ORACLE. ● There are also JDBC implementations of this standard for Java.
  • 31. References ➲ PJama ● Sun research: ● http://www.sunlabs.com/forest/index.html ● University of Glasgow: ● http://www.dcs.gla.ac.uk/pjava/ ● PJama, or persistent Java, was a project finisedh in September 2000, trying to give persistence support for Java. ● It was directed by historical experts in persist-ence. ● It is not completely orthogonal (it violates the second and third rule), as it tries to keep back-wards compatibility with existing Java programs.
  • 32. Doctoral course: object technologies IMO Group Department of computer science University of Vigo J. Baltasar García Perez-Schofield http://webs.uvigo.es/jbgarcia/