OS

Last night I was up coding until 7 AM. A lot of the time was spent fixing compiler errors, and then tracking down a bug caused by using the wrong variable in one place, causing page table entries to get overridden… causing problems later.

Today, it was my turn to have a huge bug in my code, and mine was a conceptual error (although, to be fair, it was one both of us missed).
We decided to start the first two tasks for the kernel by writing a kernelland fork function, which works much like the user version. The user version copies over all of memory except for kernel memory, creating a new kernel stack for the child and putting only the necessary stuff on there (IRET foo and registers).
I did the same thing for the kernel version, except I don’t copy any memory (since there is nothing in userspace yet). I create a new kstack and copy over only the necessary values… the return address (to return to the previous calling function) and registers.

See the problem yet?

Turns out I forgot to take into account that execution in kernelland uses the kstack… and so maybe continuing execution in kernelland (as we do by using the same return address) would need things on the stack. As a result, we kept getting the strangest errors where memory was being overridden in various ways (since the function we return to expects certain things at esp+16, and expects ebp+4 to have arguments and such). So yeah. That bug took a good 3 hours to track down. Oops.

I had a Google interview today. I feel like I did well at the data structures/coding portion, but I completely bombed the algorithms part. It seriously makes me wonder how I managed to get an A in algo class. Or maybe I’ve just forgotten everything since then. Meh.

Whee… now it’s time to debug userspace exec and fork. Fun fun fun?

Edit: 5:30 AM. Looks like it’s going to be another all-nighter. We really should start working more earlier in the week so we’re not stuck doing a bunch of stuff the night of the deadline.

Edit edit: 6 AM and fork works! Huzzah. Turns out the problem wasn’t at all in my code (which was surprisingly, given the complexity of the mapping of multiple physical pages into and out of a virtual address space, correct the first time) but rather with the TLB keeping around “stale” entries. Oops. Now let’s get exec working (and maybe bed after that).

Edit edit edit: 9 AM. Mission failed. We didn’t manage to get exec working (although it now does return to userland and run for a bit, albeit incorrectly, before being context-switched away and page faulting on its next run). Hopefully we’ll have it done today.

OS!

Well, I’ve been coding and working on our kernel since approximately 10 AM yesterday (Sunday). The first checkpoint is in 5 hours, and I think we’re going to make it. Maybe.
Both of us are slowing down quite a bit (it took us like 6 hours to even get our code to compile, since we had compiler errors like hell, and then had a ton of linker errors because we forgot various includes, and by that point it was like 2 AM), but the debugging portion shouldn’t be too terribly deathy. In any case, we are quite code complete for checkpoint 1 (and even a little ahead, maybe, in the sense that we wrote our VM to be somewhat correct instead of just hacking it).

Yay for all-nighters!

Greg has been amazing through the past many hours, making breakfast and then dinner for both me and 8, and then bringing me caffeine so I don’t fall asleep.

Perhaps as a consequence of our 17-hour-straight coding spree, and as our last shreds of sanity fled, there was a break for some Zack bondage, and then some 8 bondage, both with Cat5 cable. There are photos, which will likely be posted behind a friends-locked entry behind a cut on my LJ sometime logical tomorrow (although, I suppose, it’s logical today if I never actually get to sleep).

Wheeee….
The next few days are going to be very interesting.
Pamela’s for delicious breakfast tomorrow morning followed by OS checkpoint followed by (probably) more OS coding. Then is going to bed early, since I have to wake up at around 6 AM on Tuesday to catch a plane to another interview in California.

Edit: It works! We made the checkpoint with an hour to spare. Huzzah! Now to do other stuff, because I’ve been coding for the past 23.5 hours.

Posted in OS

Stuff

The best word to describe the trip would be “frustrating”, even though the interview and the evening afterward were very, very nice.

