Live data from Hacker News

How to Make a Computer Operating System in C/C++

github.com

61–70 of 88 posts

Re: How to Make a Computer Operating System in C/C++

#61

Obviously this is still in its very early stages, but I can see this becoming a very informative and practical course. I'll definitely be keeping an eye on this. Do you intend on turning this into a book and perhaps publishing physical copies?

Yes it's very early stages I'm looking for feedback on how to structure the course. No I don't think so, I just want to an informative resource from what I've learned.

In case you haven't heard of it, you might want to take a look at LeanPub, who specialize in books that are published while they are being written, have a particular focus on Software Development books, and accept manuscripts written in Markdown stored in a Dropbox folder. You can then take the finished LeanPub book to a print-on-demand company like Lulu or CreateSpace to created printed books as well:

  https://leanpub.com/authors
I actually assumed you were making a LeanPub book, and was considering buying the work in progress.

Re: How to Make a Computer Operating System in C/C++

#62
A hobby operating system project - everyone's gotta have one, right?

There are many like it but this one is mine: https://github.com/rikusalminen/danjeros

It's an x86_64 bare bones kernel project, doesn't do much except for boot and handle some interrupts. There's a little multitasking and some related stuff.

Unfortunately there's only a finite amount of time in the world, and not too much of it is available for me to dedicate to this project.

Re: How to Make a Computer Operating System in C/C++

#63
post #43
post #14

I am a graduate student, currently working on building a x86_64 unix like preemptive kernel from scratch, as part of a course. Most of the OS dev guides and books focus on 32 bit arch and I haven't found a single guide so far that is based on 64 bit arch. Since this this guide seems to be in its inception, I hope someone (hopefully me) will send a pull request for a 64 bit tutorial. Building an OS has been in my buck…

There's absolutely a void when it comes to a full amd64 assembly (and associated low level) code. It's a shame, because amd64 is actually rather plesant (as opposed to x86) -- and now rather ubiqutous. I haven't really looked at the code, but I guess the following at least contains a bit of example code: http://www.returninfinity.com/baremetal.html Menuetos also looks rather interesting, unfortunately, as I recall th…

My hobby OS is x86_64 only, straight C. It's GPLv3. I wrote it with the intention of writing a tutorial, partly because of this void, but still have not written the tutorial :)

https://github.com/nwg/nanos

x86_64 bootup / structures

https://github.com/nwg/nanos/blob/master/src/boot.asm

https://github.com/nwg/nanos/blob/master/src/kernel_init.asm

Re: How to Make a Computer Operating System in C/C++

#64
post #56
post #45

Earlier quoted context omitted.

std::list can be used in 2 ways: * With an std::list::iterator in each of your data nodes that represents its own position in the list (this is called the "intrusive style") * Without an std::list::iterator in each of your data nodes If you use the (more common) latter form: whenever you have a reference to your own object, you cannot do any of the linked list operations without an O(N) penalty to go and re-find your…

> whenever you have a reference to your own object, you cannot do any of the linked list operations without an O(N) penalty to go and re-find your element in the list! Can you show an example of when you actually need to do this? Because when I need to do something like this it usually means that some container other than list is more fitting for the problem.

I gave an example: a request that is in multiple linked lists. e.g one by chronological order for quick timing out of oldest requests, and one of active requests waiting on the physical wire.

Now the timeout elapsed, so you have a pointer to a request that needs to be destroyed.

In that case, you typically use the very cheap O(1) list_del on each of the lists it's in. In STL style you pay O(N) for each list it is in. Or you conclude lists are worthless and another structure should be used. But no other structure would give you the incredibly cheap O(1) add and delete you get from lists.

Re: How to Make a Computer Operating System in C/C++

#65
post #54

Earlier quoted context omitted.

I thought it was a reference to this* when I read the title, but after reading them both I'm not sure there is any connection. * http://i.imgur.com/fQ1ST8w.jpg

please tell me it was some kind of joke

Possibly but I think it's real. I believe it's the same guy from this: http://i.imgur.com/evPQL2S.jpg

Re: How to Make a Computer Operating System in C/C++

#66
post #59
post #56

Earlier quoted context omitted.

> whenever you have a reference to your own object, you cannot do any of the linked list operations without an O(N) penalty to go and re-find your element in the list! Can you show an example of when you actually need to do this? Because when I need to do something like this it usually means that some container other than list is more fitting for the problem.

Indeed, coming from Prolog/Erlang-style "most everything can be represented as a tail-call with a linked-list accumulator" programming, I'm very confused about what operations the GP is talking about. Adding/removing nodes at a position other than the head? Lookup by value? If you need these, you should be using a different data structure.

Removing from any location is O(1), as is adding to any location you have a link to.

With a real linked list at least, not with std::list.

Re: How to Make a Computer Operating System in C/C++

#67
post #34

Earlier quoted context omitted.

If you really think that, you've missed CS 101. Or maybe std::list is the only linked list implementation you've seen. In that case, I agree, one should never use std::list. Linux's list.h is extremely useful, and for a wide variety of circumstances, is the most efficient way to manage your data.

Ok, I'll elaborate, especially since my view is at odds with your statement "for a wide variety of circumstances" . As I see it, the only use case where linked lists are superior to other types of lists, like, perhaps, ArrayList in java or vector/deque in C++, is if the following conditions are met: 1: you care about ordering - often you don't care about ordering and in that case, there is no need for a linked list b…

I disagree. Will reply later, too long mto reply on my phone.

Re: How to Make a Computer Operating System in C/C++

#70
post #58
post #50

Earlier quoted context omitted.

I've been a web developer my entire professional career, and for some ungodly reason I have this need to go work in the embedded sector instead. Am I nuts? ;)

Not at all!

Could you provide some pointers? I'm kinda in the same situation.
Post reply on HN