Live data from Hacker News

After 5 days, my OS doesn't crash when I press a key

jvns.ca

81–90 of 90 posts

Re: After 5 days, my OS doesn't crash when I press a key

#81

How do OS developers typically debug this sort of thing? Do they attach external hardware to step through, or is it serial logging?

I found a race condition in the Linux kernel once (0.8x days) that was partially triggered due to an off brand 80387 (FPU) chip using the ibm-pc speaker hardware.

The cycle was: 1) insert ioout to turn on speaker at code line X; 2) compile kernel 3) cause lockup 4) is speaker on or off? 4a) on, move ioout to a later code section; 4b) off, move ioout to an earlier code section;

Essentially, a binary type search through the code, using the on/off state of the speaker hardware to narrow the search. Turned out a lock needed to be one line later in ll_read_write_page.c (if I remember that file name correctly).

So, the answer to "how do you debug" is: "with anything you can make use of".

Re: After 5 days, my OS doesn't crash when I press a key

#82
post #56

> This continues for 2 days This thing made me scoff at the article the most. I've written a unix-like OS for ARM 2 years ago as a final project for an OS class I took on campus. There were 20 other people in the class, and all of us forgot to update the IDT at some point. It was a common mistake, so for this article to emphasize it like it's some bug that takes 2 days is just lame. Imagine if my blog post would talk…

> like it's some bug that takes 2 days is just lame. Unless she was spending full time on it, it was not some bug that takes 2 days. At the same time: If you've never come across some trivial, stupid little bug that has left you stumped for far longer than it should have, you're either superhuman (or have selective memory), or you're a total beginner. Your dismissive tone is really offputting.

  > THE OS IS STILL CRASHING WHEN I PRESS A KEY. This continues for 2 days.
In case you didn't read the article.

Re: After 5 days, my OS doesn't crash when I press a key

#83
post #66

Back in the day when I was playing around with osdev, I ran my code in the Bochs emulator. WAY easier than running on actual hardware, especially starting the emulator was 10x faster then booting on an actual PC. I do remember the excitement of getting interrupts to work - good times. Getting task switching to work was magic.

She mentions in the article that she's using Qemu.

Ah - I missed that.

True emulators like Bochs are still potentially a win if they provide fine-grained debugging features. Bochs was nice because you could single-step through assembly and view contents of registers/memory quite easily. You could also attach gdb to it (although this was somewhat flaky.)

Re: After 5 days, my OS doesn't crash when I press a key

#84

I've never done OS programming, but something about this just tickles me. I think it's the way she cheerfully acknowledges screwing up constantly but still gamely keeps tackling the problem. To admit your mistakes without shame, and try again without bitterness--to lose your ego, in other words--is something I certainly aspire to, as a programmer and a human being.

In a context where everything "low-level" is handed to us without a "how-to", looking under the hood to build your own thing is always a pleasure, be it a new programming language or a whole OS.

To attain this state of zen-itude, just look up something that you'd like to do where documentation is hard to come by ("how to write your own shell from scratch" is a funny one if you can want to learn a LOT about UNIX) and start your own project.

Related: とあるOS is a nice hobby OS too: https://github.com/klange/toaruos

Re: After 5 days, my OS doesn't crash when I press a key

#85

> This continues for 2 days This thing made me scoff at the article the most. I've written a unix-like OS for ARM 2 years ago as a final project for an OS class I took on campus. There were 20 other people in the class, and all of us forgot to update the IDT at some point. It was a common mistake, so for this article to emphasize it like it's some bug that takes 2 days is just lame. Imagine if my blog post would talk…

Earlier in this thread, I said that shamelessly admitting your mistakes is a virtue. People like you are the reason it's such a difficult virtue to cultivate.

The lesson conveyed in your post is "if something is hard for you, keep your mouth shut about it, or someone will laugh at you." That is a fucking terrible lesson and it needs to be stamped out and destroyed. I'm still trying to unlearn it.

Re: After 5 days, my OS doesn't crash when I press a key

#86
post #45
post #22

Earlier quoted context omitted.

Is the gender of said author supposed to be curious or worthy of attention? I'm not intending to be impolite, but this is the third time in several days that HN posters have brusquely corrected a gender pronoun in relation to a submission of nondescript importance.

