-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is malloc configuration and memory reservation needed when paired with a non-constant time memory allocator? #9
Comments
@shuhaowu I think it's still needed to avoid page faults. Note with the
I can create a PR for |
Thanks for the detailed response. I agree that I'm more worried about telling people to reserve memory and configure malloc to not use mmap and give memory back to the system on If someone can write a RT program that has all heap memory already allocated before entering the RT sections, then it seems to me that reserving memory and configuring malloc is just extra steps that would not be helpful. That said, I suppose it's not harmful either. Having a separate example might be OK, but I fear that having the memory locking example also reserve memory and configure malloc in addition to Footnotes
|
My understanding is that the glibc allocator is not a constant time allocator. In this case, any
malloc
call could take a large amount of time either because:brk
/sbrk
/mmap
.In the examples for this repo, we configure malloc such that it doesn't give back memory upon
free
and do not usemmap
(sofree
won't immediatelymunmap
it). Is this needed? It doesn't really address the second problem if one chooses tomalloc
during the RT sections of the code.Further, we also show reserving some heap memory, which when coupled with the above malloc configuration, effectively means we reserve a (large) amount of heap space that is monotonically increasing. However, since the allocator is not constant time, there appears to be no guarantee of anything.
So the questions are:
This is not that big of a deal, what we're doing here doesn't hurt. It might "help" lower latency in the average case (if you use malloc during RT), although likely it does make the worst case latency harder to detect (as you have to trigger the O(N) behavior from the allocator to a point where you overrun your deadline).
cc: @carlossvg
The text was updated successfully, but these errors were encountered: