12 ms·
Thor – A minimalistic operating system in assembly and C++
- Jaruzel 10y agoLast week I read the very good 'How to build an operating system from scratch' [1], and I'm glad I did. It meant that I could burrow into the files on this github project and understand exactly what was going on. One day, when I finally have some free time, I am totally going to do this myself. --- [1] https://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf https://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures...
- gravypod 10y agoCheck out the broken thorn tutorials on the subject. They are far more complete.
- Jaruzel 10y agoI will! I'm guessing you mean these..? http://www.brokenthorn.com/Resources/OSDevIndex.html http://www.brokenthorn.com/Resources/OSDevIndex.html
- wichtounet 10y agoThey are pretty good indeed to begin with. However, the best resource there is is clearly osdev.org, both the forums and the wiki are full of information!
- thraveboy 10y agoHere's a better direct link to osdev.org info: http://wiki.osdev.org/Main_Page http://wiki.osdev.org/Main_Page
- gravypod 10y agoThe OSDev wiki is the best think to hit the internet since sliced bread (with cats faces pushed through them?) but it's far from a tutorial. It's a wiki. While it is one of the best repositories of knowledge on the subject of low level development, it's not a step by step guide. In the same way I don't recommend that people read Wikipedia to learn about human history I'd also not recommend reading osdev to learn about low level development. It at it's heart is organized as a reference, not a text book. I wish that someone would go through and accumulate all the knowledge, put it into a series based textbook with chapters, throw in some example code and VMs for many architectures, and sell it to me because I'd pay. I'd also push for those at my university to construct a class around the book as it would be one of the most fascinating and knowledge packed classes I'd think you could take. (Hint hint, nudge nudge writers and professors!) But yes to date NOTHING beats osdev.
- faviouz 10y agoWhat would be a good step-by-step tutorial in your opinion?
- gravypod 10y agoIf you'd like the links that really helped me, check out this: http://www.osdever.net/bkerndev/Docs/title.htm http://www.osdever.net/bkerndev/Docs/title.htm http://www.brokenthorn.com/Resources/OSDevIndex.html http://www.brokenthorn.com/Resources/OSDevIndex.html https://github.com/stephenfewer/NoNameOS https://github.com/stephenfewer/NoNameOS https://anastas.io/osdev/memory/2016/08/08/page-frame-allocator.html https://anastas.io/osdev/memory/2016/08/08/page-frame-alloca... https://github.com/kjiwa/x86-boot-sector-c https://github.com/kjiwa/x86-boot-sector-c These are all useful. If you're more of a book worm check out Minix as said in other parts of this tree. Very very easy to read, interesting bits of history about OS development, and source code included! Nothing's useful without source code. If you'd like to look up some general software books check out Programming the IBM PC, or something to that effect. It's commonly called The Pink Shirt Book. Has interesting stuff on IBM interrupts, coding standards, and bits on filesystems!
- carlesfe 10y ago
- gravypod 10y agoYes sorry, I had just woken up and was on mobile. Couldn't gather my whits to find the link. Now that I've got a cup of joe in me I'm much more chipper and ready for this! Yes that's the link. They walk you through everything! Top to bottom. It's a great starter that will teach you what OS development actually involves. It's like a hand holding experience through a forest of strange practices, you'll love it when you get a chance.
- blackflame7000 10y agoI read this same exact article last week too, what are the odds! Definitely have the same mindset to write my own someday. This project will be a ton of help.
- xhrpost 10y agoThat looks awesome! I did a little side project on rolling my own Unix kernel, highly recommend the guide! https://web.archive.org/web/20160301082842/http://www.jamesmolloy.co.uk/tutorial_html/index.html https://web.archive.org/web/20160301082842/http://www.jamesm...
- kschmit90 10y agoWeow, excellaent reply budday.
- jordigh 10y agoAn OS in C++? But Linus said... http://harmful.cat-v.org/software/c++/linus http://harmful.cat-v.org/software/c++/linus
- erikj 10y agoThat's Linus's opinion, yes. Not everyone has to share it.
- jordigh 10y agoIt's a really annoying widespread opinion. I've been looking for people who really do write OSes in modern C++.
- wichtounet 10y agoHello. I'm the author of the mentioned project. It's indeed a very annoying opinion. Although there are indeed some difficulties in writing an operating system and quite some runtime support to implement, I would say that it's worth it only to have a more powerful language. I'd rather use a language that I really like rather than be forced to use one I don't really care about. I cannot say that C++ is the best language to develop an operating system, but I would definitely say that it's possible if you really know the language. And you don't have to use the complete language (I didn't enable exceptions nor RTTI in my OS).
- ingve 10y agoIncludeOS? [0] From the CppCon 2016 presentation description: "Early in the design process we made a hard choice; no C interfaces and no blocking POSIX calls. We’ve done everything from scratch with modern C++ 11/14 - Including device drivers and the complete network stack all the way through ethernet, IP and ARP, up to and including UDP, TCP and recently also an http / REST API framework. To achieve maximum efficiency we decided to do everything event based and async, so there's plenty of opportunities to use lambdas and delegates." [1] [0] http://www.includeos.org/ http://www.includeos.org/ [1] https://cppcon2016.sched.org/event/d30a43dae4a490dce81a3dfc6dea5ce9 https://cppcon2016.sched.org/event/d30a43dae4a490dce81a3dfc6...
- insulanian 10y agoCan an operating system be developed from scratch using a safe language such as Rust? If yes, why people still even think about doing it with unsafe languages?
- wichtounet 10y agoYou can write a kernel in pretty much every language. There are some experiments with Rust: http://www.randomhacks.net/bare-metal-rust/ http://www.randomhacks.net/bare-metal-rust/ There are several reasons to choose a language rather than another. I personally don't like Rust at all, so I don't see any reason to use it, neither do I see any advantage in using it. But that's only my opinion. A lot of osdev currently is made by hobbyist (not counting the handful of really succesful kernels), so the main argument is simply personal and there is nothing wrong with it. Moreover, keep in mind that Rust is pretty new while C/C++ are decades old, this means more support, more portability, more people that know how to use it, ... This is not negligible at all.
- nickpsecurity 10y agoForget the experiments. Try this one: https://www.redox-os.org/ https://www.redox-os.org/
- pjmlp 10y agoSure it can and it has been done multiple times, although the industry hasn't cared much besides high integrity software, where software errors cost human lives. For an example, check the "Project Oberon" book. http://people.inf.ethz.ch/wirth/ProjectOberon/index.html http://people.inf.ethz.ch/wirth/ProjectOberon/index.html The revised 2013 version, with its own FPGA as replacement for the Ceres Workstation hardware of the original version.
- snaky 10y ago> Can an operating system be developed from scratch using a safe language such as Rust? We don't know. > If yes, why people still even think about doing it with unsafe languages? Because it works.
- _c_ 10y ago+1 for being able to run on Bochs. There's nothing minimalistic about Qemu. It's an enormous resource intensive program to build. And it's not even easy to run in text mode (no x11). "Qemu-lite" is sorely needed.
- Sir_Cmpwn 10y agoIt's actually quite easy to run in text mode, just add -nographic. It automatically hooks the serial port up to your terminal, too.
- _c_ 10y agoWhat OS are you using? Is it working for you in VGA text mode (no x11)? Is this now working on other UNIX-like OS besides Linux? I have had problems with -nographic in the past and I know others who have as well, but maybe it works reliably now?
- Sir_Cmpwn 10y agoYou mean can I run it without having X11 running? Yes, of course, with -nographic. How do you think most major VPS providers run qemu? They certainly don't run their hosts with X11 going. And yes, it runs on not-Linux, but obviously the main selling point of qemu is the access it provides to KVM, which is an interface provided by the Linux kernel. You can do software emulation of a number of architectures on a number of operating systems with qemu.
- _c_ 10y agoAre you saying you yourself do this? You're using BSD, running in VGA textmode, from which you run qemu with -nographic to load an image of another OS? You yourself are doing this? Most of "major VPS providers" I know use Linux, not BSD. (Yes, there are some exceptions but the reliance on Linux is almost universal.) I would love it if you were right and I am wrong, but I seriously doubt you have tested this recently. I will happily give Qemu another go if you have tested this recently and it worked.
- revelation 10y agoAnd the latest commit message is "Prepare ICMP message type decoding" It seems we have not learned from the mistakes of prior operating systems and instead of a "Windows NT ping of death" we'll have a "Thor ping of death", which is a curious image, Thor brought down by a puny ping.
- wichtounet 10y agoThat would be impossible, Thor cannot be brought down by any other than Jörmungandr. More seriously, I'll try to avoid reproducing the ping of death issue :)
- joshmarinacci 10y agoThe hobbyist OSes pop up a lot on Hackernews. Some are more full featured than others. What would say is the minimum feature set to be called a real OS?
- whorleater 10y agoAt least for my operating systems class, the requirement was to be able to boot and run a text editor, usually Vi. Didn't stop some people from building one that could run Doom though.
- joshmarinacci 10y agoAh. I was thinking something more like process isolation and device drivers.
- dalke 10y agoIf process isolation were a requirement then it would exclude many things people call an operating system. For example, CP/M is an operating system with no support for multiple processes.
- wichtounet 10y agoIt's probably highly subjective to make a description of what needs an OS to be an OS. For me, it would be to be able to boot on hardware, to be able to execute applications and to give these applications an abstract layer to the hardware.
- noblethrasher 10y agoRemember that since our general purpose computers are approximately Turing Machines, they can simulate anything, including better general purpose computers. An OS is just a simulation of a "nicer" computer than the one that is natively exposed by the "real" one (i.e. the hardware). Normally, "nicer" is pretty subjective, but in the case of computing it almost always means only two things: * We simulate many more computers than we actually have (i.e. timesharing and multitasking) * We simulate computers that are much easier to program. In other words, an OS is just a simulation of having access to a bunch of nicer-to-program computers. But, this ends up implying a multitude of features: * Simulating many computers requires having a scheduler and process isolation. If we decide that we want individual users to have privileged access to their simulated computers, then we end up adding security features related to authorization and authentication. If we decide that the simulated computers should be able to communicate with each other, then we end up with networking since there is little difference between two simulated computers running on the same box, and two simulated computers that are running on different boxes. * Simulating easier-to-program computers requires having memory management, virtual memory, I/O abstraction, graphics, portability, etc. Since we end up with most, if not all, of the features that most people think are requisite for an OS, I think that my definition is minimal.
- mLuby 10y agoShould have called it ant-man.