>Is the gender of said author supposed to be curious or worthy of attention? It shouldn't be. There are two things going on here: * Perception of our industry as all-male biases women against joining * Default use of 'He' exacerbates this by unsubtly signalling that our community is all-male So why flag female hackers? * To try to combat the perception of us being an all-male community (we're not) * To signal to wome…

A (female) instructor in charge of the tutorial of the Foundations of Computer Science lecture (forprospective Computer Scientists) was also responsible for the tutorials for prospective media scholars of Foundations of Computer Science (they had to hear the same lecture, but had easier tutorials and an easier exam about it).

When in the tutorial by accident she called a woman by "he", she told that in doubt in the tutorial for Computer Scientists she calls people by "he" and in the tutorial for media scholars by "she", since because of the gender ratios of these courses of studies this behaviour maximizes her likelihood to be correct.

Re: After 5 days, my OS doesn't crash when I press a key

#87

> This continues for 2 days This thing made me scoff at the article the most. I've written a unix-like OS for ARM 2 years ago as a final project for an OS class I took on campus. There were 20 other people in the class, and all of us forgot to update the IDT at some point. It was a common mistake, so for this article to emphasize it like it's some bug that takes 2 days is just lame. Imagine if my blog post would talk…

Earlier in this thread, I said that shamelessly admitting your mistakes is a virtue. People like you are the reason it's such a difficult virtue to cultivate. The lesson conveyed in your post is "if something is hard for you, keep your mouth shut about it, or someone will laugh at you." That is a fucking terrible lesson and it needs to be stamped out and destroyed. I'm still trying to unlearn it.

I'm not saying that having a bug is something to be ashamed of. I am pointing out that the page is making a big deal out of a small issue, in order to argue a bigger point: operating system development is hard. The whole page screams with: "look how hard this is!".

The lesson conveyed in my post should be that this author is making it look harder than it actually is, and if you want to write an OS, you shouldn't feel like it's an unsurmountable task. But by all means, stamp and destroy it.

Re: After 5 days, my OS doesn't crash when I press a key

#88

Earlier quoted context omitted.

What she's doing is surprisingly a lot harder. Getting a modern IA-32(e) architecture into the 64 bit mode we all know and love is INSANE.

I'm not going to argue on 'harder' or 'not as hard' as such things are often personal measures that are difficult to quantify. I will however point out the meta fallacy of even thinking about these things in terms of 'not hard.' The truth is, computers have become exceptionally complex. That is one of the reasons I've been building a medium complexity standalone system (ARM Cortex M based) to give folks something tha…

I was actually just pointing out the irony that 30 years of processor innovation have lead to making the task of booting even more complicated than it used to be ;)

(Note: I understand why, that doesn't make it less ironic.)

Re: After 5 days, my OS doesn't crash when I press a key

#89
post #54
post #53

I really wanted to not sound like an asshole and start critizicing this because I like low-level programming articles but this article is confunsing: 1) You don't need an OS to press keys and make them come out in the screen. An OS is kind of a library that an application uses to do things. 2) I believe what the article refers as "OS" is a small process manager. I don't know if it's preemptive, no mention of timer of…

It's not a process manager because there are no processes. And how do you get keypresses to come up on the screen with no OS?

The same way the BIOS makes keypresses come up on the screen with no OS. You don't need an OS to do things in a computer.

Re: After 5 days, my OS doesn't crash when I press a key

#90
post #55
post #53

I really wanted to not sound like an asshole and start critizicing this because I like low-level programming articles but this article is confunsing: 1) You don't need an OS to press keys and make them come out in the screen. An OS is kind of a library that an application uses to do things. 2) I believe what the article refers as "OS" is a small process manager. I don't know if it's preemptive, no mention of timer of…

You can call it a ring-0 application if wish to argue about semantics or the definition of an OS but you really do end up sounding like an asshole. Every OS projects starts out as a "ring 0 application" running on bare metal. An application which does nothing except handle interrupts and spew out numbers on the screen to tell that it is working. And most OS projects never really evolve a lot past that, because they a…

It is not an OS, and telling things that are not true is not educational is delusional. If you people want to remain ignorant and believe things that are not true, be my guest.
Post reply on HN