By David Kim, Sina Siar, and Sheng Cheng
http://www.read.cs.ucla.edu/111
Eddie Kohler kohler@cs.ucla.edu
OH: Monday 4-5pm, Tuesday 11-12pm; Boelter Hall 4531
Jacob Lacouture jacobl@ucla.edu
Jon Salehpour jsalehpo@ucla.edu
Linux Lab: Boelter Hall 4405
Linux Users Group. For more details about Fall Install fest please go to http://linux.ucla.edu
The job of operating system is to provide computer software applications with an abstract machine.
It abstracts and virtualizes all of a computer’s resources (including I/O devices, memory, and CPU time) by permitting the use of the same hardware at once by many applications.
| Applications |
| Abstract Machine Interface |
| OS kernel |
This class is about INTERFACES. Every program uses operating system facilities or is an operating system. Problems in the operating system's abstract machine interface can affect every program using that operating system. Improvements in the operating system interface can make every program using that operating system better. The abstract machine provided by the operating system is the most important interface in computer software. The abstract machine interface makes systems engineering challenges clear, concrete, and easy to understand.
What can go wrong with a bad interface? An example of a bad interface is when one program could overwrite other programs' memory (memory protection).

Blue screen of death of an example of a OS not having proper memory protection.
What makes a good interface good?
The abstract machine interface is one of the great ideas in computer science.
Interfaces and implementations are tightly bounded. Operating systems demonstrate the challenges involved in implementing a good interface. The distance from a processor's instruction set to an abstract machine interface is vast.
/*This code would loop forever, and the job of OS is to actually stop a process that is monopolizing resources.*/ while(1){ //do nothing }
Property of a system that only shows up in a whole system and not in the individual components
/*Case 1: The following get_pwd prototype violets our first goal. Since it provide an interface for untrusted program to access Alice's password*/ const char * get_pwd(const char * user)
/*Case 2: The following prototype return 1 if password matches, otherwise, return 0 */ int pwd_check(const char * username, const char * password) // -> 1 if password match // -> 2 if password doesn't match /*By itself it is a good interface*/
Now consider a system as a whole where some memory is off limits (memory protection), then case 2 will not be a good interface. If the application does not own the memory, it cannot touch it; if it does the OS kills the application.
/* Case 3: If application touches bad memory, kill it. */ int pwd_check(const char * username, const char * password) { const char * real_password = password_for_user; //return strcmp (real_pwd, pwd) == 0; this would crash the entire program. //We need an alternative solution: while ( * real_password) { if( //password is a bad address ) kill the process ; else if (* real_password != * password) return 0; else real_password++; password++; }// Compare the lengths of real_pwd and pwd }
Evil program can find the password by iterating through all characters one by one until the process is killed. Then program repeats for each following character.
Small changes to one component of a system often ends up affecting the entire system as a whole.
EX. Networking affects the file API: If a disk being run on the local machine is broken an error message is received when trying to communicate with the disk; if the disk is being accessed over a network from another computer and the line is broken then no error message is received since communication never occurred with the disk.
Not all parts of a system follow the same scaling rules, therefore a system increasing in size or speed may stop working. For example,
Some system goals directly conflict and the system must balance these competing requirements; typically a trade-off between robustness vs. performance.
For example, spam filtering is a trade-off between not getting any spam e-mails along with possibility of not receiving "non-spam" e-mails.