Who remembers Nachos? https://en.wikipedia.org/wiki/Not_Another_Completely_Heurist... 3rd year OS class we had to use Nachos as our base OS and build your usual file management, pipes etc. functionality on top of it. Really taught you how an OS works.
How to Make a Computer Operating System in C/C++
31–40 of 88 posts
Re: How to Make a Computer Operating System in C/C++
#32Earlier quoted context omitted.
You can have generalized containers in C, using the intrusive pattern. For example, Linux's list.h has an intrusive list that is far better than the abysmal std::list from the STL.
Any C++ programmer knows not to use std::list anyway.
Re: How to Make a Computer Operating System in C/C++
#33Earlier quoted context omitted.
You can have generalized containers in C, using the intrusive pattern. For example, Linux's list.h has an intrusive list that is far better than the abysmal std::list from the STL.
I've only recently started C++ development...why is std::list abysmal?
http://stackoverflow.com/questions/18449038/is-there-ever-a-...
Re: How to Make a Computer Operating System in C/C++
#34Earlier quoted context omitted.
Any C++ programmer knows not to use std::list anyway.
How about: Any C or C++ programmer knows not to use linked lists anyway.
Linux's list.h is extremely useful, and for a wide variety of circumstances, is the most efficient way to manage your data.
Re: How to Make a Computer Operating System in C/C++
#35http://pdos.csail.mit.edu/6.828/2012/xv6.html
(Although if you want to run the original Unix v6, written in a now-archaic proto-C --- unsigned integer variables are declared as pointers because "unsigned" itself wasn't directly supported in the language yet --- PDP-11 emulators and system images are readily available.)
Re: How to Make a Computer Operating System in C/C++
#36Earlier quoted context omitted.
You can have generalized containers in C, using the intrusive pattern. For example, Linux's list.h has an intrusive list that is far better than the abysmal std::list from the STL.
Any C++ programmer knows not to use std::list anyway.
They all either take ownership of your data, or point at your data unidirectionally.
This means that given a pointer to your data you cannot, for example, delete it from multiple data structures it is contained within without going from these structures roots to re-find the pointers to your data.
Whereas with intrusive data structures (the way it is done in the Linux kernel and other "advanced" C projects), you can easily embed your structure in multiple data structures, such that you can do very quick deletion or modification of the data without re-finding it.
Re: How to Make a Computer Operating System in C/C++
#37Earlier quoted context omitted.
I've only recently started C++ development...why is std::list abysmal?
I found a stack overflow question that seems to go over it. Basically it looks like there's almost always a better choice for whatever you're doing. http://stackoverflow.com/questions/18449038/is-there-ever-a-...
Re: How to Make a Computer Operating System in C/C++
#38Earlier quoted context omitted.
> write a very simple UNIX-based operating system in C++ (does anyone else smell a contradiction?) I'm going to use this as an opportunity to champion C++ for systems programming despite the fact that it wasn't really your argument. I feel obligated to do this because I agreed with you for a long time on this but have changed my mind over the past year or two. The argument against C++ as a systems programming languag…
You can have generalized containers in C, using the intrusive pattern. For example, Linux's list.h has an intrusive list that is far better than the abysmal std::list from the STL.
In general, I'm anti-boost, but I think it's a personal bias and we use the hell out of it at work to great effect. The one thing I'll give boost::intrusive over sys/queue.h is that the type system helps you a lot more to catch issues and the common case is a bit simpler (a struct that exists in a single linked list and a single hash table, for example).
I've been burned many times by something like the following
struct foo {
TAILQ_ENTRY(foo) lru_entry;
TAILQ_ENTRY(foo) hash_entry;
};
...
void some_magic_func(struct foo *f) {
TAILQ_REMOVE(static_tailq, f, hash_entry); // oops, should be lru_entry!
}
Boost intrusive templatizes on the member as well (IIRC) and eliminates this whole class of problem.Re: How to Make a Computer Operating System in C/C++
#39Earlier quoted context omitted.
You can have generalized containers in C, using the intrusive pattern. For example, Linux's list.h has an intrusive list that is far better than the abysmal std::list from the STL.
Intrusive datastructures were the thing I missed most from C, but boost::intrusive satisfies my desires when it's absolutely necessary. In general, I'm anti-boost, but I think it's a personal bias and we use the hell out of it at work to great effect. The one thing I'll give boost::intrusive over sys/queue.h is that the type system helps you a lot more to catch issues and the common case is a bit simpler (a struct th…
I've seen it implemented, but everyone uses the typical non-type-safe one anyway :)
I don't think I've ever had such bugs in a lot of code though, since I tend to wrap the "containerof" call with a little function like: foo_of_lru_entry and foo_of_hash_entry. A bit of boilerplate for each data structure, but worth it.
Re: How to Make a Computer Operating System in C/C++
#40As a side note, when looking up [1] I also ran across [2].
[1] http://piumarta.com/software/cola/ [2] http://www.acm.uiuc.edu/sigops/roll_your_own/1.helloworld.ht...