Swap issue also on Update 4 ?

A forum for general AmigaOS 4.x support questions that are not platform-specific
User avatar
samo79
Posts: 555
Joined: Fri Jun 17, 2011 11:13 pm
Location: Italy

Swap issue also on Update 4 ?

Post by samo79 »

I know that this argument was already covered in many places however i test again the swap functionality copying some files on RAM disk (but now using Update 4) but after i exceed the amount of my physical memory (that is 1 GB) all i get is the usual freeze

My system is:

SamFlex 800 Mhz
1 GB RAM
AmigaOS 4.1 Update 4 (Kernel 53.25)

And this is my swap settings:

http://imageshack.us/photo/my-images/805/swap.png/
User avatar
Hypex
Beta Tester
Beta Tester
Posts: 442
Joined: Mon Dec 20, 2010 2:23 pm
Location: Vic. Australia.

Re: Swap issue also on Update 4 ?

Post by Hypex »

I also get a freeze when my VRAM gets too low. The system stutters then mouse freeze. Can reboot, no crashlog.

Sometimes a USB mouse/KB and bring it back. Sorry tihs slightly off topic.
User avatar
ssolie
Beta Tester
Beta Tester
Posts: 1010
Joined: Mon Dec 20, 2010 8:51 pm
Location: Canada
Contact:

Re: Swap issue also on Update 4 ?

Post by ssolie »

You are likely locking all memory. When this happens the system will freeze and this is normal for the swapper and always has been that way. There is no "fix" because there is nothing he OS can do when you force this situation. Apps should avoid using shared memory because it is locked and eats up available address space.
ExecSG Team Lead
kas1e
Beta Tester
Beta Tester
Posts: 483
Joined: Sat Jun 18, 2011 7:56 am
Contact:

Re: Swap issue also on Update 4 ?

Post by kas1e »

Imho, system never should freezes, and better to have ugly workorounds (like even linux do, or kind), in compare with freezes. System should handle all the problematic parts, and when its need it, some how inform user about, or do something tasty, which in end will not results as freeze. What the reassons to call swapping as swapping, if it just not swapping but freezing ? Sure , apps should do or not do something, but if still they do, OS by itself should handle problematic moments and workoround them.

And, to add, as i know on update2 swapping still works somehow, but start to freeze in update3 and in update4.
User avatar
samo79
Posts: 555
Joined: Fri Jun 17, 2011 11:13 pm
Location: Italy

Re: Swap issue also on Update 4 ?

Post by samo79 »

ssolie wrote:You are likely locking all memory. When this happens the system will freeze and this is normal for the swapper and always has been that way. There is no "fix" because there is nothing he OS can do when you force this situation. Apps should avoid using shared memory because it is locked and eats up available address space.
Hi Steven thanks for reply :-)
Yep of course this is a force situation for sure (it serve me for this test only) but i have a question at this point: where is the difference between fill the memory copying files in RAM and using the OS "for real" finishing the phisical memory with many apps opened ?

I think the result might be the same as memory are used exact the same, or not ?

I didn't try to open many apps at the same time to fill my entire mem (for a real test can say!) just because i have 1 GB installed (a lot of memory in general for AmigaOS) but i can do without any freeze eventually ?

Also why all that freeze ? how about adding and error message and just skip in that case ?
Isn't better ?

@Hypex
No problem ;)
User avatar
Raziel
Posts: 980
Joined: Sat Jun 18, 2011 4:00 pm
Location: a dying planet

Re: Swap issue also on Update 4 ?

Post by Raziel »

@ssolie

Just a little question.

Would it also be a "forced" situation (or maybe simply a bug with the lha program) if i pack a lha with files which size's exceeding my RAM (512MB)?

I get a slowdown from lha first (Can be seen by the packing algorythm counting the bytes in shell - slower) and after a few more MB's into the SWAP freezing?

