Slashdot Mirror


Building Your Own Operating System?

sonictooth asks: "I have dreams of writing a toy operating system, as I know some people have already done in college. Unfortunately, I don't have that opportunity. I was wondering what books (as there are so many) and methods people [have used], either in college or on their own. Amazon is littered with books from varying authors, Tanenbaum in particular, and there are both positive and negative reviews of his books. Does anyone recommend a simple book to walk you through the early stages, and then explain the more complex theories later on."

4 of 102 comments (clear)

  1. Don't do it for Intel by Dimwit · · Score: 4, Insightful

    Don't really do it for any modern architecture. Visit 6502.org and look at the sample operating systems they have there.

    Why? Because on your first (and second, and third, and forth...) you're not going to want to learn all about the inner workings of the Intel architecture. Segmented memory. *shudder*

    The 6502 is still small enough that you can wrap your head around it easily. 6502 emulators are plentiful. An operating system for a 6502-based machine would be small and simple, but still a useful tool.

    Once you get your head around that, then try the 6510 - same instruction set, but up to 16MB of memory.

    Finally, when you feel good with all that, try Intel, or Sparc, or PPC. My personal favorite processor to code for (assembly-language speaking) is Motorola's 68k.

    --
    ...but it's being eaten...by some...Linux or something...
    1. Re:Don't do it for Intel by squiggleslash · · Score: 3, Insightful
      Erm. You don't want the guy to learn about segmented memory so you recommend the 6502?!

      I would suggest the Z80, or if he wants to get exotic, the 6809. The 6502 is a horrible chip when it comes to memory - divides the entire map into 256 byte "pages". *shudder*

      There are plenty of older Z80 based machines, and it has proper, consistant, 16 bit addressing throughout. A much more pleasurable experience.

      --
      You are not alone. This is not normal. None of this is normal.
    2. Re:Don't do it for Intel by Gadzinka · · Score: 2, Insightful

      Why? Because on your first (and second, and third, and forth...) you're not going to want to learn all about the inner workings of the Intel architecture. Segmented memory. *shudder*

      Where have you been hiding for the last decade?
      Segmented memory is the thing of the past, deeply hidden inside real mode. since the times of 386 x86 architecture can use flat memory model (up to 4GB of course) if programmer chooses to. The memory mapping, pages are used for memory virtualization, they are not mandatory.

      Programming in asm for x86 is still PITA (unlike georgous m68k) due to limited number of (non)General Purpose registers, but you only write a handful of routines in asm, the rest is usually C or other higher (than asm) language.

      If I were to write OS from scratch, I would love to do it on m68k, or PPC. If only x86 weren't so indecently fast and cheap...

      Once you get your head around that, then try the 6510 - same instruction set, but up to 16MB of memory.

      Don't you mean 65816? 6510 is just 6502 with additional i/o register for memory banking etc. In c64 it was also used for driving tape i/o.

      But I admit, 6502 is cute little processor for fun programming. Only it doesn't give you any useful skills for _real_ OS design: no MMU, memory protection etc, things that are mandatory today even in embedded architectures.

      Robert

      PS You could even buy 65816 computer today in lovely ATX form factor, IDE disk interfaces and lots of other goodies, if you wanted to write os for this.

      --
      Bastard Operator From 193.219.28.162
  2. Do something new! by Walles · · Score: 4, Insightful
    Write it in an interpreted language. Have the interpreter run itself. I'm dead serious.

    The benefits would be that porting the OS and all programs running on it to a new platform would consist of porting the virtual machine only.

    Also, all code would be bounds-checked and stack-overflow protected, so a lot of today's security holes wouldn't be possible to create. With garbage collection, memory leaks would be a minor problem as well.

    To get a lot for free, you could base it on IBM's JRVM, a virtual machine for Java, written in Java.

    The drawback of not allowing C code to run natively is that there's a lot of software out there that'll be hard to support. This may be solvable, but I haven't given any thought to it so I don't know.

    --
    Installed the Bubblemon yet?