17
CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: [email protected]

CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: [email protected]

Embed Size (px)

Citation preview

Page 1: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

CS 444Introduction to Operating Systems

Lecturer: Dr. Ronald CheungOffice: S/3/073

Phone: 617-287-6483Email: [email protected]

Page 2: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

Course Objectives

• This course will teach you details of the operating system

• It will cover topics:– Processes and threads– Deadlocks– Memory management– I/O systems– File systems– Real-time operating systems (if time permits)

Page 3: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

Introduction

• Syllabus and Lecture Notes– Web: http://www.cs.umb.edu/~cheungr/cs444

• Required Textbooks– Modern Operating Systems, 4th Ed., A. Tanenbaum

Page 4: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

Introduction• HW assignments

– Assignment write-ups will be on my website

– HW will be done on the ulab UNIX machine by student groups (2 students to a group)

– The executable will be downloaded to the SAPC VM and debugged remotely

• Homework is an Individual Group Effort– You can answer questions for each other as long as you

acknowledge any help that you receive from others

– BUT DON’T HAVE OR LET ANYONE ELSE DO YOUR HOMEWORK FOR YOU!

– Exams will definitely have programming questions

– If I discover any cheating, I’ll follow school policy!

Page 5: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

Getting Started• UNIX Account

– Apply for a cs444 account – Edit your .cshrc file in your home to add “load module ulab” (set

up environment to compile programs that can run on SAPCs)

• Install VMWare Workstation 10 for PC or VMWare Fusion 8 for MAC – Download the corresponding .exe or .dmg and .txt files from

/nobackup/blade71/cheungr/– Install it on your PC or MAC using the license key provided

• Remote access from your home– login on “users.cs.umb.edu” using ssh2 or putty– Then ssh ulab and cd cs444– You can edit your files and compile a program for the SAPC– Download the executable to the SAPC VM and debug

Page 6: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

Getting Started• Putty (Officially Recommended by Systems Staff)

– http://www.chiark.greenend.org.uk/~sgtatham/putty/

– Download, UnZIP and Execute Installer as directed

– Use Putty configured for SSH2 instead of TELNET

– Use PSCP or PSFTP for secure ftp

Page 7: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

Getting Started

• Assume students know C programming, make, and tools such as mtip, Tutor, gdb from ulab

• Useful links on ulab:

– http://www.cs.umb.edu/ulab– Professor Wilson’s CS 341 lectures:

www.cs.umb.edu/~bobw/CS341

Page 8: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

• Operating system runs in kernel (supervisory) mode– Protected from user tempering by hardware

• Other software runs in user mode– users are free to modify if he/she so chooses

• Boundary between Operating Systems and User mode programs is blurred

Components of a Computer System

Physical Devices

Microarchitecture

Machine Language

Operating System

Compilers Editors CommandInterpreter

Spread sheet

Web Browser

Games

Hardware

System programs

Application programs

Page 9: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

What is an Operating System?

• Programming at machine language level primitive and awkward. Operating Systems provide:

– a clean abstract set of services to access hardware resources that is easier to program

– Management of these resources

Page 10: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

A Bottom-up View

• OS manages all pieces of a complex system

• Provides an orderly and controlled allocation and access of hardware resources

• Arbitrates which application has access to what resources at what time

Page 11: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

Timeline of OS Milestones

UNIX CP/M

BSDUNIX

Apple DOS 3.1

PC-DOS

GNU

AppleMAC

Windows 1.01; Atari ST

OS/2

NeXTStep

Windows 3.0

LINUX

Windows NT

Windows 95

Windows 98

Windows ME, 2000

MAC OS

MAC OS X

Windows XP

Windows Vista

Windows 7

1970 1980 1990 2000 2010

source: http://www.computerworld.com/s/article/9129498/Timeline_40_years_of_OS_milestones

Page 12: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

Categories of Operating Systems

• Server OS (UNIX, Windows Server, Linux)– serves multiple users

• PC OS (Mac OS, Windows)– serves a single user

• Real-time OS (VxWorks, pSOS) – completes tasks within a given time budget

• Embedded OS (Blackberry OS, Apple iOS)– fits into small hand held device

Page 13: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

System Calls

• What is a System Call?– Interface between user programs and the

operating system– User program transfers control to the operating

system using a trap instruction. Once it completes the work, it returns the program to user space

– System calls vary from one operating system to another

Page 14: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

Types of System Calls• UNIX/LINUX- POSIX (International standard

9945-1)– Process Management– File management– Directory Management– Miscellaneous

• Windows Win32 API– Compatible among Windows versions– Many are library calls (user mode to user mode)

About 100 calls

Several1000 calls

Page 15: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

User Memory Layout

Important powers of 2: 1G=230, 1M=220, 1K=210

0xFFFFFFFF = 232 -1 = 4G-1

reserved

code

data

stack

0

0x00010000

reserved

code

data

stack

0

0x00020000

0xFFFFFFFF 0x7FFFFFFF

Solaris UNIX Win 32

C lib Dll C lib Dll

Page 16: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

Dynamic Link Library(DLL)

• Also known as dynamic library

• code can be called by a program that is not stored in the program’s executable file

• brought to memory at runtime via dynamic linkage to user’s program

• calls to library are direct since it is in user memory

Page 17: CS 444 Introduction to Operating Systems Lecturer: Dr. Ronald Cheung Office: S/3/073 Phone: 617-287-6483 Email: cheungr@cs.umb.edu

Example of UNIX System Calls

• See debugging session captured in syscalls.html

• C program runs on a Sun Sparc machine with the Solaris OS