How would you go about creating an OS?

Hi everyone,

So I’ve recently been interested in learning to create my own OS, not a Linux distro or something of the sort, I mean completely from scratch.

There are some YouTube tutorials and such that go over these sorts of things, but they either use a bunch of libraries and other stuff you probably don’t need, (because how did people create their own OS if these things didn’t exist during their time?), they don’t go over how to do any of the things suggested in their videos, or are a complete line for line copy and paste tutorial.

I preferably want some instruction on how to do something of the sort, and wiki.osdev.org has some good articles that don’t support line-for-line copy/paste and go pretty in-depth on complex topics, but I want to hear from someone that has done this sort of thing before and can provide a good starting foundation and can explain to me some key features of an OS, (ex Kernel and stuff), and a summary of what exactly an OS is, in some more high-level context that a beginner can more-less understand.


Part 1

What kind of experience do you need to have? I’ve read that you have to have an extremely good understanding of computer science concepts and low-level languages, with years of experience, but I’ve also seen people that have just started creating some pretty cool stuff with nowhere near as much experience as people say you need.

What languages or programs would you need to use? Is extensive knowledge of C or C++ required, and how much Assembly would be used, if it would even be used? I would prefer to install and use the least amount of stuff possible, like possibly skipping out on something like QEMU and booting from the BIOS, and only having to use VSCode and WSL if needed, (this is from a Windows 11 standpoint). And this is likely impossible, but would this sort of thing be possible from Replit itself, or at least being able to test/experiment with certain parts of the OS?


Part 2


Once an OS has reached a good point for releasing it to the public, how would you release it, and provide bootable downloads, (ex: ISO image or something), for users to test? Is there any additional information or other stuff you would need to provide?

How would you go about creating some graphical interface, using as few libraries and external scripts as possible, and then implementing it into the OS, and providing good interactivity and ease of use?

Then, how would you provide support for some major programs and filetypes, without just adopting their own filetypes or using programs that automatically can understand such things? Would you have to convert from EXE until they were to provide a download for your OS at the start? If so, how would you even go about doing such a thing?


I would probably have posted this somewhere else, but I find Replit Ask to be one of the more supportive communities for asking questions. I would appreciate any help, even if you can only provide a single or fraction of an answer.

Thank you!

4 Likes

Most major OSes come in iso (aka an image of an OS on a storage medium such as an SSD) installable images of an install utility, or an exe (only for windows) to install the os. For your case, I would think that you don’t and shouldn’t install and/or overwrite your user’s device with your os, but include a way to “append” it into said device, such as the Ubuntu installer ISO, which allows you to preview the OS.

4 Likes

Isn’t C++ run on top of the OS and the compiler installed in the OS? if so, I would expect some sort of bytecode or, like you said, assembly.

4 Likes

I believe Windows also installs through ISO as well because I’ve downloaded some images from them in the past for a VM.

I think that’s a good idea! I wouldn’t really be writing anything, so I could possibly get away with writing into Windows’ own filesystem during the early days, and then possibly partition a drive and dual boot alongside Windows later.

2 Likes

@bobastley what’s an OS?

1 Like

An operating system (or OS for short) is a piece of software that is designed to interact with the computer’s hardware. For example, if you’re using Windows 10, that’s an OS. If you’re using Chrome, Chrome “talks to” the kernel and the kernel tells the hardware to do certain operations based on what Chrome wants.

Here’s some more information if you want it:

2 Likes

So is it the software or the hardware or both?

1 Like

An OS is a software, it is designed to act as a gateway between the computer’s hardware and the user/programs running on that OS.

I’m probably not explaining this great, after all I wanted a high-level explanation in my OP, so someone may want to add on

2 Likes

So it operates the system? Also how can I help?

1 Like

Well, kind of. The OS is like a manager of the computer’s hardware and software.

I am looking into creating my own OS, but I can’t find any comprehensive tutorials, all I can find are ones that either go over absolutely nothing or are just line-for-line follow-along. I am looking for a mix of the two.

Example: When it comes to designing the kernel, I want to have some choice and think about concepts instead of just copying and pasting someone’s code, but I want to also go in with some know-how so I can have a reasonable chance of creating a working solution.

1 Like

Bill Gates did not make his own OS. He bought an existing one from a computer company. (Sorry if this is irrelevant)

3 Likes

You need to understand how computer works in very detailed level a lot more detailed way that explained in this article:

You also really need a degree in computer engineering or from university from computer science to be able to make operation system and also focus your studies in these subject:

  1. Digital Systems: This area deals with the design and analysis of digital circuits and systems, including the study of logic gates, Boolean algebra, digital signal processing, and computer architecture.

  2. Computer Architecture: It involves the design and organization of computer systems, including the central processing unit (CPU), memory, input/output (I/O) devices, and system buses. Computer architecture also includes studying topics like instruction set architecture (ISA), pipelining, cache memory, and parallel processing.

  3. Operating Systems: This field focuses on the design and implementation of software that manages computer hardware and provides an interface for user applications. It involves topics such as process management, memory management, file systems, device drivers, and virtualization.

  4. Software Engineering: This area covers the principles and practices of software development, including software design, programming languages, software testing, software maintenance, and software project management.

  5. Networking and Communication: It involves the study of computer networks, protocols, and communication systems. Topics may include network architecture, routing algorithms, network security, wireless communication, and Internet protocols.

  6. Embedded Systems: This field deals with the design and development of computer systems embedded within other devices or machines. It involves hardware-software co-design, real-time systems, microcontrollers, and application-specific integrated circuits (ASICs).

5 Likes

What is an OS?

“Operating System” is really broad but in a sense it is made up of two things

  • Kernel: In charge of abstracting any processes (for example, C programs) from the actual hardware. For example, if a process wants to read from a file, the OS reads from the disk and manages the file system. This is what “Linux” really is
  • User programs: this is what goes into a “Linux Distro” any package managers, init systems, desktop environments that give the user the tools they need.

Looking at Linux

The Linux kernel achieves support of basically any computer configuration by having “drivers” that do the actual heavy lifting of writing to hardware at a low level, and then the kernel can just write to the driver. (When you look at the source code the majority of the code is spent on these drivers).

What it means

You probably do not want to try to create your own operating system from scratch before learning the basics. If you did want to try you could first pick a target machine (for example, a simple raspberry pi pico/simple microcontroller than a real desktop PC), then write a multitasking kernel with drivers for a file system and a screen

Extra Resources

Basically what it sounds like to me is that you just want to get into low level computing, an entire OS from scratch is a really daunting task and I would suggest some resources to get started:

  • Ben Eater’s videos are all really amazing (especially the 6502 series) to learn how a computer executes code
  • This book on Unix was enlightening to me and analyzes where it all really started (C was made here + was the predecessor to all linux/macOS/unix-likes) (source code link)
  • jdh is amazing :wink:
  • Wikipedia article on how a computer starts up an “Operating System”

Low-level stuff may seem daunting but it really opens a new level of understanding IMO

7 Likes

I think this is relevant, especially to explore some of the likely reasons MS chose to buy the OS instead of creating their own.

I would also recommend checking out https://www.linuxfromscratch.org/ @bobastley

3 Likes

Not to curb your enthusiasm (or trying to correct statements like Jobs created a OS), but making an OS is not a small feat and it requires a deep understanding of the hardware the OS needs to run on.
This means it needs deep hardware knowledge, hardware software interaction knowledge and pretty good low level programming skills.
I would suggest to set aside this type of project and first try some simple embedded programming starting from arguing and then from scratch.

6 Likes

Hi everyone!

Thank you for the replies, they were extremely informative. It does seem like I’m biting off more than I can chew, and I really appreciate the resources provided for learning some low-level computing concepts.

Apologies for coming into this with extremely little knowledge on the subject, and I did some research and found out how ridiculous this would be from my standpoint. (Turns out neither Gates or Jobs created an OS, so that was embarrassing)

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.