I Just Wrote An Operating System From Scratch

moultanomoultano Creator of ns_shiva. Join Date: 2002-12-14 Member: 10806Members, NS1 Playtester, Contributor, Constellation, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Gold, NS2 Community Developer, Pistachionauts
edited April 2004 in Off-Topic
<div class="IPBDescription">in 48 hours</div> There is no feeling quite like rising to the occasion.

As a disclaimer, I didn't have to deal with the boot process, and they gave us a malloc package to use, and we didn't have to write a file system, but everything else my partner and I wrote. (Although last semester I did have to write a malloc package <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html//emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' /><!--endemo-->)

We hadn't intended to do it in 48 hours. This was a 6 week project. But we discovered thursday night that there was a bug in our code. To be specific we discovered that the method we were using to context switch between processes would fail whenever the context switch transitioned between two processes in the middle of system calls. This meant rewriting virtually all of our code.

Between Thursday night and Saturday night we coded, with one eight hour break to sleep and a few for food. We wrote the entire frikin' thing. There are no memory leaks. It has not crashed no matter what we do to it, and it disables interrupts only on asynchronous interrupts. In short, it rocks.

This is without question the biggest accomplishment of my life. And I'm feelin like I can walk on air. Just thought I'd share.

Comments

  • coilcoil Amateur pirate. Professional monkey. All pance. Join Date: 2002-04-12 Member: 424Members, NS1 Playtester, Contributor
    Sweet, now port NS to it. (;

    Seriously though, great job.
  • eedioteediot Join Date: 2003-02-24 Member: 13903Members
    upload it

    is it any good?
  • XiileXiile Join Date: 2003-02-22 Member: 13818Members
    edited April 2004
    Edit: Fine, no humor allowed. <!--emo&???--><img src='http://www.unknownworlds.com/forums/html//emoticons/confused.gif' border='0' style='vertical-align:middle' alt='confused.gif' /><!--endemo-->
  • moultanomoultano Creator of ns_shiva. Join Date: 2002-12-14 Member: 10806Members, NS1 Playtester, Contributor, Constellation, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Gold, NS2 Community Developer, Pistachionauts
    Well, in order to run anything (since it doesn't have a file system) the programs have to be loaded into a ram disk image. It doesn't have any output other than characters, and it doesn't support real standard libraries so any code you run would have to be written for it. I also haven't run it outside of an instruction set simulator. But if you really want it, I'll see what I can do. <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html//emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo-->
  • Cold_NiTeCold_NiTe Join Date: 2003-09-15 Member: 20875Members
    edited April 2004
    There is no feeling like the feeling you get when you rise to the occaision, eh? After the hard work you must have put into that, I can hardly think of someone more qualified to say that.

    Congrats man.

    ------------------------------------------
    **EDIT**

    Okay after reading XeroSlayer's reply I can't help but be angry. I mean w.t.h. man, this guy just put his soul into his work (obviously for a class or a job, so you can't argue the point) and is feeling good...

    Don't burst his bubble....
  • moultanomoultano Creator of ns_shiva. Join Date: 2002-12-14 Member: 10806Members, NS1 Playtester, Contributor, Constellation, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Gold, NS2 Community Developer, Pistachionauts
    edited April 2004
    <!--QuoteBegin-XeroSlayer+Apr 12 2004, 12:04 AM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (XeroSlayer @ Apr 12 2004, 12:04 AM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> !NOTE! : BE VERY CAREFUL. IF YOU DO THIS BEFORE 8:00 PM, THERE WILL BE A BRIGHT OBJECT IN THE SKY. WE CALL IT THE SUN.
    <!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
    Actually that's the nice thing about going to carnegie mellon is that there is no sun in pittsburgh. <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html//emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo--> My OS professor refers to sunny days as "big yellow ball days" because all the native pittsburgers are walking around in a daze wondering what that bright thing in the sky is.

    Seriously though, next weekend there's going to be some seeeerious frisbee playing. <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html//emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' /><!--endemo-->
  • eedioteediot Join Date: 2003-02-24 Member: 13903Members
    haha dont worry <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html//emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo-->

    neato, though

    and xeroslayer, that "joke" has been done to death and back

    and its STILL not funny

    oh well, maybe if you stay on the internet more [hyopcrite] then you might come across someone you can steal funny jokes from

    jeez
  • CForresterCForrester P0rk(h0p Join Date: 2002-10-05 Member: 1439Members, Constellation
    Very cool! I bet you could get extra marks if you made it support a filesystem (Any filesystem) and some standard libraries.
  • UltimaGeckoUltimaGecko hates endnotes Join Date: 2003-05-14 Member: 16320Members
    Now you just have to take down Linux and Microsoft...mwhahahaha. As...that...one dude says..."You can dooooo it!" <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html//emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' /><!--endemo-->
  • Dr_ShaggyDr_Shaggy Join Date: 2002-09-26 Member: 1340Members, Constellation
    Nicely done, I wrote one last semester but it was crap cause I never wanted to do any work for that class. I was too busy spending time on my graphics class writing my ray tracer.
  • moultanomoultano Creator of ns_shiva. Join Date: 2002-12-14 Member: 10806Members, NS1 Playtester, Contributor, Constellation, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Gold, NS2 Community Developer, Pistachionauts
    edited April 2004
    Our next project in the class is to extend it, and I'm not sure quite how yet, but we may have to write a file system.

    At the moment the kernel supports wait, fork, exec, thread_fork, sleep, readline, exit, yield, deschedule, make_runnable, new_pages, remove_pages, and a whole lot of screen console commands that I'm not going to list. If anyone is interested, <a href='http://www-2.cs.cmu.edu/~410/p2/kspec.pdf' target='_blank'>here</a> is the spec for it.

    Our previous project in the course was to write a full thread library given a kernel that met the spec of the one we just wrote, and that thread library came pretty close to implementing posix threads, so theoretically we could link the two, but I didn't really get a chance to try it out before we had to submit it, and I'm not going to touch that code again for at least a week. <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html//emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' /><!--endemo-->

    <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Nicely done, I wrote one last semester but it was crap cause I never wanted to do any work for that class. I was too busy spending time on my graphics class writing my ray tracer.<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
    Yeah, that will be next semester for me. I'm really looking forward to it.
  • LikuLiku I, am the Somberlain. Join Date: 2003-01-10 Member: 12128Members
    Awesome work. I wouldn't know but, I'm guessing it's hard work.
  • TenSixTenSix Join Date: 2002-11-09 Member: 7932Members
    Make it compatible with some Windows programs and prepare to be rolling in the money you will soon be shelling out to your defense lawyers. <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html//emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif' /><!--endemo-->
  • DOOManiacDOOManiac Worst. Critic. Ever. Join Date: 2002-04-17 Member: 462Members, NS1 Playtester
    Congrats moultano. I'm taking an OS class next semester and I know that's part of the drill, so I dunno how to feel about that. Its kinda a big jump from where I'm at now heh.
  • moultanomoultano Creator of ns_shiva. Join Date: 2002-12-14 Member: 10806Members, NS1 Playtester, Contributor, Constellation, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Gold, NS2 Community Developer, Pistachionauts
    If you want or need any help with it, feel free to drop me a line. A word of advice: Study the iret instruction. Know exactly what it does in every case. Its essential.
  • RueRue Join Date: 2002-10-21 Member: 1564Members
    Yeh, its like the first program I wrote that someone actualy used and liked using <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html//emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo-->

    it was just a small applet that changed
    100 -> one hundred
    345 -> three hundred and fourty five
    667 -> six hundred and suxty six

    felt good <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html//emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo-->
  • BogglesteinskyBogglesteinsky Join Date: 2002-12-24 Member: 11488Members
    <!--QuoteBegin-Rue+Apr 12 2004, 05:16 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Rue @ Apr 12 2004, 05:16 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> Yeh, its like the first program I wrote that someone actualy used and liked using <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html//emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo-->

    it was just a small applet that changed
    100 -> one hundred
    345 -> three hundred and fourty five
    667 -> six hundred and suxty six

    felt good <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html//emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo--> <!--QuoteEnd--> </td></tr></table><div class='postcolor'> <!--QuoteEEnd-->
    I hope it got the counting and spelling right though <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html//emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif' /><!--endemo-->
  • That_Annoying_KidThat_Annoying_Kid Sire of Titles Join Date: 2003-03-01 Member: 14175Members, Constellation
    <!--QuoteBegin-coil+Apr 11 2004, 09:00 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (coil @ Apr 11 2004, 09:00 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> Sweet, now port NS to it. (;

    Seriously though, great job. <!--QuoteEnd--> </td></tr></table><div class='postcolor'> <!--QuoteEEnd-->
    ^^


    Very good job


    nice hardcore coding!
  • OttoDestructOttoDestruct Join Date: 2002-11-08 Member: 7790Members
    I can write hello world in assorted patterns on the screen using loops... ph33r
  • DOOManiacDOOManiac Worst. Critic. Ever. Join Date: 2002-04-17 Member: 462Members, NS1 Playtester
    Just wondering, what language did you code it in?

    Our OS class is C++ afaik.
  • moultanomoultano Creator of ns_shiva. Join Date: 2002-12-14 Member: 10806Members, NS1 Playtester, Contributor, Constellation, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Gold, NS2 Community Developer, Pistachionauts
    Ours is in C. The problem with C++ is that new and delete aren't thread safe and reentrant. A lot of the code you will write will probably be in assembly though. All of the interrupt handlers need to have assembly wrappers and context swtiching requires assembly. I personally prefer C for this type of stuff because its more direct and less cluttered. Particularly for debugging purposes its nice to have the code as low level as possible so you know exactly which code could be causing which errors.
Sign In or Register to comment.