CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Join Date
    Jun 2009
    Posts
    100

    Post Make an OS in C++???

    I was thinking for the future when I get good enough at C++ if its possible to make an OS in C++.

    I am aware that most of windows and linux are made of C++ but I just don't know where I would start.

    I would use grub as the boot loader because its easy to configure.

    but I use iostream, stdlib.h, and string during almost all of my terminal based projects so would have no idea how to recreate those libraries.

  2. #2
    Join Date
    Jul 2009
    Posts
    105

    Re: Make an OS in C++???

    David, making an OS is very hard. It requires lots of talent and takes a lot of time. It takes many years just to learn enough in order to create a simple program. I know you are talking about the future, but it still does take time and a lot of knowledge.

  3. #3
    Join Date
    Apr 2007
    Location
    Mars NASA Station
    Posts
    1,436

    Re: Make an OS in C++???

    You should follow Linus Torvalds suggestion to participate in open source kernel development or write a small OS simulation like Linus.
    Thanks for your help.

  4. #4
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: Make an OS in C++???

    You could also try to make an OS for a microprocessor such as those used in embedded projects. The hardware interfacing requirements are a lot simpler which means that you will be up and running much quicker.They often come with development kits, possibly interfacing to a small LCD display.
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

  5. #5
    Join Date
    Nov 2006
    Posts
    1,611

    Re: Make an OS in C++???

    Like others have mentioned, it's an ambitious goal, but a rewarding study.

    Linux (the guts of it) were made in C, not C++.

    Stroustrup, the originator of C++, indicates his position that C++ is suited for OS development.

    Torvalds, the originator of Linux, made some unfortunate comments to the effect that C++ isn't suited for OS development. It's not exactly true, but it's worth noting what and why this is the case.

    C was originally created to be a kind of assembler, independent of the CPU and of any operating system. In the days C was invented, only large institutions and major corporations purchased computers, and they may easily be expected to have to create their own operating system as the new owner of a computer. CPU's weren't standardized quite like they are today - one may have used an 18 or 24 bit CPU, for example.

    At the time, there were a number of students who had written their example programs in assembler, but the University they attended planned to upgrade the computer, and that meant the CPU would change, rendering their applications incompatible. A few recognized this to be a fundamental problem, and decided to solve that by creating a language which functions at or near the level of assembler, giving the same basic properties of machine language, but having no inherent involvement with the CPU; no dependency on it's architecture in any way. This was before there was an operating system FOR this language.

    Once this was created, and the concept proved (the new computer arrived), they also realized the need for a standardized operating system, and created one - with their new language (C) - that became Unix.

    C++, being an extension of C, maintains much of the assembler like features, and can be used in a similar manner, to create even an operating system. You are, however, taking over everything - memory control, process protections, I/O - and performing this at a level of rather high engineering. It's certainly possible - it can take years, and quite a few of done this.

    You will, however, be required to cover a great volume of computer science theory; just about the entire course of a University, to actually know what you're asking about.
    If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).

  6. #6
    Join Date
    Jun 2009
    Posts
    100

    Re: Make an OS in C++???

    Quote Originally Posted by JohnW@Wessex View Post
    You could also try to make an OS for a microprocessor such as those used in embedded projects. The hardware interfacing requirements are a lot simpler which means that you will be up and running much quicker.They often come with development kits, possibly interfacing to a small LCD display.

    You mean like programming a micro-controller with C++?

    I have a spare micro-controller from a friend of mine.

    Would it be easier to program basic functions for the micro-controller in C++ then it would be an OS?

    If I started with programming the micro-controller with C++ then would that give me a basic idea of how an OS would function?

    I have a lot of parts for the micro-controller to control including two servos, 6 LED's, an IR transmitter and receiver, and other basic parts.

  7. #7
    Join Date
    Jun 2009
    Posts
    100

    Re: Make an OS in C++???

    Quote Originally Posted by JVene View Post
    Like others have mentioned, it's an ambitious goal, but a rewarding study.

    Linux (the guts of it) were made in C, not C++.

    Stroustrup, the originator of C++, indicates his position that C++ is suited for OS development.

    Torvalds, the originator of Linux, made some unfortunate comments to the effect that C++ isn't suited for OS development. It's not exactly true, but it's worth noting what and why this is the case.

    C was originally created to be a kind of assembler, independent of the CPU and of any operating system. In the days C was invented, only large institutions and major corporations purchased computers, and they may easily be expected to have to create their own operating system as the new owner of a computer. CPU's weren't standardized quite like they are today - one may have used an 18 or 24 bit CPU, for example.

    At the time, there were a number of students who had written their example programs in assembler, but the University they attended planned to upgrade the computer, and that meant the CPU would change, rendering their applications incompatible. A few recognized this to be a fundamental problem, and decided to solve that by creating a language which functions at or near the level of assembler, giving the same basic properties of machine language, but having no inherent involvement with the CPU; no dependency on it's architecture in any way. This was before there was an operating system FOR this language.

    Once this was created, and the concept proved (the new computer arrived), they also realized the need for a standardized operating system, and created one - with their new language (C) - that became Unix.

    C++, being an extension of C, maintains much of the assembler like features, and can be used in a similar manner, to create even an operating system. You are, however, taking over everything - memory control, process protections, I/O - and performing this at a level of rather high engineering. It's certainly possible - it can take years, and quite a few of done this.

    You will, however, be required to cover a great volume of computer science theory; just about the entire course of a University, to actually know what you're asking about.
    Very interesting! But sadly the background info on common OS's doesn't help much with the creation of an OS.

  8. #8
    Join Date
    Jun 2009
    Posts
    100

    Re: Make an OS in C++???

    Quote Originally Posted by Peter_APIIT View Post
    You should follow Linus Torvalds suggestion to participate in open source kernel development or write a small OS simulation like Linus.
    You mean like reviewing the code of a smaller OS like... Minix?

  9. #9
    Join Date
    Jun 2009
    Posts
    100

    Re: Make an OS in C++???

    I am already capable of making a Linux distro from scratch using LFS but that was easy once you know a decent amount about programing and Linux. I can imagine that making a Linux distro from scratch is no nearly as difficult as making a new OS from scratch.

    I am taking a class in votech for my last two years of high school and they teach all about computer engineering down to what parts make up a hard drive and how to assemble one from scratch.

  10. #10
    Join Date
    Jun 2009
    Posts
    100

    Re: Make an OS in C++???

    Quote Originally Posted by Alexz003 View Post
    David, making an OS is very hard. It requires lots of talent and takes a lot of time. It takes many years just to learn enough in order to create a simple program. I know you are talking about the future, but it still does take time and a lot of knowledge.
    I never said it would be easy and I would be prepared to spend many many years on the project.

    Linux took a LONG time to make and its not even close to done.

    Perhaps I should help work on linux instead of making my own OS from scratch.

    Either way it will still be very difficult.

  11. #11
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Make an OS in C++???

    I'd start out by (at least) reading an Operating Systems textbook cover-to-cover so you get an idea of the challenges involved. Better yet, take an OS class if you can find one.

  12. #12
    Join Date
    Jun 2009
    Posts
    100

    Re: Make an OS in C++???

    Quote Originally Posted by Lindley View Post
    I'd start out by (at least) reading an Operating Systems textbook cover-to-cover so you get an idea of the challenges involved. Better yet, take an OS class if you can find one.
    Ok I will keep an eye out for a book like that.

    We don't have an OS class so thats out of the option.

  13. #13
    Join Date
    Apr 2005
    Posts
    107

    Re: Make an OS in C++???

    Browse here for some info/ideas...

    http://wiki.osdev.org/Main_Page

  14. #14
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: Make an OS in C++???

    Quote Originally Posted by Lindley View Post
    I'd start out by (at least) reading an Operating Systems textbook cover-to-cover
    I wrote a simple co-operative mutli tasking kernel once for a 68000 based project. I learned the principles by watching the 'Open University' on BBC2 whilst eating my breakfast on a Sunday morning.

    Pre-emptive OS design may involve a little more work.
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

  15. #15
    Join Date
    Jun 2009
    Posts
    100

    Re: Make an OS in C++???

    Quote Originally Posted by rdrast View Post
    Jesus that makes it look a LOT harder then I expected.

    I knew it was going to be hard but... wow!

    I think it would be a lot easier for me to use an already created kernel like the linux kernel and just build it up from there that way I wouldn't have to deal with interacting TO much with the computer hardware or making drivers for that hardware but I would still have to build a lot of the components of the OS.
    Last edited by David2010; July 28th, 2009 at 02:13 PM.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured