Operating Systems

2000-2001 Fall
Tues Thurs 5-6:50
Ciww 109

Chapter -1: Administrivia

I start at -1 so that when we get to chapter 1, the numbering will agree with the text.

(-1).1: Contact Information

(-1).2: Course Web Page

There is a web site for the course. You can find it from my home page, which is http://allan.ultra.nyu.edu/~gottlieb

(-1).3: Textbook

The course text is Tanenbaum, "Modern Operating Systems", 2nd Edition

(-1).4: Computer Accounts and Mailman Mailing List

(-1).5: Grades

Assuming 3 labs, which is likely, grades will computed as
.3*LabAverage + .7*FinalExam (but see homeworks below).

(-1).6: Homeworks and Labs

I make a distinction between homeworks and labs.

Labs are

Homeworks are

(-1).6.1: Doing Labs on non-NYU Systems

You may solve lab assignments on any system you wish, but ...

(-1).6.2: Obtaining Help with the Labs

Good methods for obtaining help include

  1. Asking me during office hours (see web page for my hours).
  2. Asking the mailing list.
  3. Asking another student, but ...
    Your lab must be your own.
    That is, each student must submit a unique lab. Naturally changing comments, variable names, etc does not produce a unique lab

(-1).7: The Upper Left Board

I use the upper left board for lab/homework assignments and announcements. I should never erase that board. View as a file it is group readable (the group is those in the room), appendable by just me, and (re-)writable by no one. If you see me start to erase an announcement, let me know.

(-1).8: A Grade of ``Incomplete''

It is university policy that a student's request for an incomplete be granted only in exceptional circumstances and only if applied for in advance. Naturally, the application must be before the final exam.

Chapter 0: Interlude on Linkers

Originally called a linkage editor by IBM.

A linker is an example of a utility program included with an operating system distribution. Like a compiler, the linker is not part of the operating system per se, i.e. it does not run in supervisor mode. Unlike a compiler it is OS dependent (what object/load file format is used) and is not (normally) language dependent.

0.1: What does a Linker Do?

Link of course.

When the compiler and assembler have finished processing a module, they produce an object module that is almost runnable. There are two remaining tasks to be accomplished for the object module to be runnable. Both are involved with linking (that word, again) together multiple object modules. The tasks are relocating relative addresses and resolving external references.

0.1.1: Relocating Relative Addresses


0.1.2: Resolving External Reverences


The output of a linker is called a load module because it is now ready to be loaded and run.

To see how a linker works lets consider the following example, which is the first dataset from lab #1. The description in lab1 is more detailed.

The target machine is word addressable and has a memory of 250 words, each consisting of 4 decimal digits. The first (leftmost) digit is the opcode and the remaining three digits form an address.

Each object module contains three parts, a definition list, the program text itself, and a use list. Each definition is a pair (sym, loc). Each use is a pair (sym, loc). The address in loc points to the next use or is 888 to end the chain.

The program text consists of a count N followed by N pairs (type, word), where word is a 4-digit instruction described above and type is a single character indicating if the address in the word is Immediate, Absolute, Relative, or External.

Input set #1

1 xy 2
5 R 1004  I 5678  E 2777  R 8002  E 7002
1 z 4
0
6 R 8001  E 1777  E 1001  E 3002  R 1002  A 1010
1 z 3
0
2 R 5001  E 4777
1 z 1
1 z 2
3 A 8000  E 1777  E 2001
1 xy 2

The first pass simply produces the symbol table giving the values for xy and z (2 and 15 respectively). The second pass does the real work (using the values in the symbol table).

(Unofficial) Remark: It is faster (less I/O) to do a one pass approach, but is harder since you need ``fix-up code'' whenever a use occurs in a module that precedes the module with the definition.

            Symbol Table
                xy=2
                z=15

               Memory Map
 +0
 0:       R 1004      1004+0 = 1004
 1:       I 5678               5678
 2: xy:   E 2777 ->z           2015
 3:       R 8002      8002+0 = 8002
 4: ->z   E 7002               7015
 +5    
 0        R 8001      8001+5 = 8006
 1        E 1777 ->z           1015
 2        E 1001 ->z           1015
 3 ->z    E 3002               3015
 4        R 1002      1002+5 = 1007
 5        A 1010               1010
 +11    
 0        R 5001      5001+11= 5012
 1 ->z    E 4777               4015
 +13    
 0        A 8000               8000
 1        E 1777 ->xy          1002
 2 z:->xy E 2001               2002

The linker on unix is mistakenly called ld (for loader), which is unfortunate since it links but does not load.

Lab #1: Implement a linker. The specific assignment is detailed on the sheet handed out in in class and is due 27 September. The content of the handout is available on the web as well (see the class home page).

End of Interlude on Linkers

Chapter 1: Introduction

Homework: Read Chapter 1 (Introduction)

Levels of abstraction (virtual machines)

1.1: What is an operating system?

The kernel itself raises the level of abstraction and hides details. For example a user (of the kernel) can write to a file (a concept not present in hardware) and ignore whether the file resides on a floppy, a CD-ROM, or a hard magnetic disk

The kernel is a resource manager (so users don't conflict).

How is an OS fundamentally different from a compiler (say)?

Answer: Concurrency! Per Brinch Hansen in Operating Systems Principles (Prentice Hall, 1973) writes.

The main difficulty of multiprogramming is that concurrent activities can interact in a time-dependent manner, which makes it practically impossibly to locate programming errors by systematic testing. Perhaps, more than anything else, this explains the difficulty of making operating systems reliable.
Homework: 1. (unless otherwise stated, problems numbers are from the end of the chapter in Tanenbaum.)

1.2 History of Operating Systems

  1. Single user (no OS).

  2. Batch, uniprogrammed, run to completion.
  3. Multiprogrammed
  4. Personal Computers