How do CPUs access I/O? In the old days, CPUs had instructions specifically to handle I/O. Now, the preferred method is to have portions of the address space correspond to the devices. The CPU just reads and writes to this "memory", but these reads and writes may actually be interpreted by the device to mean commands. The CPU doesn't need to be aware of the details - other pieces of code called device drivers handle all of the internals about what the meanings of these memory locations are. Is the bus really a wire? Conceptually, it looks like a set of wires in parallel, and this is what causes the limits on bus size and speed. The lower-level details are pretty complicated, so at a high level, it's useful to think of it as a set of shared wires. What directions do stack and heap grow? It's system dependent, but basically they grow in opposite directions. As long as they start at opposite ends of the address range and grow toward each other, this gives us the maximum flexibility on their sizes. What's a trap and what is its relation to a system call? A trap is another name for a software interrupt. It's generated by program instructions, and in the case of the system call, it's a way for the program to tell the hardware and OS that it wants to execute a system call. Why don't we add devices in serial to reduce capacitance? Some high-speed systems do use serial (point-to-point) connections to achieve higher speeds. In fact, that's the way lots of devices look like they'll be going in the future (see www.serialata.org for example) Explain the device memory thing again Basically, when the CPU issues a memory read/write, normally, this will go through the chipset to the main memory. There, the appropriate value will be read/written from what logically looks like a big array of bits. In the case of devices, that memory read/write is sent to the appropriate device that "owns" that portion of the address range, and it's up to the device to decide what to do in response. It may be something as simple as store the value in its own memory (say a video card), or it might be something like start spinning the disk drive. Note that simply because a device "owns" part of the address range, it doesn't actually own any of the system's memory. It may provide its own memory in that range, or it may just be using that range to control different behaviors, without any real memory associated with it. How different is the x86 from MIPS/Sparc? At some level, they're all comparable. The details, like the number of registers, their names, what instructions can use what registers, etc., differ. Can we have an organized stretch in the middle of class? Sure. Someone raise a hand and ask for it Explain *result and &result Basically, when you say "int result", what you're saying is that there should be an integer's worth of space allocated, and you'll be reading/writing this as an integer. When you then call a function like func1(&result), you're passing a pointer to that location, and when the function says "*ptr = x", it's saying "store the integer x into the location pointed to by pointer ptr". When you say "int *result", you're saying "allocate a pointer's worth of space, and this pointer will point to an integer". You're not saying where that pointer is currently pointing. It could be pointing to nothing at all. When you pass that variable, you're passing it's value, so you're telling the other function where it points to. Said another way, the following code sequence int X; FunctionCall(&x); is equivalent to int X; int *ptr_to_x = &x; FunctionCall(ptr_to_x); Can you change the value of a pointer if you declare it Func(int *result)? Yes and no - you can change the value of the local parameter, but that's only being used within the function. You can also change the value at the address being pointed to by "result". However, to see why you can't change the value from the caller, consider the following example. The following code sequence int a[2]; int *b = &a[0]; b++; FuncCall(b); is equivalent to int a[2]; int *b = &a[0]; FuncCall(b+1); b++; In the second case, the value "b+1" is being evaluated, so it should be clear that anything you do within the function FuncCall can't change b itself. Function calls in C are known as "pass by value" rather than "pass by reference" - the local parameters are copies, not the original. Why does fread make fewer system calls than a programmer might? If a programmer is calling read() asking for one byte at a time, that's a lot of system calls. The fread() library call actually goes ahead and reads a large chunk at a time when calling read(), so if programmers are doing small fread() calls, they are library calls and not system calls. What exactly are libraries? Libraries are basically sets of functions that have already been compiled and are being provided in a special way. If you wanted to, you could take a C file without a main() function, compile it, take the resulting ".o" file, and run it through a process to make it a library. Then, when you want to include those functions in another program, you could specify that library to the compiler (actually, the linker), and use them as if they'd been compiled at the same time as the rest of the program.