Linux lecture

32
COMS W4118 — Operating Systems I Prof. Steven M. Bellovin smb+4118@cs. . . http://www.cs.columbia.edu/˜smb Steven M. Bellovin January 18, 2006 1

description

Linux lecture

Transcript of Linux lecture

Page 1: Linux lecture

COMS W4118 — Operating Systems I

Prof. Steven M. Bellovin

smb+4118@cs. . .

http://www.cs.columbia.edu/˜smb

Steven M. Bellovin January 18, 2006 1

Page 2: Linux lecture

What’s an Operating System?

• Traditional definition: “traffic cop”

• Manage multiple streams; prevent interference

• Protect resources from unauthorized access or abuse

Steven M. Bellovin January 18, 2006 2

Page 3: Linux lecture

Resources

• CPU time

• Main memory

• Disk space

• I/O bandwidth

• Network bandwidth

Steven M. Bellovin January 18, 2006 3

Page 4: Linux lecture

Multiple Users

• Individual users of the system

• Specialized applications (web servers, print spoolers, etc)

• System components

Steven M. Bellovin January 18, 2006 4

Page 5: Linux lecture

Fairness

• Give each “user” a fair share of resources

• What’s a user?

• What’s fair?

Steven M. Bellovin January 18, 2006 5

Page 6: Linux lecture

Security

• Prevent users from gaining more than their fair share

• Prevent users from accessing resources they shouldn’t be able to

– Other users’ files

– Other user’s network traffic

– The operating system’s files and traffic

• But — security must be flexible. The OS must provide mechanismsthat can implement many different security policies

Steven M. Bellovin January 18, 2006 6

Page 7: Linux lecture

Structure of the Course

• Lectures

• Approximately five homework assignments, all with programming andnon-programming components

• Midterm, final

Steven M. Bellovin January 18, 2006 7

Page 8: Linux lecture

Prerequisites

• CSEE W3827 — Fundamentals of Computer Systems

– Understanding of computer system architecture

– Registers, cache, virtual memory, I/O, DMA, disks, etc

– Interrupts

– Basic knowledge of what assembler language is

• COMS W3157 or W3101

– Understand how to use “make”, the C compiler, etc.

• The C programming language

Steven M. Bellovin January 18, 2006 8

Page 9: Linux lecture

Grading

Midterm 20%Final 30%Homeworks 50%

Yes, I curve.

Steven M. Bellovin January 18, 2006 9

Page 10: Linux lecture

Textbooks

• Tanenbaum, Modern Operating Systems, 2nd Edition, Prentice-Hall,2001, ISBN 0-13-031358-0. (Required)

• Bovet and Desati, Understanding the Linux Kernel, 3rd Edition,O’Reilly, 2006, ISBN 0-596-00565-2. Note: get only the 3rd Edition,since it describes the Linux 2.6 kernel. (Required)

• Ritchie and Thompson, “The UNIX Time-Sharing System”,Communications of the ACM 17:7, July 1974.http://doi.acm.org/10.1145/361011.361061

• Optional reading: Organick, The Multics System; An Examination ofits Structure, MIT Press, 1972. On reserve in the Engineering library.Also see http://www.multicians.org

Steven M. Bellovin January 18, 2006 10

Page 11: Linux lecture

Logistics

• For grading issues, approach the TA within two weeks; if you don’treceive a satisfactory answer, contact me.

• For issues relating to this class, email smb+4118@cs. . .

• That lets me auto-sort class-related mail and keep better track ofthings

• My office hours are posted; I try to note (too frequent) changesbecause of my travel schedule

Steven M. Bellovin January 18, 2006 11

Page 12: Linux lecture

TAs

• Yingbo Song <ys2242@. . . >

• Ye Ilho <iy2110@. . . >

• Japinder Chawla <jsc2127@. . . >

Steven M. Bellovin January 18, 2006 12

Page 13: Linux lecture

Lectures

• I prepare slides for each class, and upload them shortly before classtime

• Well, occasionally they’re uploaded shortly after class. . .

• Because the class is being recorded for CVN, you’ll be able to watchany lectures you’ve missed.

• General access to the videos starts after the add/drop period ends

Steven M. Bellovin January 18, 2006 13

Page 14: Linux lecture

Homeworks

• A lot of it. . .

• As noted, approximately five homework assignments

• Homeworks are designed for practice, teaching, and evaluation

• Homeworks must be submitted electronically by the start of class

• Homeworks received later that day lose 5%, the next day 10%, twodays late 20%, three days late 30%; after that, zero credit

• Exceptions granted only for unforeseeable events. Workload, day job,etc., are quite foreseeable.

Steven M. Bellovin January 18, 2006 14

Page 15: Linux lecture

Programming Assignments

• All programming assignments must be done in C.

• C++ and Java are not acceptable

