Jump to content

I want to write an OS (seriously)

- - - - -

  • Please log in to reply
11 replies to this topic

#1
truth14ful

truth14ful

    Newbie

  • Members
  • Pip
  • 3 posts
Hi, I'm not sure if this is the right forum to start this thread in, but I want to write an operating system.
I know my way around Windows 7 fairly well. I know C++, HTML, JavaScript, BlitzBasic, and a little XML, and that none of these languages will be very useful to me. I know a lot of logic and math, but am not extensively learned in pointers, stacks, etc.
I also know that even for someone far more knowledgeable than I am, writing an OS is a lot of work. I heard it was about 10000 hours of writing code. I want to write it anyway. I want to write it in C, but I don't know what namespace I should use. So I need to know: After I learn some C, where do I start?
P.S. Please no replies like "Forget it for now until you go to college." I appreciate your help but I can make decisions like that myself.
Thanks,
truth14ful


#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
Hello truthful,

Generally designing an operating system from scratch will be reinventing the whole wheel. Hobby OS developers often base ideas and methodologies on existing resources and projects.

I know one of our moderators, Dargueta has a small assembly introduction in this section, which happens to include a simple bootloader tutorial, and that can always be a starting point. C can be translated in to assembly, so it can be used once the operating system is able to load executables.

I bet you will be learning the intricacies of systems and their architectures far more than "continuing" a language, you will need to really study on how to get certain parts of the operating system running before anything can be really accomplished.

There is a shed of light for people who want to do it from scratch, and is more of a resource than just a tutorial, including more than one option for certain design of the OS:
Expanded Main Page - OSDev Wiki

Feel free to use us as a resource, an operating system surely is a neat hobby to put on a list - it is in fact fairly simple.

Alexander.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
Talimere

Talimere

    Newbie

  • Members
  • PipPip
  • 11 posts
You might want to check out Linux From Scratch, I've heard it's a good place to start.
Welcome to Linux From Scratch!

#4
Talimere

Talimere

    Newbie

  • Members
  • PipPip
  • 11 posts
You might want to check out linux from scratch. Just google it.

#5
freiza

freiza

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
Operating System Concepts by Peter Galvin
Read this book. It will give enough info for you to getting started.

#6
mebob

mebob

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 490 posts
Assembly language is important for many parts of the OS including the bootloader, the interrupt routines, etc. For certain things you can use inline assembly in C or C++.
Latinamne loqueris?

#7
truth14ful

truth14ful

    Newbie

  • Members
  • Pip
  • 3 posts
Thanks everyone, I'll look into OS Concepts and assembly, but I'm not sure if LfS will let me build what I wanted. My idea was an OS with nested programs, where instead of having to edit a file, save it, and then open it with another program, you can just open the file in a program that is already open in a second one. That way you can edit a file and then use it in another program in real time. I've never heard of a Linux distro with a system like that, and I was hoping to write my own OS anyway.
Also, what are the major differences between C and C++? Is one used at a lower level than the other? Or is one slower?
Thanks,
truth14ful

#8
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200

truth14ful said:

nested programs, where instead of having to edit a file, save it, and then open it with another program, you can just open the file in a program that is already open in a second one.
Some software already does this, to some "safe" and limited extent. If you modify a text document outside of the editor, it will either check a computed hash or file size, and warn you that the file has been modified. The software can be modified to automatically update the text editor, rather than warn.

If the two softwares conflict, as in one changes something in the other, and then that updates the new content to something else it can cascade changes - that will have to be designed to work from the ground up and does not have much to do with the operating system itself.

Quote

Also, what are the major differences between C and C++? Is one used at a lower level than the other? Or is one slower?
Thanks,

Speed is not too important, C will translate easily in to assembly of the platform you are working on, C++ has object/template support and will be a little harder to get working on a fresh operating system.

If you are designing a Linux audio workstation, then C++ may provide a lot of facilities for you, if you are writing a small embedded operating system there is no real benefit to using classes in C++ over C, unless it really is important to you.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#9
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,719 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Once you get going, definitely get Bochs to test your system. There's also OSFMount, which allows you to modify disk image files to use with your OS as if they were actual drives. Let me know if you have other questions, as this is my primary area of interest. :)

I'm assuming you're going to be using Windows for development. If you're using Linux, you don't need image-mounting software as you can do that using built-in utilities. Dunno about OSX.
sudo rm -rf /

#10
truth14ful

truth14ful

    Newbie

  • Members
  • Pip
  • 3 posts
Thanks for all your help everyone! 1 more thing: I don't have $160 to spend on OS Concepts, does anyone know a good place to get 1 for less money?

#11
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,719 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
You can find pretty much everything you need on the Internet for free. I did, anyway.
sudo rm -rf /

#12
Sysop_fb

Sysop_fb

    Programmer

  • Members
  • PipPipPipPip
  • 160 posts
  • Location:Missouri
osdev.org

osdever.net



Those are the two websites I started with when getting into system programming. Although I did eventually fork out the money for Operating system design and implementation by Andrew S. Tanenbaum.

If you don't know assembly I would recommend atleast dabbling in it and there are a few decent intro tutorials out there for nowadays. Just learning the basics of assembly will help cement some concepts of what actually goes on at a lower level.
Plus writing your own bootloader even if you don't use it is a pretty fun experience when starting out.
"The best optimizer is between your ears" - Michael Abrash
Saying you can optimize a program is like saying you understand how a program works on every level of every facet on a specific machines configuration.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users