mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Reword design section
This commit is contained in:
@@ -41,10 +41,12 @@ Apart from correctness, there are many secondary design goals. For example, it s
|
|||||||
[fragmentation]: https://en.wikipedia.org/wiki/Fragmentation_(computing)
|
[fragmentation]: https://en.wikipedia.org/wiki/Fragmentation_(computing)
|
||||||
[false sharing]: http://mechanical-sympathy.blogspot.de/2011/07/false-sharing.html
|
[false sharing]: http://mechanical-sympathy.blogspot.de/2011/07/false-sharing.html
|
||||||
|
|
||||||
These requirements can make good allocators very complex. For example, [jemalloc] has over 30.000 lines of code. This complexity often undesired in kernel code where a single bug can lead to severe security vulnerabilities. Fortunately, the allocation patterns of kernel code are often much simpler compared to userspace code, so that relatively simple allocator design often suffice. In the following we explain three possible kernel allocator designs and explain their advantages and drawbacks.
|
These requirements can make good allocators very complex. For example, [jemalloc] has over 30.000 lines of code. This complexity often undesired in kernel code where a single bug can lead to severe security vulnerabilities. Fortunately, the allocation patterns of kernel code are often much simpler compared to userspace code, so that relatively simple allocator designs often suffice.
|
||||||
|
|
||||||
[jemalloc]: http://jemalloc.net/
|
[jemalloc]: http://jemalloc.net/
|
||||||
|
|
||||||
|
In the following we present three possible kernel allocator designs and explain their advantages and drawbacks.
|
||||||
|
|
||||||
## Bump Allocator
|
## Bump Allocator
|
||||||
|
|
||||||
The most simple allocator design is a _bump allocator_. It allocates memory linearly and only keeps track of the number of allocated bytes and the number of allocations. It is only useful in very specific use cases because it has a severe limitation: it can only free all memory at once.
|
The most simple allocator design is a _bump allocator_. It allocates memory linearly and only keeps track of the number of allocated bytes and the number of allocations. It is only useful in very specific use cases because it has a severe limitation: it can only free all memory at once.
|
||||||
|
|||||||
Reference in New Issue
Block a user