• If you don’t know C, you probably should not be in this class

• This is a necessary consequence of the course design, whichinvolves working with the Linux kernel

• Most of the programming assignments will be done in groups

Steven M. Bellovin January 18, 2006 15

Page 16: Linux lecture

Groups

• You’re encouraged to form your own groups of three students withinthe next week or so

• I’ll fill in the blanks; in general, I’ll try to avoid mixing CVN students,undergraduates, and graduate students

• I’ll probably rearrange the groups during the semester, puttingtogether students who do not contribute appropriately.

Steven M. Bellovin January 18, 2006 16

Page 17: Linux lecture

Co-operation versus Dishonesty

• Discussing homework with others is encouraged

• All programs and written material must be individual work unlessotherwise instructed

• Please use appropriate file permission mechanisms to protect yourhomework. (Looking at other people’s work is not allowed.)

• Zero tolerance for cheating or “outsourced homework”

• See the department’s policy on academic honesty:http://www.cs.columbia.edu/education/honesty . I willassume that you have all read it; you are in any event responsible forits terms and provisions.

Steven M. Bellovin January 18, 2006 17

Page 18: Linux lecture

Responsibility

• You’re all adults

• You’re all responsible for your own actions

• If there’s something missing, you have to tell me

Steven M. Bellovin January 18, 2006 18

Page 19: Linux lecture

Practical Focus

• This is not a pure academic-style OS course

• We’ll be working with the Linux kernel

• Most of the homeworks will involve modifying the kernel

Steven M. Bellovin January 18, 2006 19

Page 20: Linux lecture

Working with Kernels

• Very different from ordinary applications programming

• Must fit into the existing structure

• You spend more time reading programs than writing them

Steven M. Bellovin January 18, 2006 20

Page 21: Linux lecture

Debugging Kernels

• Debugging kernels is hard

• Long build/boot/test cycle

• Hard to get debugging output

• Many “Heisenbugs”

Steven M. Bellovin January 18, 2006 21

Page 22: Linux lecture

Virtual Machines

• We’ll test our changes using virtual machines

• Virtual machines — an entire machine is simulated as a singleapplication

• Much more detail in a few days

Steven M. Bellovin January 18, 2006 22

Page 23: Linux lecture

The CLIC Lab

• All programs and kernels must run on the CLIC machines

• Programs that don’t compile on those machines or kernels that don’tboot receive zero credit

• You need a CS account to use CLIC; seehttps://www.cs.columbia.edu/˜crf/accounts/

• You will be assigned particular CLIC machines for virtual machine use

• Some of the CLIC machines are for in-person use; others can only beaccessed remotely

• New policy: no food or drink in the CLIC lab

Steven M. Bellovin January 18, 2006 23

Page 24: Linux lecture

Operating System Components

• What’s in an OS?

• Is there a neat boundary?

• What clearly isn’t part of the OS?

Steven M. Bellovin January 18, 2006 24

Page 25: Linux lecture

The Kernel

• Fundamental piece of the OS

• At a minimum, uses hardware protection mechanisms to isolate otherpieces

• Provides communication paths linking different pieces of the system

• Provides interface to user application programs

Steven M. Bellovin January 18, 2006 25

Page 26: Linux lecture

Scheduler

• Allocates CPU time

• Handles scheduling priorities

• Ensures fairness

Steven M. Bellovin January 18, 2006 26

Page 27: Linux lecture

Memory Management

• Allocates memory to user applications

• Utilizes virtual memory to extend real memory space

• Ensures separation of memory between different applications

Steven M. Bellovin January 18, 2006 27

Page 28: Linux lecture

File Systems

• Layer files, directories, etc., on top of raw disk

• Enforce permissions

Steven M. Bellovin January 18, 2006 28

Page 29: Linux lecture

Device Drivers

• Hardware-dependent code to talk to I/O devices

• Provide type-specific common interface to higher layers

• Isolates hardware-specific complexity

• Part of the OS to prevent improper access to devices (other reasonsas well)

Steven M. Bellovin January 18, 2006 29

Page 30: Linux lecture

More?

• Is the login command part of the OS?

• What about the mount command?

• The shell?

• The C compiler?

• A text-formatting package?

• Different people draw the line in different places

• One useful metric: Who can replace the component with a differentone?

Steven M. Bellovin January 18, 2006 30

Page 31: Linux lecture

This Course

• We’ll cover the different pieces of an operating system

• We’ll see how they’re implemented in Linux

• We’ll learn how to change them

Steven M. Bellovin January 18, 2006 31

Page 32: Linux lecture

Reading Assignment

• Read Chapter 1 of Tanenbaum

• It’s the subject matter for the next few classes

• Reading and other homework assignments will be on the class Website and on Courseworks

Steven M. Bellovin January 18, 2006 32