Desire' Gashler Notes from 4-7-2003 Administrivia: DUE FOR NEXT WEEK: read the first 1-5 chapters in the class textbook (available online or at the bookstore if you ask at the information desk). There will also be problems from the book later in the class, so purchase it soon! Prof's Name: Brian Bershad Prof's Email: bershad@cs.washington.edu Prof's Office Hours: M 11:30-12:30 & Th 11:00-12:00 Project Weights 30% Final 20% MidTerm 1 20% MidTerm 2 (oral exam) 20% Homework 10% Participation -Participation grade is based on two things. 1) If the teacher knows your name by the end of the quarter 2) The completing of a notes page (like this one) Rules about note taking: You sign up to take notes on a certain day by emailing doug@cs. which days you would like to sign up for. The TAs will create a big spreadsheet and tell everyone when they will take notes. The preferred note format is plain text (like this document). If you would like to use HTML here are a list of acceptable tags. No others may be used without express written permission from the professor.

  •  
    If for some terrible reason you can not make it to take notes on the day that you are assigned to take notes, you had better mail the newsgroup and find a replacement or suffer the wrath of your fellow students. You will be graded on completeness of notes, and by whether or not they reflect a deeper understanding of the material presented in class. NOTES ARE DUE WITHIN 48 HOURS OF CLASS TIME, EMAIL THEM TO DOUG@CS. They will be posted with no proof-reading by the professor and be available to all students in the class. --------------------------------------------------------------------- WHAT IS THIS CLASS ABOUT? This class will be about how hardware and software work together or more specifically: The virtualization of hardware resources So what does that mean? Hardware means the disk/processor/memory and other devices. The resources are the components and structures like an ALU or registers that have well defined behavior. Hardware by itself can only understand a limited amount of information, it can add, subtract, store.. but what if we want the hardware to be able to do more complex instructions such as remind us that in three days we are going to have a pop quiz in our OS class? Well, in order to do this we need a whole set of higher level notions, such as time, the notion of a reminder, who are we reminding, what is a pop quiz ... We use Virtualization Software to extract a higher level of services out of the crummy hardware that we have to work with. This virtualization layer is called the Operating System. So, basically the OS is a pile of additional services added onto the crummy hardware to give us a specific view of the hardware resources. If we are working on a different OS, we will simply have a different pile of resources. VIRTUALIZED RESOURCES THAT WE WILL SPEAK ABOUT IN THIS CLASS Virtualization of Hardware resources first 8-9 weeks Processor 2-3 weeks Memory 2 weeks Storage 2 weeks Networks 3 weeks (or whatever is left at this time) Layout of the method of discussion: 1) We will talk about how the resources work Not in too much technical detail, just so that we have a more architectural, or abstracted view. 2) Some basic policies that people have decided are "acceptable" for the virtualization of that specific resource. 3) How these policies are implemented Bridging the gap from the hardware to the actual software --------------------------------------------------------------------- PROCESSORS: 1) Main components of a processor: ALU : Some piece of hardware, numbers go in and new ones pop out Register File : fast, named temporary storage CACHE : quick memory Instruction Decoder : Control logic for program, decodes instrs. Other stuff *exception handlers *interrupt handlers *OS owned Processor Status registers PROCESSOR EXCEPTIONS A processor exception is a spontaneous transfer of control from your program to another location in memory that goes on transparent to the programmer. This transfer is synchronous with the execution of the code, meaning that it is triggered by something in the code. Processor exceptions can be thought of as a function call into the OS that the programmer did not for-see and does not see. Spontaneity is the difference between a requested jump to some code, and one that the programmer did not directly make a request for. Processor exceptions are triggered when the instruction that the programmer is trying to execute is not contained in the Instruction Set of the Instruction Decoder. This causes execution of the program to halt spontaneously and transfer control to a program that lives in memory in at a location specified in a specific Processor Status Register devoted solely to holding the address of the exception handler. During a processor exception some state about the context before which the code "jumped" is maintained in the OS so that after the exception handling is done (if it gets done) the program can resume functioning at a later time. PROCESSOR INTERRUPTS: A processor interrupt is an asynchronous, spontaneous transfer of control from your program to another section of code. Processor interrupts are handled when a positive signal comes in on the INTERRUPT LINE that is connected with the processor. Control is transferred to a program that lives at a location specified in a processor status register devoted to the location of interrupt code memory. Processor interrupts are triggered by some external force, other than the program itself, it could be a keyboard press, a timer, a network packet has just arrived, someone has just moved the mouse, etc. The difference with the exceptions is that this doesn't have anything to do with the code that the programmer wrote, it is not synchronized with a specific instruction. In this instance, a context will be stored as well so that execution can be resumed at a later time. Processor interrupts are extremely useful because that pave the way for creating the effect of Multi-programming. Here is the scenario: one program is running, and will get allotted a specific amount of time to execute. When the time is up, a timer will go off, and the control will spontaneously transfer to any other waiting program. The OS is able to control the amount of time and the priority of each program this way, and successfully VIRTUALIZES a service for us. For example: If you have a section of code in which there is an infinite loop (while(TRUE); perhaps), it would be absolutely devastating if you always had to reboot your computer because your processor was locked up and could never be recovered! Fortunately the OS we use has a scheduled interrupter to the program that will switch control to any other waiting process, so when we kill the process, it will actually get the signal and be able to stop the run-away code. This appearance of running several programs at once is called "Multi-Programmed Scheduling" and will be the topic of the next lecture.