orthogonal persistency

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

orthogonal persistency

Post by distantvoices »

Yo, in some threads here I ve read glimpses about orthogonal persistency and I remember about it being mentioned in tanenbaums os dev and implementation-book.

Here is a quick definition:

persistent methods have to be available to ALL types with out any action of the programmer.

all objects reachable from one object are made persistent.

There is no difference if code works with/over persistent data or not.

My question: how does one achieve orthogonal persistence in an os?
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
_mark

Re:orthogonal persistency

Post by _mark »

object persistance is usually achived by adding a serialize function to an object. This allows the object to format the data in the most appropriate manner for being persisted along with traversing an object tree and inturn calling serialize on each object.

In an OS we are generally not using objects, but instead intrinsic types such as int and character arrays. There are some which are coding in C++, but that alone is not enough to provide persistance out of the box. A framework of abstract objects and persistant methods still needs to be written.

Windows handles OS specific data persistance by the use of the registry. Unix OS will scatter this information around, but most of it will be found in /etc somewhere. Windows probably has the closest example of what you might be looking for. Some well known APIs for writting basic intrinsic types to a data store.

Now, if you really want object persistance, first you need to define what an "Object" is in your OS. I can think of about a gagillion different ways to do this, but one might be a simple struct that has pointers to serialize methods. I actually use this pattern in other parts of my OS, but the gist is this known structure sits as the first member of other structures - or in my case a pointer to one.

But you may find that 100% of your persistable data is of a known type to you. IE - you have defined all the structures. Object persistance is really ment as a way to persist object that are unknown to the developer of the persistance routines. Since you know what these structures are and you know when and where they need to be saved/loaded - simple read and write routines should be enough.

_mark()
Post Reply