flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Performance benefits of a custom OS

Author
Thread Post new topic Reply to topic
coen



Joined: 13 Oct 2015
Posts: 14
coen 16 Oct 2015, 12:28
Due to a strange performance issue I had recently I started thinking about the idea of building a custom OS and what kind of performance improvement would be possible over Linux or Windows. The reason would be to eliminate any kind over overhead that any of the existing operating systems have.

The OS/application would only have to do the following task (all in memory):

- Poll a server for files (every X seconds)
- Analyze file
- Push result back to server
- Repeat

By building an OS as simple as this you wouldn't need a scheduler to divide the CPU time over any other processes therefore eliminating the overhead of context switches. Also I imagine that memory access could be much faster because no protection is needed to prevent processes of reading each other's memory.

Does anyone have any experience building such an OS that only runs a single application and what the performance benefits are approximately?
Post 16 Oct 2015, 12:28
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 16 Oct 2015, 13:51
I have done this a few times. It is easy to code and maintain. But please don't be driven to do this by the desire to have everything run "faster". The overhead of context switching is very minor, to almost negligible, in most well written OS kernels. Only for very fast switching regimes and/or very slow CPU/memory systems would you really start to see a significant difference.

BTW: the memory protection mechanisms are not a source of congestion in any modern CPU you can buy today. It is just not an issue at all, the overhead is literally zero. More likely, although still very minor, is the overhead from paging. It is possible to have really bad memory access patterns that manage to completely miss the TLBs and create awful delays.
Post 16 Oct 2015, 13:51
View user's profile Send private message Visit poster's website Reply with quote
coen



Joined: 13 Oct 2015
Posts: 14
coen 16 Oct 2015, 14:38
If not for performance what were your reasons to take this approach?
Post 16 Oct 2015, 14:38
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 16 Oct 2015, 14:57
There are many reasons to have simple noOS dedicated systems. For example: Instant start-up, run from ROM, constrained system, no UI, resistance to hacking, verifiability by customers, provable reliability, etc.

But to gain what is probably ~0.5% improvement in speed (if it is even that high) it would be easier to raise the clock by 0.5% and keep all the advantages of a full OS. And in practicality if your system is so sensitive to 0.5% speed differences then perhaps you should instead invest in a second system to take up the slack if the first system ever goes down.
Post 16 Oct 2015, 14:57
View user's profile Send private message Visit poster's website Reply with quote
coen



Joined: 13 Oct 2015
Posts: 14
coen 16 Oct 2015, 17:41
Thanks for your response, those are all good reasons, but not for me in this case Smile

I must admit that I was kind of expecting (and hoping) for bigger performance bump than 0,5%.. I never would have tought that these huge operating systems had that little overhead.
Post 16 Oct 2015, 17:41
View user's profile Send private message Reply with quote
Trinitek



Joined: 06 Nov 2011
Posts: 257
Trinitek 16 Oct 2015, 18:37
In Windows 10, the task manager shows the CPU usage percentages for all of the system services running in the background, including the interrupt handler and other low-level things. Most of those are typically at 0.0% usage on my system. So yeah, there isn't much overhead.
Post 16 Oct 2015, 18:37
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.