out of core data storage

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
anmabagima
Posts: 87
Joined: Thu Oct 01, 2009 8:43 pm

out of core data storage

Post by anmabagima »

Hi there,

I'm not sure whether this post has the right subject or not. However, I've seen articles on the web discussing "out of core data storage" which some PC OS/applications are capable of. This mean that in the case the application need to process huge ammount of data it is not loaded into the RAM (core) but left in the file. The file access in this scenario is like accessing memory using a pointer to the data once the file was opened.

As the PSP has no harddisk but only SD card I question myself whether the PSP is capable of supporting this approach or not. And now I would like to ask you.... As on a common PC the access speed would be very much slow due to limmitations of the hardware but the SD card access on PSP should work like accessing RAM from a performence point of view, shouldn't it ?

The sceIO operations just gives file handles.You need to use them with READ methods to get data from the file into a buffer. I would like to have something like a pointer to the raw data of the file and beeing able to directly access this data I'm interested in, as I would do using them within a buffer in RAM. Is that possible ?

Any thoughts and Ideas are welcome and much appriciated.

Regards
AnMaBaGiMa
a_noob
Posts: 97
Joined: Sun Sep 17, 2006 8:33 am
Location: _start: jr 0xDEADBEEF

Post by a_noob »

I am not to sure about via the sceIo, I think it would need to use some reversing because it just returns a handle no actual data, but if you where to use stdio maybe, unless it was just hacked to store the handle and then accessed, but it it is properly used/coded then here is the FILE datatype wich has the info you need.

Code: Select all

typedef struct  {
       int             level;      /* fill/empty level of buffer */
       unsigned        flags;      /* File status flags          */
       char            fd;         /* File descriptor            */
       unsigned char   hold;       /* Ungetc char if no buffer   */
       int             bsize;      /* Buffer size                */
  unsigned char   *buffer;    /* Data transfer buffer       */
  unsigned char   *curp;      /* Current active pointer     */
       unsigned        istemp;     /* Temporary file indicator   */
       short           token;      /* Used for validity checking */
}       FILE;

Code: Select all

.øOº'ºOø.
'ºOo.oOº'
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

What you talk about is not possible on the PSP, because it does not have an MMU, especially not one that is capable of memmapping files.
So there is no direct way of pointer->file mapping, unless you write your own software layer, which pipes an smart pointer abstraction through sceIo function calls.
Unless you use C++ and operator overloading and templates, it wouldn't change anything about the feel of having to use functions to write data to files and even then, you still won't be able to write directly to constant addresses as with memory: *((int*)0xabcdef) = somevalue;
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
anmabagima
Posts: 87
Joined: Thu Oct 01, 2009 8:43 pm

Post by anmabagima »

Hi,

thanks. I will try this. But "my" FILE structure looks pretty much different:

Code: Select all

typedef __FILE FILE;

struct __sFILE &#123;
  unsigned char *_p;	/* current position in &#40;some&#41; buffer */
  int	_r;		/* read space left for getc&#40;&#41; */
  int	_w;		/* write space left for putc&#40;&#41; */
  short	_flags;		/* flags, below; this FILE is free if 0 */
  short	_file;		/* fileno, if Unix descriptor, else -1 */
  struct __sbuf _bf;	/* the buffer &#40;at least 1 byte, if !NULL&#41; */
  int	_lbfsize;	/* 0 or -_bf._size, for inline putc */
and some more stuff ... The _bf is defined as

Code: Select all

struct __sbuf &#123;
	unsigned char *_base;
	int	_size;
&#125;;
I would assume the pointer to _base will do the job as well. I'll give it a try.
m0skit0
Posts: 191
Joined: Tue Jun 02, 2009 8:58 pm

Post by m0skit0 »

anmabagima wrote:but the SD card access on PSP should work like accessing RAM from a performence point of view, shouldn't it ?
Abolutley NOT. DDR2 SDRAM offers 3200 MB/s, when best SD card you could find can only perform at 45 MB/s. Also SD Cards (as flash memory) have a latency measured in miliseconds, while main memory latency is usually measured in nanoseconds. So no, no way you can use SD as virtual RAM and expect close performance. RAM wins high hand.
anmabagima wrote:I would like to have something like a pointer to the raw data of the file and beeing able to directly access this data I'm interested in, as I would do using them within a buffer in RAM. Is that possible ?
It is possible, but as I stated before, you would have a big drop in performance, not to speak about the software layer you'd have to set up as commented by last answer.
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
anmabagima
Posts: 87
Joined: Thu Oct 01, 2009 8:43 pm

Post by anmabagima »

Hi,

thanks to all for the valuable statements.

Regards
AnMaBaGiMa
Post Reply