Synchronising cache and file


 
Thread Tools Search this Thread
Top Forums Programming Synchronising cache and file
# 1  
Old 05-09-2017
Synchronising cache and file

I am reading and caching some of the blocks of a large data file into program
virtual memory, for processing. My question is how do I synchronise this
cache with the file, for instance, if a block in the cache is updated or written to,
that block has to be updated in the underlying file. If this process is delayed
or only partly completed, will not the file be inconsistent. This can happen
if there is a power failure. How is this problem handled by DBMS programs ?
I am programming in C. Any answers and references to good books or readily available reading material on this subject will be gratefully appreciated.
# 2  
Old 05-11-2017
Since UNIX already caches files, I figure I do not need to maintain a separate cache in my
program. A judicious use of flock() and fsync() should do the job. Thank you. This thread is solved and closed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Rsync - delete extra files in Destination without synchronising directories

I have a script that synchronises a directory to a DR server, but to improve the time, I actually use rsync to transfer files * in one batch and also * in another batch - both batches run from the same script and run in the background. My problem is that there isn't much space on the... (1 Reply)
Discussion started by: Catullus
1 Replies

2. Red Hat

Path of the DNS Cache file

We have a DNS server that is only using as a cache DNS of parent server. I wonder where it the cache file that it created from parent DNS? Please tell me where will be the cache file? (0 Replies)
Discussion started by: abhilashkrishn
0 Replies

3. Linux

File cache /Page cache Linux

Hi All, could any one point out any open source test-suites for "File cache" testing and as well as performance test suites for the same. Currently my system is up with Linux/ext4. Regards Manish (0 Replies)
Discussion started by: hmanish
0 Replies

4. Solaris

Zfs::zpool.cache file

Hi All, I am trying to read zpool.cache file to find out pool information like pool name, devices it uses and all properties. File seems to be in packed format.I am not sure how to unpack it. But from opensolaris code base we can see that they have used libz for uncompromising this file, but... (0 Replies)
Discussion started by: shailesh_111
0 Replies

5. Linux

getting info on Cache Size, Data Cache etc..

Hi all I saw in Microsoft web site www.SysInternals.com a tool called CoreInfo from able to print out on screen the size of the Data and Instruction caches of your processor, the Locigal to Physical Processor mapping, the number of the CPU sockets. etc.. Do you know if in Linux is available a... (2 Replies)
Discussion started by: manustone
2 Replies

6. Solaris

File cache portion of memory on Solaris

I'm looking to get the file cache portion of physical (real) memory on a Solaris workstation (Similar to the Cache: line in /proc/meminfo on some Linux systems): # swap -s; swap -l; vmstat 2 2; echo "::memstat" | mdb -k total: 309376k bytes allocated + 41428k reserved = 350804k used,... (5 Replies)
Discussion started by: Devyn
5 Replies

7. Solaris

Solaris File Cache

I started a previous thread : https://www.unix.com/sun-solaris/76721-coredumps-swap-part-solaris-mem-consumption.html But my fault as there is no xml feed for this forum i lost track and thread got closed. So in the mean time i went through some docs and here are my queries : 1. mdb -k... (2 Replies)
Discussion started by: rajwinder
2 Replies

8. AIX

Why is my file system cache so large

Hi I have a filesystem cache which is around 20G in size and I'm a bit perplexed as to what is in it. I'm running Sybase on the machine with the db on raw volumes and a tempdb on a ramdisk. My understanding is that raw volumes are not cached and I assumed that the ramdisk is not either. Am... (1 Reply)
Discussion started by: mgibbons
1 Replies

9. Linux

Nagios objects.cache file

Another nagios problem: I have this file: -rw-r----- 1 nagios nagios 21220 jun 9 17:29 objects.cache As you can see with rights at 640, nagios cannot read the file for configuration. I have to manually change the rights to 644 almost everyday. How can i get the rights to stay at 644? ... (1 Reply)
Discussion started by: penguin-friend
1 Replies

10. UNIX for Advanced & Expert Users

UBC cache vs. Metadata cache

hi, What is the difference between UBC cache and Metadata cache ? where can i find UBC cache Hits and Metadata cache Hits in hp-ux? Advanced thanx for the help. (2 Replies)
Discussion started by: sushaga
2 Replies
Login or Register to Ask a Question