General Question

PhiNotPi's avatar

How would one design a minimalistic operating system?

Asked by PhiNotPi (12681points) April 24th, 2012

At one point last year, I was trying to design a minimalisic computer processor. Now, I’m trying to figure out how a simple operating system might work.

Before I get too far into the details, I am going to point out that this is more of a theoretical exercise than anything else. I really don’t envision myself implementing an OS, but I want to learn the nuts-and-bolts of how one might work, and maybe even lay down the blueprints for one.

So far, the information I have found applies mainly to modern operating systems, such as Windows 7 and Mac OS X. These operating systems have complicated GUIs, multi-user capabilities, complex memory management, and internet connections, etc. This is way more complicated than I need.

I want to learn how the real basis of an operating system works. This includes how to keep track of which programs are running, how to allow different programs temporary access the CPU, and how to keep track of what memory locations the programs are allowed to use.

Since this is a theoretical exercise, I am looking for very detailed explanation, but not to the point of “this is the code to do it on a __ processor”.

Observing members: 0 Composing members: 0

13 Answers

dabbler's avatar

It sounds like you have decided it will be able to run multiple programs at a time which is a step up from minimalist. The smallest OS around are not a lot more than flexible state machines for one purpose. If that sounds interesting look for information about Real-Time-OperatingSystems RTOS for machine control. Some of those have just the basics.

You could learn a lot by getting into the design of the linux kernel. At its heart it is simple but elegantly extensible. There are lots of good books around and probably tons of info I haven’t seen yet on the internet about linux. On top of that it’s free so you can get one of several variations and see what’s under the hood. Puppy Linux is genuinely small but still very capable.

If you are really going to design an OS from the ground up you have a lot of decisions to make. What kind of job scheduling will you deploy, what is the nature of your memory system (will you have virtual memory?), what kind of I/O will you want to accomodate, what sort of file system do you need/want…

smilepiper's avatar

I would got to dotdeb.com or any other gaming site and see about downloading a game called Linux Tycoon. In this game you build your own operating system. Again it’s just a game, but I bet it could be real educational and though I haven’t played it myself, I think it might be exactly what you need to get started. i read someplace that it’s only $10 bucks.

jerv's avatar

Which programs?! That ability does take it beyond “minimalist”, even if the other user(s) is/are the computer itself.

Still, I concur that studying Linux will be educational. I’m not talking the fancy GNOME or KDE desktops, but the basic underlying OS. Yes, it’s multi-user, but multiple tasks are multiple tasks regardless of how many or how few users there are.

majorrich's avatar

Wasn’t that what the RISC was all about?

dabbler's avatar

@majorrich No, RISC was a way to increase CPU clock rate by simplifying the instruction set of the CPU itself. RISC had no particular affect on Operating Systems except at their lowest levels where code optimization was done differently to accomodate RISC’s distinct advantages and disadvantages.
That is, RISC is not an operating system technology.

gasman's avatar

From a historical perspective, take a look at CP/M, the first industry-standard OS for home computers based on the S-100 bus. It ran on my IMSAI 8080 computer, which I soldered together from a kit in 1977 (it was the computer featured in the movie War Games), though mine originally ran North Star disk operating system, which supported hard-sectored floppy drives.

I remember that the North Star OS had simple commands to list, copy, delete, etc. files on the floppies. You could permanently delete an important file by accidentally mis-typing a two-letter command. There was no “Are you sure?” verification step.

jaytkay's avatar

A couple of Wikipedia articles which might help:

Embedded systems

And this one is awe-inspiring, the Apollo Guidance Computer which had 2k of RAM and 32k of read-only storage.

ratboy's avatar

Not exactly what you’re asking for, but maybe of interest: Apollo and Gemini Computing Systems.

LostInParadise's avatar

I think you could get by with a system that runs multiple tasks. You could then layer that core with additional capabilities, like a friendly user interface. If you want to get sophisticated, you could use time slicing. Otherwise you could just have built-in I/O calls which suspend tasks until an event is received indicating I/O completion.

jerv's avatar

@LostInParadise Thing is, that leads to COU hogging as the OS will get so stuck on one task that out won’t even register an interrupt and thus will freeze often. You really want to have some way of stopping a process that doesn’t involve hard-cycling the machine.

gasman's avatar

Since my knowledge of microprocessor hardware design is stuck in the 1980s, can you guys answer a possibly naive question? In the early 8 and 16-bit days they could protect systems using hardware-based mechanisms like watch-dog timers and non-maskable interrupts. Supposedly these would regain system control in case the (single-core) CPU went to la-la land. So how come by now they still haven’t eliminated OS hangs? Or have I wandered too far off-topic…?

jerv's avatar

@gasman Lets just say that some OSs have more of an issue with them than others, and that the most egregiously bad one is also the most popular ;)

gasman's avatar

@jerv lol, thanks

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther