LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-27-2005, 12:17 PM   #1
Pandamatak
LQ Newbie
 
Registered: Sep 2005
Location: Menlo Park, CA
Posts: 8

Rep: Reputation: 0
How to disable swap space entry for a process (Sticky bit?)


Hi,

I have a RH9 system with 1G of RAM. I start a server process that will initialize by allocating a data structure that's about 500Mb in size. The problem is that as the process initializes itself, the data structure is allocated in swap space rather than in RAM. It's only when the data structure is actually used during computation that it seems to enter RAM from swap. As a consequence, the first time the data structure is instanced, the server takes about 180 seconds to process the request.

From then on it takes less than a second as it should. I also notice that the process size is constant at 437Mb from the start, but the resident size (RSS) in top is 217Mb before the first request, and stays constant at 437Mb after the first request. I do know that there is no demand for RAM when this process is started (i.e. this is the only RAM-hungry process when it starts up). So how do I make it NOT ENTER swap space at all, from the moment it starts? I don't want users to have to wait 180 seconds for their first request.

Thanks much.

pandamatak

PS. Every byte of the entire data structure is accessed for each server request.
 
Old 10-27-2005, 06:02 PM   #2
freakyg
Member
 
Registered: Apr 2005
Distribution: LFS 5.0 and 6.1
Posts: 705

Rep: Reputation: 30
Re: How to disable swap space entry for a process (Sticky bit?)

Quote:
Originally posted by Pandamatak
Hi,

I don't want users to have to wait 180 seconds for their first request.
3 minute wait , hmm.............you can't just turn the swap on/off any time you want.............try this tho, edit your /etc/fstab and comment out the "swap" line and re-boot, with no swap at all things might run faster when memory is always utilized...............just have to try it and see what happens?!?!?!
 
Old 09-25-2006, 05:40 PM   #3
Pandamatak
LQ Newbie
 
Registered: Sep 2005
Location: Menlo Park, CA
Posts: 8

Original Poster
Rep: Reputation: 0
Commeting out swap partition solved the problem

Thanks for the suggestion and apologies for the belated response from me.

Yes, commenting out swap in fstab did the trick, but I'd still prefer a cleaner solution if someone has it.

Cheers.

&
 
Old 09-25-2006, 06:17 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Just access whole of the data at startup time, this will move it from the swap to RAM. Then your first request will run fast.
If you want that area to stay on RAM forever, you can use the mlock call to have it staying there.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sticky Bit Doesn't Seem to work krishvij Linux - Newbie 5 05-10-2005 05:31 PM
Losing sticky bit privilege when using fork() jones507 Programming 1 11-13-2003 03:57 PM
Sticky Bit tarballed Linux - General 4 07-03-2002 03:54 PM
Sticky bit question...need help rootlinux Linux - General 1 01-26-2002 05:12 PM
sticky bit motiram Linux - General 1 08-01-2001 12:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration