Xref: utzoo alt.sys.sun:1590 comp.unix.programmer:181 comp.unix.questions:25971 Path: utzoo!attcan!uunet!snorkelwacker!bloom-beacon!eru!hagbard!sunic!lth.se!newsuser From: collberg@dna.lth.se (Christian S. Collberg) Newsgroups: alt.sys.sun,comp.unix.programmer,comp.unix.questions Subject: Strange mmap behaviour when exiting a program. Help anyone? Message-ID: <1990Oct4.142201.5630@lth.se> Date: 4 Oct 90 14:22:01 GMT Sender: newsuser@lth.se (LTH network news server) Reply-To: collberg@DNA.LTH.Se (Christian S. Collberg) Organization: Computer Science, Lund Institute of Technology, Sweden Lines: 34 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@dna.lth.se