Question

when use mmap to allocate some anonymous mem, we often set the start address as 0/null so mmap will figure out the starting address by itself. And to get the start address, it will work thought the whole virtual memory space to find a hole which could put the chuck of mem to be allocated. I guess this is calculated as user cpu instead of sys cpu. If the virtual memory is fragmented, then the time to find the starting address will use more user cpu, is my understanding correct

Was it helpful?

Solution

I don't think this is correct. Time spent in the mmap system call is counted as system time. The time to find a large enough window of address space and set up the mappings should be trivial, though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top