4 ms·
Alloca is allocations on the stack, seems the kernel might be stack based, but the os itself has it's own implementation of malloc. Which is heap based. https:/
by Cieric 2y ago
Alloca is allocations on the stack, seems the kernel might be stack based, but the os itself has it's own implementation of malloc. Which is heap based.
https://github.com/google/pebble/blob/main/src/libos/include/os/malloc.h https://github.com/google/pebble/blob/main/src/libos/include...
I'm also seeing references to rtos as the true underlying os though.
- markus_zhang 2y agoThanks found it, https://github.com/google/pebble/blob/main/src/fw/kernel/pbl_malloc.c#L228 https://github.com/google/pebble/blob/main/src/fw/kernel/pbl... Which calls heap malloc: https://github.com/google/pebble/blob/main/src/libutil/heap.c#L236 https://github.com/google/pebble/blob/main/src/libutil/heap....
- tesseract 2y agoIt was based on FreeRTOS, but FreeRTOS at the time was extremely bare bones and only provided a preemptive scheduler, task management, and synchronization primitives. Everything else (memory management, I/O, ...) had to come either from whatever libc implementation was in use, or be built from scratch.
- markus_zhang 2y agoThanks, does that mean early FreeRTOS is a good beginner project for OS study?
- tesseract 2y agoIn my opinion it's not always the most readable codebase, due to some idiosyncratic style choices, but it definitely has the advantages of being small and focused.
- markus_zhang 2y agoThank you!