Jump to content
Can't remember your login details? Read more... ×
robzy

Single purpose OS

Recommended Posts

That's the thing, there won't be any integrated apps and tools. And only the absolute-minimum hardware function would be required. Unlike a modern day linux install which, even in a basic state, as at least 50 processes and a kernel full of code for all types of things.

What kind of crazy linux installs are you running? I can bootup Arch with less than 5 processes, all of them critical. It may not be terribly useful, but it's a far way from 50.

 

As for the cache, if you already have a high priority application then it's going to be making the best use of your CPU that it can, cache included.

 

Taking away the OS abstraction and placing such core functionality won't lead to any meaningful performance increase, because it will markedly similar to having the OS give the process scheduling priority.

 

If my explanation is not clear, please do let me know. I'm trying to get better at communicating what I mean.

Edited by willm

Share this post


Link to post
Share on other sites

Taking away the OS abstraction and placing such core functionality won't lead to any meaningful performance increase, because it will markedly similar to having the OS give the process scheduling priority.

This is sound in theory, but remember that even the scheduler is a process. Even the tiniest microkernel takes processing time to keep running, using up even just a little bit of the CPUs cache.

 

Not going to be anywhere near the 10% Robzy wants, but it's worth remembering that ANY code you run uses CPU time.

Share this post


Link to post
Share on other sites

What kind of crazy linux installs are you running? I can bootup Arch with less than 5 processes, all of them critical. It may not be terribly useful, but it's a far way from 50.

http://pastebin.com/f3fb5aec9

 

I'm sure that can be cut down, but even at 5, how much cache space are they taking up?

 

As for the cache, if you already have a high priority application then it's going to be making the best use of your CPU that it can, cache included.

Go on... how do you know this?

 

(I'm not saying it isn't true, it's essentially the question I'm asking, but I want to understand your answer)

 

Rob.

Share this post


Link to post
Share on other sites

This is sound in theory, but remember that even the scheduler is a process. Even the tiniest microkernel takes processing time to keep running, using up even just a little bit of the CPUs cache.

 

Not going to be anywhere near the 10% Robzy wants, but it's worth remembering that ANY code you run uses CPU time.

The scheduler is a thread within the running kernel, and not a separate process.

 

A small (semantic?) difference, but an important one. That was what I was trying to say though..., if it is a high priority process, then the overhead for the OS to treat it as such is negligible.

 

I would guess cutting that out would yield no more than a 2% increase. Of course, I'm pulling that number out of almost thin air...

 

I'm sure that can be cut down, but even at 5, how much cache space are they taking up?

I couldn't say for sure how much cache space they are taking up, but my guess is very very little. Almost all of those processes are dormant, and would not access the cache until woken. For example, the varius getty processes won't actually do anything until you attempt to login on one of the additional terminals you have setup. The HAL daemons won't do anything until hardware is inserted or removed.

 

Go on... how do you know this?

 

(I'm not saying it isn't true, it's essentially the question I'm asking, but I want to understand your answer)

 

Rob.

My answer was based on my understanding of operating systems and scheduling.

 

Basically, if a process is designated high priority, than it is treated as such. This means it gets preference to resources first and as needed without question, only competing with other processes at equally high priority. The OS will continue to run at normal priority. There may be a few things the OS will need to do stopping your application from having sole access, but many of these functions would have to be implemented in your "single purpose OS" regardless. The few that are left that you could do without would not have a noticeable impact on performance.

 

There is a good page on scheduling on Linux here if you are interested. You can skip a lot of it as it is programming orientated, but you may find a lot of it useful.

 

http://oreilly.com/catalog/linuxkernel/chapter/ch10.html

 

It's slightly out of date on a few things, such as the fact that Linux has had a preemptive kernel available for a while now, but in general it is still accurate.

 

If you have time, I would really suggest making a new runlevel which only boots some application you would like to test, and compiling a *very* minimal kernel. Then measure the performance difference between running the process as a high priority on your normal system, running it in your custom runlevel, and running it in your custom runlevel with the super minimal kernel. I think you would find the performance difference to be negligible between all three cases.

Edited by willm

Share this post


Link to post
Share on other sites

Go on... how do you know this?

 

(I'm not saying it isn't true, it's essentially the question I'm asking, but I want to understand your answer)

 

Rob.

My answer was based on my understanding of operating systems and scheduling.

But we were talking about cache, not CPU time nor scheduling.

 

 

Rob.

Edited by robzy

Share this post


Link to post
Share on other sites

Basically, if a process is designated high priority, than it is treated as such. This means it gets preference to resources first and as needed without question, only competing with other processes at equally high priority.

I think this is what Robzy is thinking. In a usual system with a multitasking OS, you always have the kernel process (or Windows calls it the System process) at a level on its own, getting time when it wants/needs it, even if another user process is at priority -20 (Linux) or 'Real time' (Windows).

 

If you took that away, and inserted your own machine code at LBA 0 that does your thing, and only your thing, theoretically it wouldn't have anything else to compete with.

 

However like you say, the performance gains probably wouldn't be noticeable.

 

If anything, it'd be an interesting exercise in programming.

Share this post


Link to post
Share on other sites

However like you say, the performance gains probably wouldn't be noticeable.

Yeah, I ran a simple test with...

 

start: nop
jmp start

And found that it was getting 99.91% of CPU time. I do wonder whether that would change when we start dealing with paging and the like.

 

The most likely avenue I can see for gain, at the moment, would be the extra cache available to the process.

 

Rob.

Edited by robzy

Share this post


Link to post
Share on other sites

However like you say, the performance gains probably wouldn't be noticeable.

Yeah, I ran a simple test with...

 

start: nop
jmp start

And found that it was getting 99.91% of CPU time. I do wonder whether that would change when we start dealing with paging and the like.

 

The most likely avenue I can see for gain, at the moment, would be the extra cache available to the process.

 

Rob.

 

no no fucking no

cache will not significantly improve the performance of that code.

 

It takes up about 5 bytes of memory and accesses then constantly.

cache contention would affect programms that frequently access an amount of memory slightly less than the total cache size

Share this post


Link to post
Share on other sites

no no fucking no

cache will not significantly improve the performance of that code.

Lol, I know I know. It was simply a test of scheduling. It confirmed that a process, if required, while get just about 100% of the CPU cycles it would've got if there wasn't an OS there.

 

Rob.

Share this post


Link to post
Share on other sites

OK soz for the conniption fit.

 

If you want to test the effect of a cache starved process, set up a program that uses 75% of available cache.

Run it once, see how much work it does.

Run 2 copies of it at the same time. Compare the total work done with the result from a single process.

Share this post


Link to post
Share on other sites

You can get a slight extra boost for SuperPi and other benchmarks.

 

Get something like PowerMenu or a generic utility that allows changing Process Priorities on the fly.

 

PowerMenu just lets you right-click a window and alter it's priority - best to not choose "Realtime" as it can cripple your system.

 

 

Of course, many benchmarks just set their own priority higher, so it doesn't work in all cases.

Share this post


Link to post
Share on other sites

As others have alluded to, it's all to do with the abstraction of the hardware layer.

 

You're either re-writing something someone's done before, or hacking it to bits. Either way, chances are you're going to get fairly minimal gains, and potentially far greater losses, (especially portability).

 

That was something that we got drummed in to us at uni. I did a single asm unit that was taught rather poorly, and every other lecturer extolled the virtues of well documented, object oriented, platform independent code, (some even tried to compare good code to art). It makes sense I guess to have these ideals; in current practice though we're all still rooted in C.

 

If that sort of things floats your boat though, (and given your penchant for asm, it probably does), then it might be fun to play around with.

Share this post


Link to post
Share on other sites

You're either re-writing something someone's done before, or hacking it to bits. Either way, chances are you're going to get fairly minimal gains, and potentially far greater losses, (especially portability).

I don't think I'm explaining myself properly, because it's no a re-write of anything, it's an entirely different paradigm than (afaik) any other OS.

 

If you told a Unix or Microsoft programmer that you want an OS without page faults, cache misses, or expensive interrupts they'd be aghast in horror.

 

I'm not saying that there definitely would be performance benefits, only that it's incorrect to say that there wouldn't be because it's "something someone's done before."

 

 

[edit]: Oh, and as for my penchant for asm, it's just because it happens to be the best tool for the things I've been working on recently :P I think that C is where I'd rather be.

 

 

Rob.

Edited by robzy

Share this post


Link to post
Share on other sites

I'm not saying that there definitely would be performance benefits, only that it's incorrect to say that there wouldn't be because it's "something someone's done before."

That's exactly why we know there are not performance benefits to what you describe. Because there are plenty examples of it being tried before.

Share this post


Link to post
Share on other sites

I'm not saying that there definitely would be performance benefits, only that it's incorrect to say that there wouldn't be because it's "something someone's done before."

That's exactly why we know there are not performance benefits to what you describe. Because there are plenty examples of it being tried before.

 

Name one...

 

Rob.

Share this post


Link to post
Share on other sites

Name one...

 

Rob.

Haven't people already done so in this thread? Why do you think badly reinventing the wheel is (possibly) a good thing?

 

As people have told you, it comes down to removing the abstraction. Replacing system calls with function calls isn't going to give the performance boost you seem to think exists.

 

In fact, I would think a dedicated application would perform better making use of a modern operating systems functionality(since it will make far better use of modern hardware than your standalone application would) than it would if you wrote it from scratch to be OS independent.

 

If you want to understand why your initial reasoning isn't sound, I would suggest reading up on operating system architecture. In which case, I highly recommend Modern Operating Systems by Tauenbaum..

Share this post


Link to post
Share on other sites

Name one...

Haven't people already done so in this thread?
Name one...

 

[edit]: Oh, and for the record, I almost find it laughable how little you seem to comprehend what I'm suggesting in terms of a "single purpose OS" :P You wouldn't happen to have been Meeko in a past life, would you?

 

[edit2]: Or... TheSecret?

 

Rob.

Edited by robzy

Share this post


Link to post
Share on other sites

Name one...

Haven't people already done so in this thread?
Name one...

 

Rob.

 

Haven't people already done so in this thread?

 

By the way, nice way to disregard my reply.

Edited by willm

Share this post


Link to post
Share on other sites

Name one...

Haven't people already done so in this thread?
Name one...

 

Rob.

 

Haven't people already done so in this thread?
Nope. Name one...

 

Rob.

Share this post


Link to post
Share on other sites

Nope. Name one...

 

Rob.

Quite a few people already mentioned memtest86.

 

I repeat, you should probably do some reading before dismissing the way things are done and thinking you can do it better.

Edited by willm

Share this post


Link to post
Share on other sites

Nope. Name one...

 

Rob.

Quite a few people already mentioned memtest86.

Lol, your kind of lacking in the higher level processing department tonight.

 

Those who wrote memtest86 likely came at it from a similar angle than I am here. They went and wrote a single purpose OS.

 

Essentially what I'm suggesting is a framework (or library, if you will) that would benefit other people wanting to write a single purpose OS in order to do away with the inefficiencies of the multitasking OS and possibly reap some performance benefit.

 

 

That's exactly why we know there are not performance benefits to what you describe. Because there are plenty examples of it being tried before.

Name one...
So that's a pretty shoddy example of it being tried before with no performance benefits :P

 

Rob.

Share this post


Link to post
Share on other sites

Those who wrote memtest86 likely came at it from a similar angle than I am here. They went and wrote a single purpose OS.

nitpicking, but can we stop using the term single purpose OS? It implies an Operating system with a single purpose, rather than a low level application with basic OS functionality. Is that not what you are meaning?

 

Essentially what I'm suggesting is a framework (or library, if you will) that would benefit other people wanting to write a single purpose OS in order to do away with the inefficiencies of the multitasking OS and possibly reap some performance benefit.

OK.

 

Stuff like this has certainly been done.

 

The research area is "dedicated operating systems", and I seem to recall FLuxOS or similar.

 

I will try and find the paper/site for you.

 

So that's a pretty shoddy example of it being tried before with no performance benefits :P

For what you mean? Agreed :)

 

edit: Here you go, OSKit. http://www.cs.utah.edu/flux/oskit/

 

Is this what you meant?

 

The abstract from the paper:

 

To an unappreciated degree, research both in operating systems and their programming languages has been severely hampered by the lack of cleanly reusable code providing grungy OS infrastructure such as bootstrap code and device drivers. The Flux OS Toolkit solves this problem by providing a set of clean, well-documented, shrink-wrapped components. These components can be used as basic building blocks both for operating systems and for booting language runtime systems directly on the hardware. The toolkit's design allows it to itself reuse device drivers, unchanged, from other sources. We believe the kit also makes feasible the production of highly assured embedded and operating systems: by enabling reuse of low-level code, the high cost of detailed verification of that code can be amortized over many systems for critical environments. The OS toolkit is already heavily used in several different OS and programming language projects, and will catalyze research and development that would otherwise never have been attempted.

If this is what you mean, then there still will not be performance advantages. The advantages and reasons for making use of the kit would be more to do with re-usability, scalability, flexibility, maintainability etc...

Edited by willm

Share this post


Link to post
Share on other sites

edit: Here you go, OSKit. http://www.cs.utah.edu/flux/oskit/

 

Is this what you meant?

Nope, not at all.

 

Thankfuly others in this thread have well and truly understood me, and we've had quite a good discussion about it benefiting from their valuable input.

 

Rob.

Share this post


Link to post
Share on other sites

I was thinking, what if the operating system was more of a library, rather than a separate process, and it was used to support a single application/process and make it as fast as possible.

Essentially what I'm suggesting is a framework (or library, if you will) that would benefit other people wanting to write a single purpose OS

How is the Flux OSKit not what you have described?

 

You appear to be coming across as quite arrogant. Why not clarify what you mean if it is not clear to some, instead of just dismissing peoples input?

 

edit: I'm not a programmer,however I have a good understanding of operating systems and their internals as it was a subject of great interest to me for many years. If what you are describing is out of the scope of my knowledge, why not explain it more thoroughly? That may benefit other people as well.

Edited by willm

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×