I’m so tickled to have completed an assignment for my Linux kernel class. The specification was as follows:
Modify the algorithm that allocates a file descriptor for the
socket()calls. Implement a per-process variable
availableFileDescriptorwhose value is always the number of the first available file descriptor. Make sure that when a process closes a file descriptor and/or a socket,
availableFileDescriptoris properly updated. Use your driver harness to compare the performance of your modified kernel with the original kernel, both for situations in which the original algorithm should work fast and situations in which the original algorithm should not work fast. You might want to remove the restrictions in the kernel on the
I banged around on that thing for almost two weeks, variously getting a modified kernel that would:
- segfault immediately
- fail to reach the login prompt and just kind of hang out, or
- reach the login prompt but fail to allow me to log in.
Turned out one of my main problems was that the sorting function I was using, an implementation of merge sort that I had found posted on a Linux kernel mailing list, was eating my nodes instead of just sorting them. It would delete one at a time in a sneaky fashion. I thought I had checked the thing, and who knows, maybe it worked it at first and then I changed something that caused it to grow an appetite for my
struct type. At any rate, I replaced the function with my own implementation of selection sort since it was quick and easy to implement. Upon doing that, things started to behave as I expected, and it was a short road to getting my modified kernel to work properly then.
Poor Jon was sick this past weekend and so he did a lot of sleeping and sniffling. This actually worked out okay for me because, while he slept, I worked on my Linux project. He still has to go to work this week, which sucks for him, and his job is in Cincinnati, which sucks even more because of the traffic. I’m hoping he’ll be well by this weekend so he’ll be back to his usual self, plus the two of us could then go to Carly’s birthday party.