Do mlock() and madvise() work?
Hello all, I am hoping someone familiar with vm on darwin can answer this question. Simply put, if I use mlock or madvise from userland, are they going to do anything, or is this currently a noop? The OS claims it is very liberal about how much space you can lock down, currently LONG_MAX bytes. Normally I would assume it would work, but this seems like just the sort of thing a kernel engineer would decide was a bad idea for religious reasons and procrastinate implementing ad infinitum ... so I thought I would ask. This feature is important for low latency real time audio. If the audio latency is less than the seek time on the hard drive, then vm will fail to deliver the data on time and the sound will break if important data comes to be paged out. Also, on a related note, is there any way to hint to the kernel that a region of memory is likely to be needed soon, and have it do an asynchronous prefetch on it to get it into DRAM before it is needed. Should I use madvise() for this? Should I just set up a thread that blocks on a queue and pass addresses to it to touch? What is the best way to go here? Ian --------------------------------------------------- Ian Ollmann, Ph.D. iano@cco.caltech.edu ---------------------------------------------------
participants (1)
-
Ian Ollmann