Please advise good source of info about swapping


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Please advise good source of info about swapping
# 1  
Old 03-28-2012
Please advise good source of info about swapping

Hi Everyone,

I have some misunderstanding about swapping.

Is it true that swap
a) required always (I mean I cannot set size 0 bytes)
and
b) some pages are saved on disk in idle time even free memory is enough
?

Could you please advise some good reading about it?
# 2  
Old 03-28-2012
Whether it's required or not depends on the operating system.

Whether pages are saved to disk in idle times also depends on the operating system but these days, often not. An operating system will often pre-claim space inside the swap though, in case it needs to do so later.

Whether or not it's required, having swap is a good idea. Without it, you may run out of memory and deadlock or die.
# 3  
Old 03-28-2012
Corona688, thank you for your comment.

Could you please be more specific about operating systems?
I mean Solaris, Linux. Is swap must be on these platforms?

Why without swap I may run out of memory but with swap not?
If I have 8Gb RAM and 8Gb swap and an application requests 20Gb will it run out of memory?


And I will try be more specific about the question.
Let's suggest that I have some soft, for example, Oracle database.
And I am worry that with swap my OS will save pages on the disk in background even it is not required.
Am I right?
# 4  
Old 03-28-2012
[duplicate]
# 5  
Old 03-28-2012
These systems respond somewhat differently to swap.

If you ask for 20GB of RAM in Linux it will reserve you that much address space, not that much RAM. Only when you actually start using these individual pages of RAM will it give you actual memory. If programs end up using more RAM than you actually have, pieces will start having to end up in swap. Without swap, or when the swap's full, the kernel will start killing the worst offenders to reclaim some RAM and stop the system from deadlocking. This is known as 'overcommit' and can be disabled if you really want, but is useful for some situations; the google search engine's servers apparently rely heavily on the Linux OOM-killer.

Some other systems(HP-UX if I recall) don't have any sort of overcommit. All memory must be backed by swap of some sort. If you don't have enough, some memory will be used to act like swap for other memory.

I think Solaris is somewhere between these two extremes.
# 6  
Old 03-28-2012
There is a substantial Wikipedia on this subject (and links to more articles):
Paging - Wikipedia, the free encyclopedia


Quote:
If I have 8Gb RAM and 8Gb swap and an application requests 20Gb will it run out of memory?
No: The request will be refused.
Btw. The old rule that you must have at least as much swap as you have memory does not apply to modern unix.

Many modern unix systems can be configured to use part of memory for swap. This allows the O/S to defragment main memory quickly and quietly.

If you have Oracle, buy enough memory so that it should never swap and be sure that you understand how to size the SGA and PGA and how to measure these sizes using Oracle itself. It is very common to missize the SGA by a factor of 8 or even 16.

Last edited by methyl; 03-28-2012 at 02:20 PM..
# 7  
Old 03-28-2012
Guys,
Thanks for your comments.

If you have Oracle, buy enough memory so that it should never swap

1) Does this mean that OS will not do unnecessary paging in background?

2) Does this mean that if I have 128Gb of RAM and if I am sure that my soft (for example Oracle) will not use more than 120Gb of RAM (SGA + PGA = 110Gb), I give 8 Gb for OS (kernel, etc) and I can set swap size 0 bytes ?

3) For 8Gb RAM and 8Gb swap how much memory I can eat (really)? As I understand I can 16Gb. Am I right?
Why there was a requirement to have swap the same size as RAM? Why not 3 size of RAM or 4 sizes of RAM?
The requirement to have swap the same size of RAM looks like swap not add space to memory but something like mirror RAM memory on a disk. In this case I would be able to eat 8Gb, not 16Gb.

Please comment

---------- Post updated at 11:42 AM ---------- Previous update was at 11:36 AM ----------

From your comments I can consider that swap is just something as additional slow memory ;-)
But from my current vision concept of swap is more important and indivisible with virtual memory concept.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Solaris

Swapping

Hi Guys I am using SPARC-T4 (chipid 0, clock 2998 MHz), SunOS 5.10 Generic_150400-38 sun4v. How do I see if the server was doing some swapping like yesterday? I had a java application error with java.lang.OutOfMemoryError, now I want to check if the server was not doing some swapping at... (4 Replies)
Discussion started by: Phuti
4 Replies

2. Solaris

Secondary group info source

Experts, I know when I use id it shows only the primary group information for the given user, and that info comes from passwd file. When I use groups it shows all groups user are member of, however from where come information given by groups command? grep fmtt3990 /etc/passwd... (6 Replies)
Discussion started by: fmattos
6 Replies

3. UNIX for Dummies Questions & Answers

Good source of X11 programming info?

Is there a good book or something on practical programming in X11? I have the O'Reilly X window system book set. They don't seem to cover the nuances very well (at least for me). So far the only thing I find on the web is the text from these books. Specifically, I'm looking for optimization... (2 Replies)
Discussion started by: willil
2 Replies

4. UNIX for Advanced & Expert Users

source reader info

Hi friends, I urgently need to know if there is any tool called source reader in C or Unix or Linux...... If so ..plz let me know the details.I am running out of time..... (0 Replies)
Discussion started by: vijaya2006
0 Replies

5. SuSE

Swapping

Hello! Why does my SuSE GNU/Linux machine swap? I have a Gig of ram, currently 14MBs of free RAM, 724MB - buffers and caches... That is 685MB of cached RAM, then kernel really should'nt have to swap, It should release cached memory in my thinkin... It has only swaped 3MB's but still,... (3 Replies)
Discussion started by: Esaia
3 Replies

6. AIX

Good source of AIX Specific Scripting?

Hi everyone, I need to write some AIX scripts (ksh?), kind of fast so I'm looking for somewhere to get a crash course in it. Are there any AIX Specific Scripting resource sites that anyone can recommend, really not getting a whole lot from google. Thanks in advance, Darren (3 Replies)
Discussion started by: dbridle
3 Replies

7. UNIX for Dummies Questions & Answers

how to get swapping info

Hi How can I determine if swapping is occuring on a server. Thanks, Leo (2 Replies)
Discussion started by: leo
2 Replies
Login or Register to Ask a Question