MorphOS Developer
Posts: 626 from 2003/2/24
From: finland, the l...
Quote:
Georg wrote:
1) What I meant was a normal global memory pool, not per task. Sem protected either automatically (MEMF_SEM_PROTECTED) or manually.
Semaphore protected memory pools have no meaning under MorphOS, except the automatic alloc tracking and easy deletion of all pool memory. Other than that it's just slower than regular memory allocations. See below.
Quote:
And the optimization being about less memory fragmentation
I'd argue that the reason exec memory pools were added in the first place was due to the standard AmigaOS "First Fit" allocator being so awfully slow when fragmentation got high. They weren't added to try fix the cause but the mitigate the effect. Of course the official story was that they were added to fix the fragmentation problem (but they really don't do that, not really).
Hence in most cases switching anything to use memory pools from regular memory allocations is just a mitigation to the horrible AmigaOS "first fit" allocator. In MorphOS context it makes no sense (unless if you
also want the automatic tracking for some reason).
In fact, memory pools as they were originally implemented would have actually slowed down the system massively when I implemented TLSF allocator. So I just ripped the old implementation out and made it pretty much just a AllocMem() + AddHead() for AllocPooled() and have a list in the pool header for the allocations. FreePooled() is just Remove() + FreeMem(). Allocate() and Deallocate() are never used. The Allocate() and Deallocate() functions are there and fully functional for anyone insane enough to call them, of course, but internally MorphOS doesn't use them at all.
In fact, in the MorphOS memory pool implementation MEMF_SEM_PROTECTED
only protects the AddHead() and Remove() calls, which are super fast in themselves, anyway. So in practice under MorphOS there's actually small performance
penalty from using MEMF_SEM_PROTECTED memory pools. It is a small one and something you might want to pay to get the automatic tracking and free at DeletePool().
Quote:
at least with standard old style Amiga memory allocation which MorphOS still allows to use with some boot option to override the otherwise better newer TLSF thing, right?
No-one does that. The only reason you'd ever have for using them is going away, too, with built-in wipeout kind of memory corruption tracking coming to MorphOS 3.16 (permmemtrack boot option, which earlier only worked with the old-style memory allocator).
Anyway, long story short: MorphOS is not going to swich to MEMF_SEM_PROTECTED memory pools internally. It doesn't make any sense.
This is getting a bit off-topic for "errno", I fear.

[ Edited by Piru 04.01.2021 - 17:18 ]