You are not logged in.

#1 2011-05-16 18:52:10

kcholakov
Member
From: Bulgaria
Registered: 2010-06-26
Posts: 40

Memory management

Hi guys,

I know that probably this is not the right place for this question but I will really appreciate if you can help me clarify this case:

let's say that I am running Windows and I have 1,5 GB RAM on the machine and am also running a greedily for memory application called A, which uses in that moment 1 GB RAM. So, because Windows is always using virtual memory I suppose that some of the allocated by process A memory is put in swap on the disk and some part is in RAM, so let's suppose 800 MB are in RAM and 200 MB in swap. So from the total RAM (1,5 GB) we have 700 MB free (1,5 - 0,8 = 0,7). On other side in Linux we will NOT have any free memory since Linux is putting everything in RAM if there is free memory available.
So let's now suppose that it comes another process which needs 700 MB to run. On Windows we have it, so it is allocated immediately, but on Linux it should make some swaping and paging for process A so that it can make some free memory to run process B, right? This means that Linux will be much slower in this case. So my question is how Linux deals with this case?

I got this question today from a friend of mine worshiping Windows and everything created by M$.

Thanks in advance.

PS: I am a Linux user.

Last edited by kcholakov (2011-05-16 18:56:01)

Offline

#2 2011-05-16 19:32:34

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Memory management

You can tune the kernel with the swappiness parameter - the closer it is to 100, the more eager the kernel will be to swap unused data out. If you have those 200 MB in swap, they needed to be swapped out at some point and they might be needed to be swapped in at another point, so it's not a clear performance win.

Offline

#3 2011-05-16 20:59:02

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Memory management

I'd rather have the swapping happen when it is necessary instead of beforehand when we don't even know for sure that the swapping will ever be necessary.

Last edited by Ramses de Norre (2011-05-16 20:59:34)

Offline

#4 2011-05-16 21:22:08

cybertorture
Member
Registered: 2010-05-05
Posts: 339

Re: Memory management

Does any one here realy trust MS task manager ? heh


O' rly ? Ya rly Oo

Offline

#5 2011-05-16 22:19:31

jlindgren
Member
Registered: 2011-02-27
Posts: 260

Re: Memory management

kcholakov wrote:

... So, because Windows is always using virtual memory I suppose that some of the allocated by process A memory is put in swap on the disk and some part is in RAM, so let's suppose 800 MB are in RAM and 200 MB in swap. ...

You suppose, or you have some reason to believe it actually does that?  Seems stupid to me to be swapping stuff to disk before there's a need.  But I think the the last time I actually ran out of RAM in Windows was 95 or 98, so for all I know they may have done something like that since then.

Offline

#6 2011-05-17 04:47:16

kcholakov
Member
From: Bulgaria
Registered: 2010-06-26
Posts: 40

Re: Memory management

You mean putting stuff in swap when there is a free memory available? As far as I know that it the behavior of Windows.

Regarding the allocation of memory in this example, it is purely hypothetical. In fact, I doubt it is possible to have 200 MB in swap for a running process.

Last edited by kcholakov (2011-05-17 04:50:38)

Offline

#7 2011-05-17 05:01:51

jlindgren
Member
Registered: 2011-02-27
Posts: 260

Re: Memory management

Hmm, I guess I agree with Ramses de Norre then -- I like it better the Linux way.

Offline

#8 2011-05-17 05:13:57

kcholakov
Member
From: Bulgaria
Registered: 2010-06-26
Posts: 40

Re: Memory management

Of course. Why the hell it should put stuff in swap while there is a free memory available (windows I mean)?!

Last edited by kcholakov (2011-05-17 05:17:01)

Offline

#9 2011-05-18 06:18:05

lukaszan
Member
Registered: 2011-05-05
Posts: 117

Re: Memory management

Linux behaviour far superior:

1. YOU control how much you want to swap beforehand via swapiness (none, obviously)
2. Swap partition will have better performance than a file on your ntfs

The only downside of keeping ev in ram I can think of could be a slight delay when launching an app. I can't think of a scenario where that would be an issue though...

Offline

Board footer

Powered by FluxBB