Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

Force file write delay ( a special filesys using physical memory )

Is there any way to force write delay for specical files in
UNIX system ? It should be something like
fopen(myfilename, rw, "Not_Write_To_HardDisk").

I meant if the system programmer know the file(s) is a frequently used, frequently changed ( not necessary to flash to HardDisk ) one, can he do something to interfere with the file system swapping ?

Or can we allocate a small physical memory area, setup a filesystem on it, then let several programs read/write data file from/to it. That will just like a RAM disk in PC, a small never_swap_out file system.

I think it will be a fast & easy way for several processes to share some public data. Those processes may be designed by different programmers, for different purpose. But no one need to worry about the share memory stuff,  and  file read/write/lock are easy to handle.

PS, it's very useful for hot imgs/pages in web server. Can proxy server do the job (cache specific file in physical memory) ?

Any sugguestion or successful story ?  Thanx.
0
sunjohn
Asked:
sunjohn
  • 2
1 Solution
 
sunjohnAuthor Commented:
Adjusted points to 100
0
 
jos010697Commented:
Have a look at mmap() and munmap(). Those functions
map a region of memory onto a file. The file is used as
swap space _whenever necessary_. If there' enough
memory available, all of the mapped region stays in core.

Simply map a (existent) file to memory and let all the processes
do whatever they want to do with it; they all treat it as if
it wrer just part of their (virtual) address space.

kind regards,

Jos aka jos@and.nl
0
 
sunjohnAuthor Commented:
Thanks a lot.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now