Re: Transactions with files?
From: Ed Prochak (ed.prochak_at_magicinterface.com)
Date: 07/20/05
- Next message: Juan Antonio Giménez: "know my id process"
- Previous message: Chris Morrison: "CryptoAPI for linux"
- In reply to: Toni: "Transactions with files?"
- Next in thread: Toni: "Re: Transactions with files?"
- Reply: Toni: "Re: Transactions with files?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 20 Jul 2005 09:38:42 -0700
Toni wrote:
> Hi,
>
> I'm writing a C program that should do something like transactions on
> files.
> I have several reader processes and one writer, and I have to make sure
> that the writer either writes everything or nothing to (part of) a
> file.
> So I thought of COW (copy-on-write), but how to do that?
> mmap() with MAP_PRIVATE can give me a copy of the (part of the) file to
> work with. But how can I write the changes back to the original file so
> that other processes would see those changes? MAP_PRIVATE prevents
> writing changes to the original file, so I can't use msync().
> AIX has deferred write capability (open() with O_DEFER flag)- changes
> are written to a file only when fsync() is called. Linux doesn't seem
> to have such a capability.
>
> Any ideas?
>
> Cheers, Toni
Look at some of the open source databases.
You might consider that the writer only does a write on the commit. You
can do that by caching the individual writes in memory or in a
transaction log file. At the commit point, all the data is written at
once.
Note that the other processes won't see changes to the file unless they
go back and reread it.
So BTW, when is your assignment due? Not too many folks take summer
classes.
Ed
- Next message: Juan Antonio Giménez: "know my id process"
- Previous message: Chris Morrison: "CryptoAPI for linux"
- In reply to: Toni: "Transactions with files?"
- Next in thread: Toni: "Re: Transactions with files?"
- Reply: Toni: "Re: Transactions with files?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|