Looking for design inspiration with swapping algorithm

E

exits funnel

Hello,

I'm working on a project for which I've a custom collection class - an
instance of which is roughly analogous to a relational table. The
elements of the collection then are rows and the collection is divided
into logical pages of a fixed (at compile time) number of rows. Up to
this point, the collections have existed entirely in memory but now the
requirement has been added to support swapping to disk. I've played
around a bit with the DataInputStream/DataOutputStream classes and
reading/writing blocks of pages seems not to difficult a task but I'm in
need of some inspiration for the management machinery. I imagine a
single system wide disk file and writing blocks consisting of various
pages from different instances of the collection but I'm not sure how to
track the blocks so that when I need to swap in a given page, I can find
it effiecently. I'm confident that left to my own devices I can craft
something which works, but I'm much less confident that I can craft
something which will perform satisfactorily. Can anyone suggest some
useful patterns? Or possibly some discussion of the solution to a
similar problem? Even general ramblings will be appreciated. Thanks in
advance for any thoughts.

-exits
 
F

Furious George

exits said:
Hello,

I'm working on a project for which I've a custom collection class - an
instance of which is roughly analogous to a relational table. The
elements of the collection then are rows and the collection is divided
into logical pages of a fixed (at compile time) number of rows. Up to
this point, the collections have existed entirely in memory but now the
requirement has been added to support swapping to disk. I've played
around a bit with the DataInputStream/DataOutputStream classes and
reading/writing blocks of pages seems not to difficult a task but I'm in
need of some inspiration for the management machinery. I imagine a
single system wide disk file and writing blocks consisting of various
pages from different instances of the collection but I'm not sure how to
track the blocks so that when I need to swap in a given page, I can find
it effiecently. I'm confident that left to my own devices I can craft
something which works, but I'm much less confident that I can craft
something which will perform satisfactorily. Can anyone suggest some
useful patterns? Or possibly some discussion of the solution to a
similar problem? Even general ramblings will be appreciated. Thanks in
advance for any thoughts.

I would suggest you use a database.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top