Also (but thats slightly OT) the game i referred to in my Bug report (Aquaria) is still freezing, not THAT bad as with upd3, but still (can be a bug in the game though, that's why i said OT)

Hmm, i need to test UnArc with huge .lha's...
People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
User avatar
ZeroG
Posts: 119
Joined: Sat Jun 18, 2011 11:31 am
Location: Germany

Re: Swap issue also on Update 4 ?

Post by ZeroG »

ssolie wrote:You are likely locking all memory. When this happens the system will freeze and this is normal for the swapper and always has been that way. There is no "fix" because there is nothing he OS can do when you force this situation. Apps should avoid using shared memory because it is locked and eats up available address space.
Maybe i miss something here, but the memory used by ram-handler to store files should always be swapable, or?
Deniil
Posts: 108
Joined: Mon Jul 11, 2011 6:59 pm

Re: Swap issue also on Update 4 ?

Post by Deniil »

ssolie wrote:You are likely locking all memory. When this happens the system will freeze and this is normal for the swapper and always has been that way. There is no "fix" because there is nothing he OS can do when you force this situation. Apps should avoid using shared memory because it is locked and eats up available address space.
That's silly. When the system cannot allocate memory it should return NULL, and that's it. AmigaOS has always worked that way and all Amiga programs can handle it (except a few bad ports maybe).
Freeze!? WTF is that..?!

Just because AmigaOS suddenly has swapping, then returning NULL is not an option, but freezing the OS is the "better" way to do it, eh? :-? Come on! You can do better, I know it :-)

Btw. Why does RAM disk use shared memory, since filling it up causes this "forced" situation?
User avatar
samo79
Posts: 555
Joined: Fri Jun 17, 2011 11:13 pm
Location: Italy

Re: Swap issue also on Update 4 ?

Post by samo79 »

@denill

Just found this reply from Thomas Frieden and seems (maybe) really usefull to understand our problem:
Why MEMF_VIRTUAL ? Have you actually checked the autodocs ? If yes, where does it even mention MEMF_VIRTUAL ?

MEMF_VIRTUAL is NOT for memory allocations. Use either MEMF_SHARED or MEMF_PRIVATE. Using MEMF_VIRTUAL will make use of the default memory type MEMF_SHARED.

And there's your problem. MEMF_SHARED allocates memory that is automatically locked in memory. This can NOT be paged out. In other words, you basically fill the whole memory and lock it in place. Yes, this will lead to a lockup at one point because there simply is no way to page anything in or out if all memory ends up being locked. Linux "solves" this by killing off random processes and re-using their memory. AmigaOS does not have memory ownership, so there is NOTHING that can be done once this situation arises.
http://forum.hyperion-entertainment.biz ... =666#p8185

So in short (for what i can understand as plain user with very little tech knowledge) our problem is that RAM disk use that shared memory (MEMF_SHARED = shared memory ?) so it will no swappable at all and it will freeze instead when we try to fill the RAM disk directory ...

This until they add such "killing off random process" (Linux style)

What i don't understand is why RAM disk use this kind of shared memory if it will prevent us to swap from RAM, i think RAM should be exactly the right place when the system should swap normally, conversely i really don't understand where OS4 can swap ... infact i don't understand how all that VM thing work under AmigaOS4 :roll:

Pardon if i wrote crap, i just try to understand !
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1438
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: Swap issue also on Update 4 ?

Post by tonyw »

Yes, one of the problems is the type of storage that RAM uses (MEMF_SHARED). If it were MEMF_PRIVATE, then the memory occupied by the RAM Disk could be swapped out to allow other data into RAM. But that means a quantum change in the way that RAM has been understood in the past - for instance, what happens if you load a program into RAM, execute it from RAM, and the first thing it does is to fill the RAM disk with big photos? Can the program itself be swapped out? What happens if it is? How can you prevent it being swapped out? The program is only another file, after all.

Unfortunately, RAM's storage is only part of it. I've tried changing RAM to allocate only MEMF_PRIVATE, and it is not a cure-all, there are other effects still there, that may not be caused by the ram-handler.

As I said, a simple change won't fix the problem.
We're working on it.
cheers
tony
Locked