I think labs on android are the same as that on desktops. That said, please note that contents of memory map files are internal representation of data and they may incompatible across different J versions or platforms.
On Mon, Nov 17, 2014 at 1:58 PM, 'Pascal Jasmin' via Programming <[email protected]> wrote: > there is FlushFileBuffers on windows (which is also available on mono), > though I understand the real linux equivalent is fsync. It applies to OSX > and android too. > > It can be expensive to call often, and the crossplatform behaviour can be > iffy as some filesystems let the hard drive decide whether to really write > the data, and other systems order the HD to flush (though the HD may still > choose to take the order under advisement, and scores much better in > benchmarks if it ignores the order) > > On the question of mapped files vs fwrite, a neat feature of mapped files is > "atomicity on error" (no changes). A downside is that it takes 8KB even if > your data is a few bytes. > > For application/data design, the question becomes is a transaction really > complete (or does it really matter) if no one else knows about it? > > Rather than be paranoid about fsync and power failures, it is more important > to have a recover operation from non-clean shutdown, and no matter how time > consuming it is, use it if the cleanshutdown flag wasn't committed to disk. > > When thinking of a memory mapped file implementation, its a good idea to at > least have a in memory with fread fwrite version as well, since for testing > you are likely to often corrupt data, and fread/fwrite are needed for backups > anyway. > > With that said, memory mapped files look interesting for fixed record number > files (file growth doesn't need management), as its expected to be quick, and > fewer special (fwrites) operations are needed. > > Does the memory mapped files lab exist on android? > > > > ----- Original Message ----- > From: Raul Miller <[email protected]> > To: Programming forum <[email protected]> > Cc: > Sent: Sunday, November 16, 2014 12:11 PM > Subject: Re: [Jprogramming] memory mapped files as non-volatile storage > > That depends on the OS. And, the disk itself. > > But J's practice of closing the file will flush it to disk. How long it > takes though, for the operation to complete, depends on what else is > happening (for the OS), and on details of the disk hardware (for the disk). > > And, of course, computers sometimes fail... > > And, occasionally, other bad things happen. > > You just have to make a best effort. > > Thanks, > > -- > Raul > > On Sun, Nov 16, 2014 at 8:46 AM, Henry Rich <[email protected]> wrote: > >> I think you'd have the power-fail problem with delayed writes even if you >> use plain files. Writing to a file doesn't necessarily flush it to disk. >> >> Henry Rich >> >> On 11/16/2014 2:22 AM, Raul Miller wrote: >> >>> If your data is small, I'd just live with 1!:2 <'filename' >>> >>> Memory mapped files can be fun to work with, but I don't see any >>> advantages for a situation like this. >>> >>> Thanks, >>> >>> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > >> > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
