Strange mmap behaviour when exiting a program. Help anyone?
Christian S. Collberg
collberg at dna.lth.se
Fri Oct 5 00:22:01 AEST 1990
There has been some talk lately about mmap and various bugs. I'm running
SunOS 4.1 on a SUN 3/80 and am having problems with mmap efficiency when
exiting a program. This is what I do:
BEGIN
1) FOR f IN approx 100 different files DO
a) open f for reading;
b) addr := mmap(0, SIZEOF (f), PROT_READ, MAP_PRIVATE, f, 0);
c) close f;
d) read the *beginning* of f;
e) munmap (addr, SIZEOF (f));
END;
2) FOR f IN approx 100 different files DO
a) open f for reading;
b) addr := mmap(0, SIZEOF (f), PROT_READ, MAP_PRIVATE, f, 0);
c) close f;
d) read the *end* of f;
e) munmap (addr, SIZEOF (f));
END;
END;
Everything works fine until I try to exit the program. After the last
statement has been executed it takes the system approximately 10 seconds
before it gives me the prompt back. During this time the process seems
to consume 100% of the CPU power. Does anyone know what it is doing?
Is it cleaning up after the 200 mmaps? Am I doing something wrong?
Thanks in advance for any info you might have.
Chris Collberg
collberg at dna.lth.se
More information about the Comp.unix.programmer
mailing list