LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   What is meaning of "has pages locked into memory (for real-time and custom IO) " ? (https://www.linuxquestions.org/questions/programming-9/what-is-meaning-of-has-pages-locked-into-memory-for-real-time-and-custom-io-880422/)

dtustudy68 05-12-2011 07:16 PM

What is meaning of "has pages locked into memory (for real-time and custom IO) " ?
 
From ps aux I found that the program's stat is SL, it means :

has pages locked into memory (for real-time and custom IO)

What does this mean ?
How to avoid this ?

Thanks

sundialsvcs 05-12-2011 09:23 PM

Let's talk about the computer hardware.

As in ... the physical chips that actually handle the task of taking bytes of data from that cable that's coming in from your disk drive, and placing those bytes (somewhere...) in the memory of your computer.

Those chips actually do the physical transfer, through a bit of magick called "DMA = Direct Memory Access." The transfer doesn't involve the CPU ... until the chips interrupt the CPU to notify it that the transfer is done.

If you've got a chip moving data into a particular place in the computer's memory, then you'd better be very sure that this particular block of memory is not going to be used for any other purpose by any bit of software. And that, in short, is precisely what "locking pages" is all about. The pages are locked in place, then commands are issued to the chips, and the pages are unlocked after the chips interrupt us to say that the transfer has been completed.

So it goes ...

Nominal Animal 05-13-2011 01:08 PM

Quote:

Originally Posted by dtustudy68 (Post 4354813)
has pages locked into memory (for real-time and custom IO)
What does this mean ?

It means the program has asked the kernel to keep those pages in memory. It is quite usual, if the program does time-sensitive I/O -- for example, if it streams important data to or from a disk, or a peripheral device like a sensor or something.

Like sundialsvcs wrote in the above post, in some cases (when using DMA to transfer data to or from a device) locking the memory is required for correct operation.

Quote:

Originally Posted by dtustudy68 (Post 4354813)
How to avoid this ?

Normally there is no reason to try to avoid that. Most distributions set sensible memory locking limits by default.

If you insist, set the memlock resource limit. You can use the pam_limits module to set default limits; see man limits.conf and man pam_limits. You can also use the ulimit built-in command provided by most shells, to set the limit for a specific program before running that program:
Code:

ulimit -l 64
/usr/bin/whatever-command arguments...

which sets the limit at 64*1024 bytes (65536 bytes). See for example man bash-builtins to see the usage for ulimit when using Bash.

You can run
Code:

ulimit -a
in a newly started shell to see what limits are set by default. (Note that for system services, the limits are usually different.)

Finally, if the limit is set too low, programs that need to lock memory will usually refuse to run. If you don't want them to run, just disable them directly.


All times are GMT -5. The time now is 11:45 AM.