Live data from Hacker News

Thor – A minimalistic operating system in assembly and C++

github.com

111–120 of 152 posts

Re: Thor – A minimalistic operating system in assembly and C++

#111
post #106

Earlier quoted context omitted.

> C is the first language that both stayed out of your way and also provided reasonable productivity features If we ignore the history of computers outside AT&T....

Example? Standard language that never required a trip to assembly language for system level programming? On IBM's, PL/I didn't cut it that regard. On a UNIVAC you could do a lot of system programming in FORTRAN, but only because there were a zillion proprietary extensions that accessed system programming primitives. BASIC on a Commodore 64 had PEEK() and POKE() but that doesn't count either, very non-standard. FORTH?…

> On a UNIVAC you could do a lot of system programming in FORTRAN, but only because there were a zillion proprietary extensions that accessed system programming primitives.

Just like pure ANSI C without compiler extensions.

> Standard language that never required a trip to assembly language for system level programming?

Try to implement 100% of libc in ANSI C without writing one single line of Assembly, syscalls into the underlying OS or compiler specific language extensions.

> Show me the source code for a device driver in a high-level language that pre-dates C/B/BCPL.

ESPOL on Burroughs B5000, 1961.

Re: Thor – A minimalistic operating system in assembly and C++

#112
post #3

An OS in C++? But Linus said... http://harmful.cat-v.org/software/c++/linus

Well, when St. Linus Torvalds said those words, (1) g++ was not as good as many other C++ compilers, (2) the world was still full of very bad examples of C++: if you were lucky, back in those days you could have found some projects using C++03 but the majority were stuck to C++98 -- or worse -- and, (3) he called out the holy principle that "at my place, I make the rules". I do not think that in 2016 there are good reasons not to use C++ for an operating system. Even without using the STL -- which would require custom allocators at that level -- incapsulation of data inside objects, inheritance, templates and namespaces alone are a reasons good enough for me to prefer C++ over C at any time nowadays. In 2016, that is more a cargo cult not to use C++ for operating systems implementation than anything else.

Re: Thor – A minimalistic operating system in assembly and C++

#113
post #5
post #3

An OS in C++? But Linus said... http://harmful.cat-v.org/software/c++/linus

I agree 100% with Linus, especially the boost comment. It was heavily used in a project I worked on and "boost" soon became a curse word.

You should not really judge a tool by the bad use the people make of it. Hammers are perfectly fine with nail but they are horrible at cutting bread

Re: Thor – A minimalistic operating system in assembly and C++

#114

Earlier quoted context omitted.

Oh gotcha... I interpreted Linus's comment about archs. Boost is supported on far less archs than the Linux kernel is: http://www.boost.org/doc/libs/master/libs/context/doc/html/c...

Note that that's the supported architectures, i.e. those that are routinely tested. 99% of boost in architecture/machine independent and will work anywhere that has a standard compliant compiler.

Sure. Obviously all of this depends if the context is git or the kernel. But Linus (in context of the kernel) cares more about the 1% than the average person, for things like atomics, mutexes, etc.

Re: Thor – A minimalistic operating system in assembly and C++

#115
post #98

Earlier quoted context omitted.

I'm the maintainer of a proprietary C++14 RTOS for work. What do you want to know?

I'm not OP, but I'm interested in the fact that you specified C++14. Are there any features specific to C++14 that you use? I have about two university classes worth of experience with low-level software, but I can really only see the deprecation attribute and binary literals being useful? All of the other language additions (added support for type deduction, templates, lambdas, and the mixing of all three to various…

We switched from C++11 to C++14 mainly for constexpr (it existed in 11, but had a lot of restrictions that limited it's usefulness).

The advanced template techniques (and to a degree, I'm throwing type deduction in there too), when treated skeptically do lead to more efficient code. It's easy to go off the deep end though, which is why I said "when treated skeptically". As for lambdas, we have an entirely asynchronous OS, so they're really nice for callback glue.

EDIT: Binary literals actually come up way less than you'd think, even for deeply embedded (I think the smallest thing we ship on currently is 16KB of RAM). Everyone here knows hex like the back of their hand.

Re: Thor – A minimalistic operating system in assembly and C++

#116
post #72

Earlier quoted context omitted.

> Damn, we don't know could the browser engine written in Rust work or not, despite the fact writing a browser engine was the goal of Rust from the day one. We kind of do at this point. It renders reasonably well, faster on some workloads than existing browsers. The majority of work still to do involves chasing down rendering bugs, and building a shell around it. That's a lot of work , but it's the sort of work that…

Kind of , indeed. Last time I've seen comparison of html5ever with plain C HTML parser, we suddenly realized it is painfully slow, 'uses the proof-of-concept DOM' and whatnot[1]. So we don't know. We've yet to see anything written in Rust used in production environment, just anything. > Using LuaJIT as a network driver in some cases seems reasonable to me Why don't we see LuaJIT zealots in every thread on every board…

> we suddenly realized it is painfully slow, 'uses the proof-of-concept DOM' and whatnot

Err, no, you've misread that. html5ever serializes into an arbitrary datastructure, provided by the program using html5ever. It also ships with its own datastructure to serialize into for testing purposes (the "proof-of-concept DOM"), which Servo does not use. It's therefore not a benchmark of html5ever as used in Servo.

More reasonable would be benchmarking Firefox's HTML parsing as it stands in Firefox against Servo's HTML parsing, from text to a fully built up DOM as usable by the rest of the browser in both cases.

On the other hand, in some rendering benchmarks (once the DOM has loaded and the page is actually rendering), Servo is much, much faster than other browsers[0].

[0] https://www.phoronix.com/scan.php?page=news_item&px=Google-S...

Re: Thor – A minimalistic operating system in assembly and C++

#117

Earlier quoted context omitted.

At 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.

Ah. I was thinking something more like process isolation and device drivers.

If 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.

Re: Thor – A minimalistic operating system in assembly and C++

#118
post #104
post #79

Earlier quoted context omitted.

>>Sorry, but I take it personally when me and my colleagues are called substandard programmers. I don't know what kind of programming you do, but he is talking mainly about kernel programming. He is mainly criticizing the people who want to bring C++ in the kernel world. Anyone is welcome to prove him wrong. But I think, C++ is more suited for applications programming, where efficiency is not a prime concern and abst…

> Anyone is welcome to prove him wrong. Apple and Microsoft already did.

Please provide some links.

Re: Thor – A minimalistic operating system in assembly and C++

#119

And 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.

That 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 :)

Re: Thor – A minimalistic operating system in assembly and C++

#120

Earlier quoted context omitted.

At 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.

Ah. I was thinking something more like process isolation and device drivers.

It'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.
Post reply on HN