Jump to content

Operating System Creation

Nano Adam

If I want to create an operating system, what languages would I consider learning? Thanks

Link to comment
Share on other sites

Link to post
Share on other sites

Just like your last post, if you don't have any idea you probably should be considering it

But if that's a goal you have, consider going to university- you'll learn A LOT

Community Standards || Tech News Posting Guidelines

---======================================================================---

CPU: R5 3600 || GPU: RTX 3070|| Memory: 32GB @ 3200 || Cooler: Scythe Big Shuriken || PSU: 650W EVGA GM || Case: NR200P

Link to comment
Share on other sites

Link to post
Share on other sites

I will consider that and University is far from me since right now i am only in 8th Grade right now. 

Link to comment
Share on other sites

Link to post
Share on other sites

23 hours ago, ammar_code said:

I will consider that and University is far from me since right now i am only in 8th Grade right now. 

Keep chuggin along my guy, It'll come faster than you think.

 

Build up what you can in the next 5 years, and I'm sure software engineering would be happy to house you

Community Standards || Tech News Posting Guidelines

---======================================================================---

CPU: R5 3600 || GPU: RTX 3070|| Memory: 32GB @ 3200 || Cooler: Scythe Big Shuriken || PSU: 650W EVGA GM || Case: NR200P

Link to comment
Share on other sites

Link to post
Share on other sites

You need more than just knowing programming langauge but C and assembly. 

 

If you are intelligent and interested, you can pick up a university text book and self teach yourself these stuffs from all the youtube lecture videos published by universities like Carnegie Mellon or UC Berkeley. 

 

https://m.youtube.com/playlist?list=PLggtecHMfYHA7j2rF7nZFgnepu_uPuYws

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

Thanks for that amazing suggestion. 


I really appreciate all the support. 

Link to comment
Share on other sites

Link to post
Share on other sites

Try it out! Read some tutorials on the OSDev wiki (they have a forum you can use to ask questions), modify stuff, and check out the documentation if on UEFI.

Disclaimer though: It's a lot of work and you won't be anywhere close to a typical OS within less than ~2 years. 

Ryzen 7 3700X / 16GB RAM / Optane SSD / GTX 1650 / Solus Linux

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, NunoLava1998 said:

Try it out! Read some tutorials on the OSDev wiki (they have a forum you can use to ask questions), modify stuff, and check out the documentation if on UEFI. 

Disclaimer though: It's a lot of work and you won't be anywhere close to a typical OS within less than ~2 years.

I've always felt that OSDev was more for people who could probably already build an OS without relying on a forum for information.

Before getting started on developing a bespoke OS, one should be able to successfully complete the LFS track on Linux From Scratch.

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

You should know some Assembly and, to make things easier, another higher level language, C is pretty much standard practice; if you're interested in making an operating system but using the Linux kernel instead of starting from scratch, you could consider using LFS or using an existing distribution. In my opinion, however, I'd recommend you learn a lot more about computer science. If you're asking what it takes to create an operating system, you're going to be wasting time just learning about stuff wereas it would be more interesting to learn other topics and expand into that direction.

 

EDIT: I somehow hadn't seen that the post above had pretty much the same advice.

Edited by Source Slayer
Link to comment
Share on other sites

Link to post
Share on other sites

C++ and Assembly would be the prime languages of choice.

 

Another good resource for actually writing a barebones OS is this site:  https://wiki.osdev.org/Expanded_Main_Page

 

Additionally, getting some experience working with an existing OS would be a good idea as well.  Getting a High Level approach often helps guide writing the code of the subcomponents, as well as helping give you an idea of what to do, and what not to do.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

19 hours ago, ammar_code said:

If I want to create an operating system, what languages would I consider learning? Thanks

To write a OS you will need decent knowledge of how to manipulate the hardware yourself. Making BIOS calls, configuring things trough CPU IO ports, installing interrupt handlers, etc...

 

To learn these things I'd suggest you start off "simple". Download and install Open Watcom C++, which is a project that maintains Watcom C++, once the de facto standard C/C++ compiler for DOS. It also includes the Watcom assembler.

Then install Dosbox. The goal is to use Watcom C++, installed and running in windows, to build DOS applications which you can then run in Dosbox. DOS allowed straight access to the hardware, so you can play around and try things without all the protections and safeguards of a modern OS. By running your test applications in the Dosbox emulator rather then on real hardware it's completely safe. You're not actually working with the real hardware, just the dosbox emulation - The worst that can happen is you crash Dosbox.

 

Try to switch to videomode 13h (320*200*256), (int 10h BIOS call). Try to plot pixels by directly accessing video memory (A0000h). Try configuring the VGA controller's color palette trough it's IO ports. If you think you're ready, try soundblaster DMA playback, which involves asking DOS (int 21h) for a block of real mode memory, configuring the DMA controller, installing a interrupt handler and configuring the soundblaster. The documentation for all this is freely available out there online - finding it, understanding it and applying it are part of the exercise.

 

Those are "simple" first baby steps that are probably enough to get you going for a while. That'll either prepare you for the next steps or put you off for good - try and see :)

Link to comment
Share on other sites

Link to post
Share on other sites

First of all thank you for your support everyone. But how about like a YouTube channel that teaches this. Since I usually start with video then documentation. Thanks

Link to comment
Share on other sites

Link to post
Share on other sites

Linux from scratch = zero programming experiences neccesary. You just need to be a command line ninja and know how to use a complier. Source codes are all provided. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

My two cents would be to not plunge into C++, there's just too much to learn language-wise, newer standards more so. Being new you won't utilise even 10% of the language and features, I would not advise to confuse yourself, pick a language and learn to the fullest. C is a good option for starting out with a bit lower level (than is common these days) programming.

 

To create an operating system from scratch you will need to learn Assembly, not hard-core learn everything, but know how things work, be able to read, write and most importantly - research. The bootstrap of an operating system is always a little bit of Assembly. You can put a lot of languages (not interpreted) directly on top of that. C is a logical step, but you CAN do something else. When you're advanced, you can try doing an OS written in Rust (language). Heck, I'd like to try that myself.

 

Anyway, whatever path you choose, I wish you a lot of persistence. Even if a project fails (and a lot of them will), or you lose momentum (or interest), value the knowledge you take with you - it will go into your next project. I remember I started programming around 14 (8th grade as well), now - 10 years later, it's my career and I still love it, I still want to write OS's and game engines (it's still hard to do). And if by any chance you get to university and you hate studying computer science, don't worry - I did too (maybe my uni just sucks I dunno, but at that point I did not really want to study anymore, I wanted to work in the field, badly, so I did).

 

Just some encouraging words, you can skip the top part of the post, whatever, just got a bit nostalgic and remembered how I started out.

Link to comment
Share on other sites

Link to post
Share on other sites

16 hours ago, ammar_code said:

First of all thank you for your support everyone. But how about like a YouTube channel that teaches this. Since I usually start with video then documentation. Thanks 

While you may be able to find videos covering certain topics, there is not a good video series available that will take you from "zero to hero", as it were, in the field of OSs.

Building an operating system like Linux, Windows, Android, UNIX, or MacOS from scratch is legitimately regarded as one of the hardest, if not the hardest, computer programming task that anyone can do. To be successful, you will need to know how to manipulate hardware, how to abstract hardware away (if you want multitasking), how the processor actually works and how it interacts with other system components, and how to write your own libraries/compilers.

And that's before adding a GUI layer.

Now I'm not saying that you shouldn't try. I'm saying that you probably shouldn't try to write a desktop OS, yet.

To get the experience of working with bare metal hardware, I would recommend getting an Arduino, some breadboards, and an AVR programmer capable of programming the bootloader memory. Start with normal Arduino tasks, then take the microprocessor out of it's socket, breadboard it, and start writing C or AVR for it in AVRStudio. Eventually, you should write your own bootloader, and your own USB programmer program for it. Then you can start working on your own compilers for whatever language, and start all over.

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

Just stepping back some, are we talking about an operating system as a whole, or just the kernel?

 

Because writing just the kernel may not be as monumental as the entire OS. Like for example, the MINIX3 kernel is tiny compared to Linux, Darwin, or WNT. If you can write a kernel that leverages other components, then you can build an OS from there.

Link to comment
Share on other sites

Link to post
Share on other sites

Try assembly. That's what DOS, CPM, and most other OS's are based from. It's a pain in the butt, but its a pretty valuable skill from what I can tell.

Link to comment
Share on other sites

Link to post
Share on other sites

For operating systems, you're looking for C , C++ and some assembly knowledge.  You can write pretty much everything in C but some "critical" things, some stuff that's really time sensitive or for which you want complete control over how instructions are executed, you want to write the code in assembly.

 

My advice however would be to NOT start by trying to learn these, you'll be put off programming for good if you do this.

An operating system is something incredibly complex that's done nowadays by big teams of programmers ... it would take you literally YEARS to code something that gets even close to something like Windows 3.1 or Windows 95.

Modern hardware is way too complex these days for a single person to program something... older computers were much simpler.

 

My advice would be to start with a more easy programming language like let's say C# or Visual Basic .net  .... they're good enough to learn programming basics like data types, mathematical operations, events, doing stuff based on what types or does in the window and so on ... and you also have lots of tutorials and examples available to help you out, not to mention books and video tutorials.

 

Start small, for example try to make the classic Nokia worm game, or Tetris by yourself ... or make an even simpler application like a four function calculator ( buttons for numbers 1-9, + , - , / , * , clear / reset and an area in which to show the numbers and the results)

That gratification, that satisfaction that you have achieved something using what you've learned.. you can't imagine how important it is for someone like you that starts to learn programming

 

At your age, you won't have the patience to learn all the stuff you'd need to do an operating system and you'll be demoralized and maybe never want to go into programming if you start like this.

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, Underfire17 said:

Try assembly. That's what DOS, CPM, and most other OS's are based from. It's a pain in the butt, but its a pretty valuable skill from what I can tell.

Heck no. You don't need assembly when C is available, at the very least, avoid it whenever you can. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

10 hours ago, wasab said:

Heck no. You don't need assembly when C is available, at the very least, avoid it whenever you can. 

Actually, that's not true here. At the bare minimum you will need (as in, "there is literally no other option") to write your own bootloader and stack in assembly if you plan to actually run C bare metal. That's if you have access to a C compiler that doesn't expect an OS to be there. If you don't have such a compiler, you will also have to write your own implementation of the C Standard Library, and if you want that to be fast at all, you will need to write some assembly there.

We aren't talking about Arduino's here. Most systems, including RPi, don't have easily accessible bootloaders or C compilers that don't expect an OS to be there.

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

38 minutes ago, straight_stewie said:

Actually, that's not true here. At the bare minimum you will need (as in, "there is literally no other option") to write your own bootloader and stack in assembly if you plan to actually run C bare metal. That's if you have access to a C compiler that doesn't expect an OS to be there. If you don't have such a compiler, you will also have to write your own implementation of the C Standard Library, and if you want that to be fast at all, you will need to write some assembly there.

And even then you'd need to write bits in assembly to do the low level management a OS needs to do. On x86 you need to manage the GDT, for example, there are no C equivalents for the LGDT, LIDT, LTR, etc instructions.

On ARM there's no C equivalent for ERET, etc...

Link to comment
Share on other sites

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

×