Creating an OS

Discussion in 'Mac Programming' started by Sean7512, Mar 18, 2007.

  1. macrumors 6502a

    Joined:
    Jun 8, 2005
    #1
    Well, call me crazy but I've been thinking about creating my own operating system :eek: Why you may ask? Because I think I'd enjoy the challenge and would gain experience as well as learning a whole lot. I am not talking about a full, fledged graphical OS, obviously. I think it'd be fun to see what I can do, I would like to create it to be able to handle preemptive multitasking, page faults, hardware interrupts, exception, and the like. I have quite a few books on Operating Systems that I would be able to reference. I have taken all of my C++ courses needed for my CIS major and I also know a great deal of x86 Assembly Language and Macros. What do you think, is it even remotely possible to do? The books claim that knowledge of C++, Assembly, and lots of patience is all thats needed. So, what do you guys think, am I insane or is it possible?
     
  2. macrumors 68040

    mduser63

    Joined:
    Nov 9, 2004
    Location:
    Salt Lake City, UT
    #2
    Well, Linus Torvalds did it. He wrote a kernel anyway. I guess my advice would be, don't think it's going to be easy. There's a reason there are hundreds and even thousands of people working on OS programming at Apple and Microsoft.
     
  3. macrumors regular

    x704

    Joined:
    Apr 15, 2006
    #3
    While you are at it could you make a driver for the wireless card in the iMac (C2D) for 64bit Linux? That might be a bit easier ;)

    I'd do it myself if I knew more C/C++, maybe this summer if nobody else does it.
     
  4. macrumors regular

    Joined:
    Apr 3, 2006
    Location:
    Dublin, Eire
    #4
    Well christ don't you go for broke!!!! from what i know there's nothing stopping you other then the length of the average human life and the prerequisite that we sleep :D. But there's no reason you couldn't make a really basic one. Nothing that will do anything fancy but it may be better to get a few people to help, start a mini project....

    It's something i'd love to do, a real achevement but i'm afraid, other then read a few books and make some half arsed atempts to start me knows nada about programing. But future goal is to learn and that would be something that you could look at and be proud!!!:)

    Good luck if you do try though, more power to you for even dreaming, as they say, aim for the moon and if you miss at least you'll give some ammature astronomist a shock:eek:
     
  5. macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #5
    There are quite a few people who have written OSs, actually. It's not that difficult. I would suggest picking a well known older system to target, as modern hardware tends to be complex and lacking in documentation.
     
  6. macrumors 68000

    Aniej

    Joined:
    Oct 17, 2006
    #6
    I have absolutely no idea how hard this would be, but imagine quite difficult. Because it will likely be so difficult and you have the ambition to do this thing, I say absolutely go for it! You have nothing to lose, fun and frustration to experience and a great goal that sounds interesting. if you are serious about going ahead, I will subscribe to this thread and try and check in every once in a while and check up on the progress. Go for it.
     
  7. macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #7
    I guess you could develop your OS by running it in a virtual machine, ie use Parallel. That might make the development/test cycle a bit quicker than using a real PC.

    I was also wondering what processor/architecture you were thinking of targetting. The thing is, if you were going to put all this effort into a big project then perhaps a little 'gazing into the crystal ball' might let you develop something which could turn into something really big in the future! Multiple cores is the future, so an OS designed from the ground up for 100's of cores might be the way to go. Graphic cards are certainly going this way too. The new NVIDIA cards have something like 256 stream processors which can be programmed in 'C'. How about an OS to run on a gaphics card? I don't know if this could be done but it certainly would be different from yet another OS for PCs.

    good luck

    b e n



    b e n
     
  8. macrumors member

    Joined:
    Jan 18, 2006
    Location:
    Finland
    #8
    You're not crazy!

    You're not crazy ;) -- The best way to learn is by doing. As others have alluded to, I think the hardest part is actually deciding the scope of your project.

    Using a virtual machine is a good idea, since debugging a kernel is a very painful process (you can Google to read about Linus' experiences of this). The virtual machine could even be your own, or something like llvm.

    Best of luck to you!
     
  9. macrumors 65816

    Flynnstone

    Joined:
    Feb 25, 2003
    Location:
    Cold beer land
    #9
    You may be crazy, I can't comment on that :D
    You may want to look at a book by Jean Labrosse. It is how a Real Timer Operating System (RTOS) is designed. His specifically. He can run it under Windows. So this virtualization info would be beneficial. Porting this to run under OS X would be great!
    Building an OS to learn is good. Now if you could build something useful and learn, then that is great!

    Good Learning.
     
  10. Guest

    Joined:
    Mar 6, 2007
    #10
    Just curious -- on which aspect would you start? Do you have any design goals in mind?

    By the way, Stanford's CS240 class provides a list, organized by topic, of various papers (in PDF format) related to OS topics on its web-site: http://www.scs.stanford.edu/06au-cs240/. Might be worth a read.

    Please let us know how it progresses!
     
  11. macrumors regular

    Joined:
    Jan 11, 2006
    #11
    I would suggest buying Tanenbaum's book - Operating Systems Design and Implementation. Basically the book describes the basis of operating system design and has a fully fledged implementation of a microkernel operating system with it, in the form of Minix. Best of all, you get the full source code with it.

    As some people already suggested try to get a virtualization application to start your development. I'd first try to write the bootblock code, the first block of code your computer starts executing. It's quite satisfying seeing a your message printed on the screen and a good motivation to continue.
     
  12. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
    #12
  13. macrumors 6502

    Joined:
    Oct 24, 2005
    #13
    I wouldn't call you crazy for that. I'd call you crazy if you think you can complete one by yourself.
     
  14. Retired

    psychofreak

    Joined:
    May 16, 2006
    Location:
    London
    #14
    I think that the future (partly?) is in web-based computing...maybe try to make a simple web-based OS...
     
  15. macrumors 68030

    slooksterPSV

    Joined:
    Apr 17, 2004
    Location:
    Nowheresville
  16. Retired

    psychofreak

    Joined:
    May 16, 2006
    Location:
    London
    #16
  17. macrumors 6502

    Joined:
    Feb 28, 2007
  18. macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #18
    You'd be better off modifying an existing OS. That's what Linus did. He started with Minux. Doing what you say has been done many times. Typically it requires years of nearly full-time effort. I see only one reason to try this -- that is you think you have some new idea and want to see how well it might work. One new idea might be an OS that could work well on a computer with a very large number of "cores", say like 64 or 128 cores. By the time you are done there may actually be machines like this.

    Here are some random ideas....
    Perhaps in this new system there is no distinction between "OS" and user level code, only fine gradations of privilege and ownership. Maybe everything is made of filter threads that read some data and write something out and they are designed so if you run 2 copies work goes twice as fast. these threads are considered to be always running (you never start or stop a process in the new OS, they just come to life when input is present) and they scale by demand, a high workload cases them to "clone". Threads find there own free core to run on, no central scheduler. or maybe cores find thread that need to run (kind of like the way RA+1 requests worked in CDC's old OSes.)

    Just ideas... my point is if you are going to do this you need a reason and some radcal new OS type that is not just another UNIX clone.
     
  19. macrumors member

    Joined:
    Jan 18, 2006
    Location:
    Finland
    #19
    www.osdev.org

    A small simple OS? IMHO the source examples are simply DOS boot-loaders. But, thank you for the link -- the introduction to assembly language was quite amusing!

    Furthermore, that site links to http://www.osdev.org/osfaq2/index.php which looks like a great resource :)

    AFAIU that is not true; "Torvalds thus decided to create a new operating system from scratch that was based on both MINIX and UNIX." (Quote from http://www.bellevuelinux.org/linus.html.)
     
  20. thread starter macrumors 6502a

    Joined:
    Jun 8, 2005
    #20
    Wow, I am surprised that hardly anyone told me that it is impossible :p Yea, it is obviously going to take a long time to finish, but now that my g/f and I are not together anymore (after 2 and a half years), I should have plenty of free nights to waste away to coding. I grabbed about 5 of my friends from my CS classes that are all willing to get this thing going. There is a lot of planning ahead of us right now, so beginning of coding is a while off. Here is what we all concluded after talking about it for a good 2 hours today...

    1. It will (hopefully) be coded specifically for 64 bit, intel processors. All of us have access to computers that are C2D (I'm the only one using a Apple). We also think that the more registers available would be helpful as we probably aren't the most efficient coders around.

    2. We want to design it to support multiple CPU's....how many? We are not sure, maybe just 1 core, maybe 100...we are gonna need to look into this in more detail.

    3. BASIC TCP/IP as a way to exchange text-based emails, etc.

    4. Some form of video card support, none of us are really good at anything graphics wise..but our one teacher gave us a few books after hearing our project.

    5. We also hope to be able to utilize, most if not all ports (USB, etc). Not sure how useful this would be as it may be getting a little more advanced for right now.


    That is our small list right now. We are all working on researching tonight so we can modify our list....once we all agree on the main details, we will go through the finer facts. Then hopefully we will begin coding. We are learning microprogramming in our OS class right now, and our next topic is machine language...I'm sure that both of these will help us greatly. I will keep you guys posted as more develops.....Probably won't be much to update you guys on until we get a final outline of everything.
     
  21. macrumors 6502a

    Cult Follower

    Joined:
    Feb 20, 2007
    Location:
    North Dakota
    #21
    good luck, I don't think I could ever do something like that, I'm not patient enough.
     
  22. macrumors 65816

    Flynnstone

    Joined:
    Feb 25, 2003
    Location:
    Cold beer land
    #22
    Creating another Linux would be kind of pointless. You all might lose interest.
    Create something new and perhaps useful.
    Look at minix, Linux and some RTOS code.
    Perhaps build an OS for Objective-C on embedded systems.
    Look at multi processor/core ideas.

    Especially if you are looking at more than one CPU type - avoid assembler.
    Use only when necessary. Keep it separate. Be careful of endianness.
    Good Luck
     
  23. macrumors 6502a

    macman2790

    Joined:
    Sep 4, 2006
    Location:
    Texas
  24. macrumors 6502

    Joined:
    Sep 20, 2006
    #24
    Hmm, have you considered going the other way and instead of looking at OS'es, then looking at domain specific languages?

    One area I find fascinating is work like Links. Now if you could do for that domain what PHP did for (and to) server-side web, *that* would be interesting.
     
  25. macrumors member

    Joined:
    Nov 7, 2006
    #25
    Go for it dude. Ive always wanted to make one myself. Operating systems really arent that complicated when you cut out all the bloated fat that doesnt belong in the kernel. 85% of the Linux kernel code is drivers. So if you only need to support basic hardware then it is extremely plausible that you could do it. Just make sure you plan the thing out very well before you begin.
     

Share This Page