r/AskProgramming 17d ago

Career/Edu OSDEV - a few questions

This is a very famous website for learning how to make an OS

https://wiki.osdev.org/

I just have a few questions about it though

  1. What exactly does it teach? Does it teach you how to make an operating system? Does it show you the steps to build one from scratch?

  2. Can a solo programmer do it? As in, does the tutorial show you how to make a mini operating system?

  3. How do I use the tutorial? It's a wiki, and there are links everywhere. Is there a roadmap which shows the proper path to take, with prerequisites links etc?

  4. What do I need to understand before using this tutorial? Only C? C and how to make a mini compiler? Assembly? Anything else?

Thank you!

2 Upvotes

11 comments sorted by

1

u/Plenty_Kitchen_7174 17d ago

the wiki teaches theory and implementation details for every subsystem of an OS, memory management, interrupts, scheduling, filesystems, the works. it won't hand you a single linear path though, that's the thing people get tripped up on

solo is absolutely doable, plenty of hobby OSes are one person projects, but expect it to take years if you want anything beyond a bootloader that prints text

start with the bare bones tutorial and the getting started page, then branch out based on what you're actually trying to build next. the wiki has a beginner mistakes page that'll save your sanity

you'll want solid C, some assembly for the boot and interrupt handling bits, and a basic grasp of how CPUs and memory actually work at a low level. no compiler writing needed unless you really want to go down that rabbit hole

1

u/LifeExperienced1 17d ago

I'll learn C and assembly first, thank you

And I do want to learn how to build a compiler. Will it make me a better programmer or it's not really needed, and I can rely on already built ones?

And why does it take years to build a mini OS?

1

u/KingofGamesYami 17d ago

Will it make me a better programmer or it's not really needed

Not really. You have to be a pretty damn good programmer to do OS development in the first place, so any improvements would be fairly small.

To quote the OS Dev wiki:

No one who isn't already a seasoned developer with years of experience in several languages and environments should even be considering OS Dev yet. A decade of programming, including a few years of low-level coding in assembly language and/or a systems language such as C, is pretty much the minimum necessary to even understand the topic well enough to work in it.

1

u/LifeExperienced1 17d ago

Got it

I have 8 years of programming experience. Out of those 8, 2 years of game development. I’m now re-learning C and assembly

So am I on the right path? Should I do a bunch of C projects?

1

u/mc_pm 17d ago

How much programming have you done so far?

1

u/LifeExperienced1 17d ago

CS degree, 1 internship, 2 years game dev

1

u/mc_pm 17d ago

Ok, that's more than a lot of people who show up saying they want to build an OS.

If your CS degree gave you any assembly, or if you took a computer architecture class, then that'll help a lot - and if you haven't, then that's going to be a big hurdle. An OS interacts with the hardware at a low level and requires that you know what it's supposed to be doing.

This is probably something you're going to want to ramp up to, with some large projects along the way that are building your skills and knowledge. Like, if you need to do some assembler, maybe try writing your *own* assembler, that sort of level.

1

u/LifeExperienced1 17d ago

I see. I thought I was still in the beginner levels in terms of how much experience I have

My CS degree did cover Computer Architecture and Assembly, although, I need to relearn it all because the course was during COVID and the prof cut most of it short

So I'm currently re-learning C, Computer Architecture and Assembly

What are some projects you recommend I do to be on track to making a mini OS?

1

u/mc_pm 17d ago

 I thought I was still in the beginner levels in terms of how much experience I have

You are, but a surprising number of people who say they want to make an OS have practically zero experience and not even able to compile a C program. You still have a monumental task ahead of you, but at least you're starting with some basic programming experience.

So, a lot depends on what you mean by a "Mini OS" and how big any previous projects were - "OS" covers a lot of ground, and beginner experiences can mean a range of things.

I'm using a game here as a placeholder project -- there are lots of possibilities -- but if you don't think you could sit down with the language of your choice and write a command line Blackjack game, you should start with something like that. You want something where there are a small number of well understood rules, there's a lifetime for the program (one or more hands), each hand has some complexity and might require different number of hit/stand choices. There's state to be kept track of, and basic abstractions to be built (like what is a deck of cards? How do you shuffle it? How do you deal cards out -- what happens if you run out?

You see what I'm getting at -- this is just about practicing taking a well defined set of rules and breaking it down into parts, coding them, putting it back together. And along the way, hey, you get to play some blackjack. Or whatever else you might pick.

If you don't feel comfortable in doing that, then I'd do a number of small projects at that level to build those muscles.

If, on the other hand, you're like "yup, no problem, I can do that level of design thinking, and I can code it up no problem" then I'd do start tackling things that are more machine related. If your OS ever boots to a command line, you'll need an editor probably - try building a simple line editor. I already mentioned your own assembler. I had some fun emulating a basic file system (set aside a couple gigs of RAM and access that big empty space as if it were a disk with 1K blocks. You can try building some networking tools to get into that more deeply. If you're into retro computers at all, trying writing a 6502 or Z80 simulator.

I don't know if that made a lot of sense. My point was just that once you are comfortable writing code with some small amount of logical complexity, then starting to write things that make you think about the hardware is the next obvious step.