Unix Technical Forum

swap partition in RAM? Can it be done?

This is a discussion on swap partition in RAM? Can it be done? within the Linux Operating System forums, part of the Unix Operating Systems category; --> The subject tells it all. Can RAM be allocated by Linux for its swap partition? If yes, how do ...


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-17-2008, 07:01 PM
WxMan
 
Posts: n/a
Default swap partition in RAM? Can it be done?

The subject tells it all. Can RAM be allocated by Linux for its swap partition?

If yes, how do you set this up?

Thanks in advance
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-17-2008, 07:01 PM
Lew Pitcher
 
Posts: n/a
Default Re: swap partition in RAM? Can it be done?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

WxMan wrote:

> The subject tells it all. Can RAM be allocated by Linux for its swap partition?


I don't know (I doubt it), but I don't see the point. Why would you want to
allocate RAM as a swap partition? After all, in a virtual memory system, swap is
used to substitute for extra RAM, so that it appears (to your programs) that you
have more RAM than you actually have. If you set aside RAM for a swap partition,
you don't gain anything (and you actually loose some things because you've
reduced the available RAM, and thus have induced more swapping).

> If yes, how do you set this up?
>
> Thanks in advance



- --
Lew Pitcher
IT Consultant, Enterprise Application Architecture,
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed are my own, not my employers')
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

iD8DBQFAo3bjagVFX4UWr64RAqgyAKCSCDSQgKSgTKUzhVlC3/fnWIX1oACfYK5h
/C8TqlNKVbwluV4vAsKsFLU=
=EhcN
-----END PGP SIGNATURE-----
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-17-2008, 07:01 PM
Charlie Gibbs
 
Posts: n/a
Default Re: swap partition in RAM? Can it be done?

In article <AFKoc.58062$FH5.1376047@news20.bellglobal.com>
Lew.Pitcher@td.com (Lew Pitcher) writes:

>WxMan wrote:
>
>> The subject tells it all. Can RAM be allocated by Linux for its swap
>> partition?

>
>I don't know (I doubt it), but I don't see the point. Why would you
>want to allocate RAM as a swap partition? After all, in a virtual
>memory system, swap is used to substitute for extra RAM, so that it
>appears (to your programs) that you have more RAM than you actually
>have. If you set aside RAM for a swap partition, you don't gain
>anything (and you actually loose some things because you've reduced
>the available RAM, and thus have induced more swapping).


Or, as the old joke goes:

"Oh wow, virtual memory! Now I can have a REALLY BIG RAM disk!"

--
/~\ cgibbs@kltpzyxm.invalid (Charlie Gibbs)
\ / I'm really at ac.dekanfrus if you read it the right way.
X Top-posted messages will probably be ignored. See RFC1855.
/ \ HTML will DEFINITELY be ignored. Join the ASCII ribbon campaign!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-17-2008, 07:01 PM
Juha Laiho
 
Posts: n/a
Default Re: swap partition in RAM? Can it be done?

Lew Pitcher <Lew.Pitcher@td.com> said:
>WxMan wrote:
>> The subject tells it all. Can RAM be allocated by Linux for its swap

>partition?
>
>I don't know (I doubt it), but I don't see the point. Why would you
>want to allocate RAM as a swap partition? After all, in a virtual
>memory system, swap is used to substitute for extra RAM, so that it
>appears (to your programs) that you have more RAM than you actually
>have. If you set aside RAM for a swap partition, you don't gain
>anything (and you actually loose some things because you've reduced the
>available RAM, and thus have induced more swapping).


I remember seeing discussion on one situation where I understood this
use of memory: the RAM was on a bus much slower than the regular RAM.
So, if the OS was free to allocate that memory region as it saw fit,
the performance was very erratic. However, used as swap the memory still
was faster than any disk available for the system, so dedicating the
slower memory to swap use did make sense.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-17-2008, 07:01 PM
Angela Kahealani
 
Posts: n/a
Default Re: swap partition in RAM? Can it be done?

WxMan wrote:
>
> The subject tells it all. Can RAM be allocated by Linux for its swap partition?
>
> If yes, how do you set this up?
>
> Thanks in advance


It's not a matter of IF or HOW it can be done,
but that you're even trying to do it indicates a
complete failure to understand the purpose of SWAP space.
DOING it can only incurr overhead and limitations
that would NOT exist if you DON'T do it at all.

Try: swapoff
--
Copyright 2004 Angela Kahealani. All rights reserved without prejudice;
UCC1-207. All information and transactions are non negotiable and are
private between the parties. http://www.kahealani.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-17-2008, 07:01 PM
mjt
 
Posts: n/a
Default Re: swap partition in RAM? Can it be done?

WxMan wrote:

> Can RAM be allocated by Linux for its swap partition?


.... why?
..
--
<< http://michaeljtobler.homelinux.com/ >>
This fortune is inoperative. Please try another.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-17-2008, 07:01 PM
WxMan
 
Posts: n/a
Default Re: swap partition in RAM? Can it be done?

mjt <mjtobler@removethis_mail.ru> wrote in message news:<GcToc.19046$V97.13779@newsread1.news.pas.ear thlink.net>...
> WxMan wrote:
>
> > Can RAM be allocated by Linux for its swap partition?

>
> ... why?
> .


Because of a requirement to not have sensitive data passed through
non-volatile memory in an embedded system.

I have a system handling sensitive data using Linux. Memory size is
not open ended and I am not sure that the amount of RAM could be
sufficient to operate without a swap partition. If the OS and
applications reach RAM capacity in such a situation, no swap, no
performance - maybe even the system freezes?

Correct me if I am wrong, but this is what I am trying to work around
to get the system to avoid a lock-up if there is no swap partition.

If swap can be in RAM, then maybe I can limit RAM usage for
applications and stay within reqs. Its only an idea at this point on
how to approach the problem.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-17-2008, 07:01 PM
P.T. Breuer
 
Posts: n/a
Default Re: swap partition in RAM? Can it be done?

WxMan <wxman@users.sourceforge.net> wrote:
> mjt <mjtobler@removethis_mail.ru> wrote in message news:<GcToc.19046$V97.13779@newsread1.news.pas.ear thlink.net>...
> > WxMan wrote:
> > > Can RAM be allocated by Linux for its swap partition?

> >
> > ... why?

>
> Because of a requirement to not have sensitive data passed through
> non-volatile memory in an embedded system.
>
> I have a system handling sensitive data using Linux. Memory size is
> not open ended and I am not sure that the amount of RAM could be
> sufficient to operate without a swap partition. If the OS and
> applications reach RAM capacity in such a situation, no swap, no
> performance - maybe even the system freezes?


You are confused. Swap stands in for ram. If you had ram you could have
allocated it for ram, not swap.

And no, the system does not "freeze". There is no mystery. When a
process runs out of memory it will do whatever that process does when
it runs out of memory.

> Correct me if I am wrong, but this is what I am trying to work around
> to get the system to avoid a lock-up if there is no swap partition.


You are wrong. In fact you are crazy. In fact you are a disgrace to
the name of thinking human beings. Go back to whatever thinking school
you came out of, and START AGAIN.

> If swap can be in RAM, then maybe I can limit RAM usage for
> applications and stay within reqs. Its only an idea at this point on
> how to approach the problem.


There is no problem, and as you can see for yourself your idea does not
"solve it". Swap stands in for ram. Using ram for it would be like
using money as a stand-in for a credit card. It would make the card
without a point.

Peter
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-17-2008, 07:01 PM
LEE Sau Dan
 
Posts: n/a
Default Re: swap partition in RAM? Can it be done?

>>>>> "Lew" == Lew Pitcher <Lew.Pitcher@td.com> writes:

Lew> WxMan wrote:
>> The subject tells it all. Can RAM be allocated by Linux for its
>> swap partition?


Lew> I don't know (I doubt it),

It IS possible. Use ramdisks. mkswap on them, and then swapon!


Lew> but I don't see the point.

Me neither. It's a complete nonsense to use RAM as swap.


Lew> Why would you want to allocate RAM as a swap partition? After
Lew> all, in a virtual memory system, swap is used to substitute
Lew> for extra RAM,

I'd say "fake" rather than "substitute". Physical RAM has no
substitute yet.


Lew> so that it appears (to your programs) that you have more RAM
Lew> than you actually have.

Yeah. It "appears". Just "appears". It's an illusion afterall.


Lew> If you set aside RAM for a swap partition, you don't gain
Lew> anything (and you actually loose some things because you've
Lew> reduced the available RAM, and thus have induced more
Lew> swapping).

This can be a trick to slow down the system. But then, I'd run a few
"gzip -9 < /dev/zero > /dev/null" instead.



--
Lee Sau Dan +Z05biGVm- ~{@nJX6X~}

E-mail: danlee@informatik.uni-freiburg.de
Home page: http://www.informatik.uni-freiburg.de/~danlee
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 01-17-2008, 07:02 PM
WxMan
 
Posts: n/a
Default Re: swap partition in RAM? Can it be done?

ptb@oboe.it.uc3m.es (P.T. Breuer) wrote in message news:<9st18c.9ab.ln@news.it.uc3m.es>...
> WxMan <wxman@users.sourceforge.net> wrote:
> > mjt <mjtobler@removethis_mail.ru> wrote in message news:<GcToc.19046$V97.13779@newsread1.news.pas.ear thlink.net>...
> > > WxMan wrote:
> > > > Can RAM be allocated by Linux for its swap partition?
> > >
> > > ... why?

> >
> > Because of a requirement to not have sensitive data passed through
> > non-volatile memory in an embedded system.
> >
> > I have a system handling sensitive data using Linux. Memory size is
> > not open ended and I am not sure that the amount of RAM could be
> > sufficient to operate without a swap partition. If the OS and
> > applications reach RAM capacity in such a situation, no swap, no
> > performance - maybe even the system freezes?

>
> You are confused. Swap stands in for ram. If you had ram you could have
> allocated it for ram, not swap.
>
> And no, the system does not "freeze". There is no mystery. When a
> process runs out of memory it will do whatever that process does when
> it runs out of memory.
>
> > Correct me if I am wrong, but this is what I am trying to work around
> > to get the system to avoid a lock-up if there is no swap partition.

>
> You are wrong. In fact you are crazy. In fact you are a disgrace to
> the name of thinking human beings. Go back to whatever thinking school
> you came out of, and START AGAIN.
>
> > If swap can be in RAM, then maybe I can limit RAM usage for
> > applications and stay within reqs. Its only an idea at this point on
> > how to approach the problem.

>
> There is no problem, and as you can see for yourself your idea does not
> "solve it". Swap stands in for ram. Using ram for it would be like
> using money as a stand-in for a credit card. It would make the card
> without a point.
>
> Peter


Well, I didn't post to the group to get insulted, I posted to be consulted.

Thanks for answering my question, even if you are an asshole.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:36 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com