It started out with a plane ride on Thursday afternoon that meant I missed Pen-based computing class. Not a big deal, but in general it got me stressed about OS and how I was really worried about getting to the checkpoint and whatnot. (See last entry for full angst-ness.)
The flight was long… I hate flying… I hate layovers. The plane arrived in California late, so I didn’t get to the hotel and to bed until around midnight, which would be 3 AM Pittsburgh time.
Woke up to rain the next morning… lots of rain… and I hadn’t brought an umbrella, so I got really wet on the way to the interview. About halfway there, I get a call that the tour (the first part of the interview) was cancelled because of the rain, so I went back to the hotel for a couple hours…

Headed back (in the rain), and things went better after that.
The interview itself was good… afterward was an amazing dinner and going to a bar with the other interviewees and two employees.

The next day was all flights… two layovers, meaning I spent something like 13 hours in planes and/or in airports. Didn’t get home until around 10 PM. Meh.

Now is lots of OSing. We basically had nothing written for Checkpoint 1 (which is tomorrow), so today is lots of coding and oh god death. Meh.
We might end up missing the checkpoint anyway, but that’s okay… as long as we don’t miss the second checkpoint.
Unfortunately, I am also gone next Tuesday and Wednesday (for another interview).
Blar.
I want OS to go away so I can just do interviewing and enjoying life before I head off into the world… :-\

Flying, OSing

I am sitting in the airport. In about an hour I will be in an airplane heading toward California. I will be gone until Saturday evening.
My flight doesn’t get in until around 11 PM California time, which makes it 1 AM Pittsburgh time.
My flight leaves really early on Saturday, meaning I have to get up at 4 AM to make it.
I’m sitting here trying not to think about that.

In the meantime, I am trying to write some kernel code. I made an attempt at a loader that probably does none of the things it’s supposed to. I can’t help but feel incredibly, incredibly lost as far as that class goes… I understand all the concepts and such, but when it comes to actually writing the code, I stare at my blank emacs window and can’t think of what the hell I’m supposed to write. That’s kinda the exact opposite of the thread library, in which I sat down and churned out pages of correct, functional code.

Also, I’m probably a really bad partner, as I’m leaving 8 to get us most of the way toward checkpoint 1 while I sit in luxury in California, staying in a nice hotel and talking to some awesome people who might give me a job. But, even given that, I can’t bring myself to actually get something done on the kernel.

Blar.

Today I guess I’ve just been feeling really out of it and/or lost. Perhaps it’s just my dislike of flying combined with my guilt as far as OS goes combined with my nervousness of interviewing… but I can’t help but feel like I don’t want all this. I don’t like flying around the US every week and, the entire time, worrying about the work I’m not doing and feeling like I just want to be at home, curled up and either sleeping or hacking at code with 8 there to give me guidance… because god knows I’m not smart enough to figure this stuff out myself.
I suppose this is a necessary part towards the entire “doing a job I enjoy” part of life, but it doesn’t make me feel any better about it. We either need to invent teleportation, or companies need to do interviews with teleconferencing, or I should only be applying to local Pittsburgh companies.

Meh.

Okay, that post was overly emo-riffic. Apologies.
But meh, it’s going to be a lonnngggg couple days.

Life, the universe, and thou

Life has been interesting lately.

The thread library was due Friday. Given that we had run largetest and successfully created and exitted and joined over 1.2 million threads, I think our library was fairly good. We did some comment and code cleanup on Friday and handed in on time.


Wean has entered the 410 zone.
What that means is that the kernel came out Friday… I’ve been studying the spec and going around writing pseudocode this weekend. I really feel like I should have gotten more done, but alas, such is a lazy weekend.

Next week is going to be death. Flight to California on Thursday, OS midterm on Tuesday, an in-Pittsburgh interview on Wednesday, and oh-god-lots-of-kernelling this weekend after I get back because checkpoint 1 is on Monday.

Car, Jeff, Tyler, Alan, and I experimented with chocolate bacon,

and chocolate-dipped salt-and-vinegar chips.

The former was interesting, the latter was vile.

There was more CS volleyball on Friday.
I think I’m getting better at anticipating action, because this set of photos came out better than previous times’.





In any case, I should sleep. Tomorrow is class, work (last day for a couple weeks), interview, kernelling, and studying for midterm. Ahhhh death!