Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
12-14-2007, 08:58 PM
|
#1
|
LQ Newbie
Registered: Dec 2007
Posts: 8
Rep:
|
Can Demand Paging be disabled or circumvented?
Is it possible to turn off or circumvent demand paging in Linux? I need to be able to load an entire executable into memory before it executes and not just have one page at a time be loaded. Our application cycle times cannot tolerate page faults.
Thanks.
|
|
|
12-15-2007, 02:37 PM
|
#2
|
LQ Guru
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,370
|
Try the swapoff command:
swapoff -a
see:
man swapoff
------------------
Steve Stites
|
|
|
12-15-2007, 05:57 PM
|
#3
|
LQ Newbie
Registered: Dec 2007
Posts: 8
Original Poster
Rep:
|
Swapoff
Wouldn't that only affect a program AFTER it is already loaded in memory? That would prevent it from being swapped back out, but would it fix the problem of demand paging the executable in in the first place?
|
|
|
12-15-2007, 07:03 PM
|
#4
|
LQ Guru
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,370
|
Quote:
Originally Posted by ajmayhall
Wouldn't that only affect a program AFTER it is already loaded in memory? That would prevent it from being swapped back out, but would it fix the problem of demand paging the executable in in the first place?
|
Turn swap off before the program gets loaded for the first time.
---------------------
Steve Stites
|
|
|
12-15-2007, 08:25 PM
|
#5
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,314
|
In another universe I would allocate page-fixed storage, fetch my (entire) executable into it (once), then transfer control to it.
Sorry, I don't know how to do that in *nix. Got me interested though ...
|
|
|
12-15-2007, 09:54 PM
|
#6
|
LQ Newbie
Registered: Dec 2007
Posts: 8
Original Poster
Rep:
|
That's what I was thinking as well
I was thinking the same thing, but don't really know how to do that in Linux either. I have done that on SBCs in the past in assembler though.
|
|
|
12-15-2007, 11:00 PM
|
#7
|
Member
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792
|
|
|
|
12-15-2007, 11:18 PM
|
#8
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,314
|
Looks handy.
Got any thoughts on how a program (and any shared objects) can be force loaded in their entirety ???.
Just academic interest in my case ...
|
|
|
12-15-2007, 11:28 PM
|
#9
|
Member
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792
|
Sorry, I don't know anything about using it, but like you my interest was piqued by this post.
I googled a bit and found this, where the guy wrote a C wrapper for his program.
Norm
|
|
|
12-16-2007, 08:05 AM
|
#10
|
LQ Newbie
Registered: Dec 2007
Posts: 8
Original Poster
Rep:
|
mlockall
We use mlockall, but if you notice, there are two flags used, current and future. It locks the pages in and keeps them from being swapped out AFTER the fact. It won't force the executable to be paged in completely at first. If you look into the source for exec.c, the comments from Linus tell the story. He only loads the header and lets demand paging do the rest.
|
|
|
12-16-2007, 01:27 PM
|
#11
|
Member
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792
|
You've probably thought of this, but how about loading the app to a ramdisk? Would that speed things up enough to make the page faults tolerable?
Norm
|
|
|
12-16-2007, 02:06 PM
|
#12
|
LQ Newbie
Registered: Dec 2007
Posts: 8
Original Poster
Rep:
|
RAM disk
We tried that Friday, it still didn't eliminate the timing issue, the page faults seem to still be taking too much time even using a RAM disk.
|
|
|
12-16-2007, 08:00 PM
|
#13
|
Member
Registered: Jun 2004
Location: Northern CA
Distribution: Debian
Posts: 835
Rep:
|
What if you ran an assurance test when the program loaded? If you run each function that you need and access each memory location, then your application can start it's real work. This will increase load time, and may be risky if a part of a function lands in a different page that doesn't get loaded.
(I'm not qualified to help here, I'm just curious.)
|
|
|
12-16-2007, 09:04 PM
|
#14
|
LQ Newbie
Registered: Dec 2007
Posts: 8
Original Poster
Rep:
|
We do that now
We try to do that now, unfortunately, we cannot guarantee that we take all the branches the programs will take when they run. That seems to be the only current way to ensure all the pages get pulled into RAM and get mlocked in, we also try to make sure that we initialize all the data as well.
|
|
|
All times are GMT -5. The time now is 03:12 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|