--
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/e09c1116-2289-4a20-8959-ff3760de46e6n%40googlegroups.com.
Second, even "normal" `Grant`s are lazily allocated the first time they are accessed. This is important because most applications will use only a small fraction of the available capsules on a board, and thus a small fraction of the total grants. Reserving memory for every process to use every grant would probably exhaust all RAM on most Tock chips if more than a few processes were loaded. But only an application can know at loading time how many capsules it will interface with (at least unless we change tbfheader to require all apps to specify a list of driver numbers), so the application is responsible for requesting enough memory for these grants as well.
I think it is correct that the kernel app break may be lowered until it overlaps with the app break. So it is perhaps correct to consider KERNEL_HEAP_SIZE as only a hint -- the only guarantee is that the app will get at least APP_MEMORY + KERNEL_HEAP_SIZE bytes of RAM for combined use by the application and kernel. But if an app allocates more than APP_MEMORY bytes, it is possible that the kernel would then be unable to allocate KERNEL_HEAP_SIZE bytes afterward.
Ah, DynamicGrant is the name for the fixed version which has not yet been merged. But even without that PR, the way dynamic allocation works is that `Grant::enter()` takes a parameter of type `F: FnOnce(&mut Borrowed<T>, &mut Allocator) -> R,`, and then supplies an allocator to that function. If a capsule wants to dynamically allocate memory based on a process' request, it can use the allocator struct passed to that function to do so. No capsules actually do this today so I can't point you to an example.
Hudson
From: Alexandru Radovici <msg4...@gmail.com>
Sent: Thursday, January 7, 2021 10:36 AM
To: Brad Campbell <bra...@gmail.com>
Cc: Hudson Randal Ayers <hay...@stanford.edu>; Tock Embedded OS Development Discussion <tock...@googlegroups.com>
Subject: Re: [tock-dev] Using graphics for a book and teaching materials
Hi Hudson, Brad,
Thank you for your answers, it is clear now. Correct me if I am wrong, but the KERNEL_HEAP_SIZE is still only a hint, as I don't see any limit for grant allocation within the kernel. As long as it does not overlap with the app break, the kernel app break may be lowered.
I have another question regarding the Dynamic Grants. I was the two PRs with it, but I cannot find anything in the kernel. There does not seem to be this option in grant.rs. Am I looking in the wrong place?
Thank you,Alexandru
Alexandru,
I'd love to take a look and offer feedback.
-Amit
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/CAHGAQozDzu385-%2BcJ0z7CXKqiWxT6gnFoOPTE1Ndt1-gCL7C3g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/f6875d31-1372-a8c9-3428-f2ec508b31e3%40amitlevy.com.