Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 3 123 LastLast
Results 1 to 15 of 41
  1. #1
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to build an operating system

    Hi,
    I want to build a lightweight operating system that will have these features:

    - Storing, editing, and deleting data from hard disk
    - Running only one application in the memory.
    - Basic input/output features like mouse, keyboard, displaying on the monitor, etc.

    What do I need to learn to be able to do this? What programming language is best? etc.

    This is a learning project so I'm hoping to get serious answers.

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Some parts of it you need to write in assembly (boot loader at least, unless you just borrow an open source one). Most of the rest you can write in whichever compiled langauge you want to use.

    You need to learn about file systems, direct hardware communication, writing rudimentary drivers for your hardware, how OSes deal with hardware and software interupts, and though your single running application doesn't make it strictly necessary you probably should at least think about ways to do memory management and process scheduling.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Instead of writing drivers from scratch for everything which you will need to do, you might want to use an open source kernel as your base and then strip it down. Writing an OS for a system as complex as an x86-based machine (since there is just so much hardware compared to an embedded system) isn't a trivial task.

    You'll need assembly and a higher level language, I would recommend C. I wouldn't use C++ for the lower level OS stuff; the reason C is preferable is the closer relation between your code and the generated assembly since you'll probably have to do some debugging at the instruction level.

    Then you'll have to write the OS API for user programs. So all that stuff you normally get for free when writing programs, like being able to print to the screen and read from the keyboard will all have to be written.

    What is your programming background?
    OracleGuy

  • #4
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    Your best bet would be to use an existing kernel. The Linux 2.4 kernel is pretty light weight, a lot lighter than 2.6. This would do some of the work for you but you would still need to learn a lot.

    If you really wanted to make it from scratch, you could at least do it this way and use what you have learned to do it from scratch later.

  • #5
    New Coder
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I personally want to build a marketable OS. Does anyone have any ideas on how I should do this?

    #include

  • #6
    New to the CF scene
    Join Date
    May 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ya your gonna need some assembly and I would use c for exactly the reason the above poster said. It far easier to deduce the machine code for the c code you write. I write compilers for a living so I know. For certain low level tasks c is the way to go. Plus the compilers for it are generally more stable as the language is simpler. Most designers of operating systems and compilers prefer c but c++ if you keep it simple should be fine.

    This is not a trivial task. You will have to have a good knowledge of the cpu's your running on, I mean get the reference manuals for intel and amd and understand all the aspects of them. Besides that your going to need knowledge of a low level language. A few years later you may actually make something good. I'm not even thinking about drivers.

    Still attempting to write a simple OS will be a rewarding experience and make you a way better coder!

    Google "Toy Os" or write your own OS there are tutorials about simple OS basics there some good information there.

    Be warned though attempting to develop a serious product is a complex task and if your serious it will probably take years to get a decent product. I'm just being honest tons of people start stuff like this realize what there getting into and give up. Just realize your undertaking a large difficult task before your dive in. And PS you better really really know pointers before you even attempt this

  • #7
    New Coder
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Cool

    I do understand what I am getting myself into. My purpose is to allow users to fully control all aspects of their computer while still being able to use their favorite programs. I also understand that this project will take a few years to complete. There is also the fact that there are only going to be two poeple (including me) working on this. and we're both beginners. But I do know that if I don't give up, good things will come.

  • #8
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Quote Originally Posted by TheDevil View Post
    I do understand what I am getting myself into. My purpose is to allow users to fully control all aspects of their computer while still being able to use their favorite programs. I also understand that this project will take a few years to complete. There is also the fact that there are only going to be two poeple (including me) working on this. and we're both beginners. But I do know that if I don't give up, good things will come.
    By "favorite programs" do you mean run Windows programs?

    You might want to consider building your OS for some much simpler embedded computer system instead of an x86 machine. That way you can focus on learning and not have to deal with extremely complicated hardware.

    Though if you are looking to build an OS that can run Windows programs, you should look at ReactOS.
    OracleGuy

  • #9
    New Coder
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I want it to be able to do more than just run windows programms. I want it to be able to run programms from Mac and UNIX. You probably want to say that I'm a f^#&!=@ lunatic. well, don't. I know that it will be very complex. my estimite for the total LOC(lines of code) is going to be around 120 million. I have accepted it so don't try to put my down.

  • #10
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    Setting aside WINE entirely, didn't they already make that operating system? I think that's how BeOS started or something (a nix OS that could run PE not just ELF)

  • #11
    New Coder
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts
    uh, what?

  • #12
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Quote Originally Posted by TheDevil View Post
    I want it to be able to do more than just run windows programms. I want it to be able to run programms from Mac and UNIX. You probably want to say that I'm a f^#&!=@ lunatic. well, don't. I know that it will be very complex. my estimite for the total LOC(lines of code) is going to be around 120 million. I have accepted it so don't try to put my down.
    No need to be so defensive. Though I do find making an estimate on a project's size using LOC rather unrealistic.

    What you are talking about is of course possible but before you even begin to think about user programs, you'll need to be able to have an OS that will initialize the hardware and have at least a console and support for non-volatile storage (like a hard drive). Plus a memory manager, virtual memory support, process and threading support. Once you have those base features in place, you can start to develop the API which will allow those types of programs to run.
    OracleGuy

  • #13
    New Coder
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Macintosh

    That is exactly what I've been thinking about. Good call. I've been working on building the kernel system, but I'm stuck on the directory system. Any ideas?

  • #14
    New Coder
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I have found a kernel to work off of. I am using the Linux 2.6.36 kernel release. Note: You can get this at kernel.org.

  • #15
    Regular Coder
    Join Date
    Jun 2003
    Location
    Silicon Forest
    Posts
    155
    Thanks
    0
    Thanked 5 Times in 5 Posts
    It's been about a year since you started this thread. How is your project coming along?
    Whats the point of a signature?


  •  
    Page 1 of 3 123 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
    •