I think someone came up with a patch for this about 2 years ago, but I
don't remember what happened to it. It would be nice to have.
I think one of the reasons Sun uses tmpfs is because file accesses are
much faster under SunOS/Solaris if you use a memory based file system.
This turns out not to be true for Linux. The difference is that we
cache metadata and Sun does not. If you want to see the performance
differences run the program attached to the end of this email on a Solaris
machine with a tmpfs /tmp and a normat /usr/tmp using these arguments:
a.out /usr/tmp
a.out /tmp
Now run it on a Linux machine. It you really want to be impressed install
Ultrapenguin on your Ultrasparc and run it there.
Jim
/*************************** Cut Here ************************/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/times.h>
#include <sys/time.h>
int main(int argc, char *argv[])
{
double delta_u, delta_s, delta_w;
int numExtraDirs=15;
int numLoops=2*1024;
char basename[1024];
char tmpname[1024];
char dname[1024];
char cmd[1024];
struct tms start_tms, end_tms;
size_t len;
int i;
sprintf(dname, "%s/_fstest_%ld", ((argc>1)?argv[1]:"/tmp"),(long)getpid());
strcpy(basename,dname);
mkdir(dname,0755);
sprintf(cmd,"rm -rf %s", basename);
for(i=0; i<numExtraDirs; i++) {
strcat(dname,"/Holding_Directory");
mkdir(dname,0755);
}
strcpy(tmpname, dname);
strcat(tmpname, "/some_file.X");
len = strlen(tmpname);
delta_w = -time(0);
times(&start_tms);
for(i=0; i<numLoops; i++) {
FILE *fp;
char tmpchar = (i%26)+'a';
tmpname[len-1] = tmpchar;
if(!(i%100)) {fputc('.', stdout); fflush(stdout);}
fp=fopen(tmpname, "w");
fputc('x', fp);
fclose(fp);
}
times(&end_tms);
delta_w += time(0);
delta_u = (end_tms.tms_utime - start_tms.tms_utime);
delta_s = (end_tms.tms_stime - start_tms.tms_stime);
delta_u /= sysconf(_SC_CLK_TCK);
delta_s /= sysconf(_SC_CLK_TCK);
printf("\n");
printf("Wall time = %.1f User time = %.3f System time = %.3f\n",
delta_w, delta_u, delta_s);
system(cmd);
}