News for hackers. Stuff that matters.
Re:BareMetal OS by Koshkin on Tuesday December 10, 2024 @09:03AM (#42376901)
A low-overhead environment like this must be perfect for HPC applications, i.e., when you want to use a computer in its primary function (to perform calculations, as fast as possible).
Re:BareMetal OS by miohtama on Tuesday December 10, 2024 @09:13AM (#42376989)
This is a really interesting approach. What are the main bottlenecks something like BaremetalOS solves? Context switches? Copying data forth and back userland? Something else?
Re:BareMetal OS by actionfromafar on Tuesday December 10, 2024 @09:37AM (#42377191)
Extreme real-time control with total control over jitter etc. Not only fast response time but predictable.
Re:BareMetal OS by megiddo on Tuesday December 10, 2024 @11:58AM (#42378648)
Control over jitter would be less ideal for very tight deadlines due to branch prediction, cache misses, instruction counting, etc.
Re:BareMetal OS by actionfromafar on Wednesday December 11, 2024 @06:38AM (#42386814)
Yes?
Re:BareMetal OS by ianseyler on Tuesday December 10, 2024 @10:29AM (#42377740)
Correct. BareMetal (the kernel) doesn't have context switching or userland. Think of the kernel as just a hardware abstraction layer.
Re:BareMetal OS by AnotherGoodName on Tuesday December 10, 2024 @12:50PM (#42379221)
I bet it doesn’t do that well.

Here’s an example. I have a program that does a lot of memory allocation and reallocation. The memory management strategies in modern OS’s work wonders on this, better than a custom allocator I can write in a reasonable amount of time. In bare metal os I would lose this all for the advantage of not loading an os that tends to stay out of the way unless needed anyway.

Where I see use for this is more likely in situations where time to boot is critical but actual resource requirements minimal. Things like a simple kiosk system or embedded hardware.

Re:BareMetal OS by vdupras on Tuesday December 10, 2024 @01:06PM (#42379424)
> Here’s an example. I have a program that does a lot of memory allocation and reallocation.

It's likely that if memory allocation overhead is part of your bottleneck, that using malloc() is actually a bad idea. Other management strategies such as arenas or rolling buffer will likely perform better. They're also trivial to implement ad-hoc.

Of course, you might arrive at the conclusion that the complexity overhead of custom allocation strategies[1] might not be worth it, but in this case, it means speed is not really an issue.

[1]: as well as, maybe, the necessary redesign of the application to fit those allocation strategies more elegantly.

Re:BareMetal OS by AnotherGoodName on Tuesday December 10, 2024 @01:14PM (#42379523)
Fun fact I literally implemented a memory pool since most of the allocs were on the same sized structs and did worse than the os allocator.
Re:BareMetal OS by vdupras on Tuesday December 10, 2024 @01:23PM (#42379631)
That's possible. Maybe that such OS "unfairly" stacks custom options against its malloc implementation.

But I wouldn't be so sure to claim that such a pool, implemented in assembler on an OS that leaves everything to you, wouldn't outperform the os allocator you refer to. After all, there is fundamentally less information to manage.

Re:BareMetal OS by Koshkin on Tuesday December 10, 2024 @01:35PM (#42379798)
Then maybe a unikernel such as Nanos would work better for your use case.

https://nanos.org/