Spring 2010

# OS Tutorial

After looking at a few courses, it seems like most OS courses are one of two types: they're either designed for students who have taken a hardcore systems class, or they are not. As I've taken half of a hardcore systems class, I'd like to design a tutorial that combines the two.
I plan to build this tutorial around three courses and material from Tanenbaum's Operating Systems Design and Implementation, probably falling back to Bryant's Computer Systems: A Programmer's Perspective when needed. The three that seem most useful are RPI's CSC-4210, UIUC's CS423, and UCSB's CS170.
After glancing at some of the exercises in Tanenbaum, it looks like I'm going to want to use it for some smaller, mostly non-programming questions each week, and then do a couple of larger programming projects taken from the above courses. Most of the programming assignments from the courses seem to be built on exercises in Tanenbaum anyway, but they are given more discussion as assignments than in the textbook.

## Feb 11

Still not finished with Chapter 2 of Tanenbaum. Project for next week will be pretty close to http://www.cs.ucsb.edu/~chris/teaching/cs170/projects/proj1.html. I may try to find and use existing code for parsing as I don't fancy writing string parsing stuff in C.
Nice: After writing a program and trying it, I bothered to read
man(renice)
and discovered  BUGS Non super-users can not increase scheduling priorities of their own processes, even if they were the ones that decreased the priorities in the first place. 
Things to look at in class:
SMP CPU schedulers
Linux CPU scheduling in general

## Feb 18

Not finished with Chapter 2, but did finish with shell.

## Feb 25

• snow. lots of thick heavy snow.
• And minix. lots of thick heavy ... never mind.
• pg 219, number 45 : modify the minix 3 scheduler to keep track of how much cpu time each user process has had recently.
• also pg 219, baboon signaling

## April 1

Had fun attempting to modify the minix scheduler. The minix source available on the web site is from version 3.1.1; this is (naturally) neither the current version nor the version that came with the book. It is possible to get the current source, but one has to either download it through SVN or download the entire Minix ISO and then get the source from it. Fortunately, although the current version is fairly different from 3.1.1, the scheduler function wasn't really changed. I added a few lines to that function, one line to the .h file that defined the process table, and a line or two to one of the debugging functions so it would print the additional information. On the plus side, adding the code was pretty easy. Recompiling minix itself was also surprisingly easy--it just took one "make world" and a reboot. However, while I think the code that I added worked, screwing with the debugging function messed with its print layout so it's kinda tricky to read. I'll try playing with the print code so it lines up again and seeing it it becomes clearer.

## Apri1 8

Added below to servers/is/dmp_kernel.c in the proctab_dmp function.
Errors when compiling with 409: * not expected 411: newline in string 412: "identifier not expected   FILE* outfile; outfile = fopen("/root/runtimes.txt", "a+"); fprintf(outfile, "Program running for %d quanta (%d ticks).\n", rp->p_runtime, rp->p_runtime_quanta); fclose(outfile); printf("Runtime written to ~/runtimes.txt\n"); printf("\n"); 
Added to kernel/proc.c, in the sched function, in the if (! time_left) statement.  if (!time_left){ rp->p_runtime = rp->p_runtime + rp->p_quantum_size; rp->p_runtime_quanta++; } 
Added to kernel/proc.h, in the struct proc definition:  int p_runtime; /*Time the process has been running, in ticks*/ int p_runtime_quanta; /*Time the process has been running, in quanta.*/ 

## April 15

• figured out how to boot into different images ; details are in my minix notes.
• started talking about the "files" chapter, chapter 5 in the text. (I need to read that.)

## April 22

and today we're talking about file systems, which is one of the worse chapters in Tanenbaum, really.

## April 29

Did some looking into the Minix filesystem and possible benchmark methods. I'd prefer doing it from within the Linux kernel as Linux has real benchmarking tools, something that Minix seems to entirely lack. It does seem possible to mount Minix filesystems from within Linux, and even create them (see http://www.topology.org/linux/minix.html ), but it does not seem possible to set the block size of a created filesystem outside of the the Minix environment. Also glanced at the I/O chapter of Tanenbaum; I think that he made a pretty definite divide between I/O and filesystem stuff, and for the purposes of what we're doing now the FS chapter would better serve.

## Project

actually, probably better to put this all on its own page.
http://cs.marlboro.edu/ courses/ spring2010/jims_tutorials/ richard/ OS_Tutorial