csc501: operating systems principles

29
CSC501: Operating Systems Principles Assistant Professor Department of Computer Science N.C. State University 1/8/2009 Xuxian Jiang 1

Upload: others

Post on 26-Feb-2022

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSC501: Operating Systems Principles

CSC501: Operating Systems Principles

Assistant ProfessorDepartment of Computer Science

N.C. State University1/8/2009

Xuxian Jiang

1

Page 2: CSC501: Operating Systems Principles

Logistics

q Instructor – Xuxian JiangQ Email: [email protected] Office: EB2 - 2254Q Office Hour: 11:50 – 11:59am TH

q TA – Anjing WangQ Email: [email protected] Office: MRC-409CQ Office Hour: 2:30 – 4:00pm T

q More informationQ http://courses.ncsu.edu/csc501

2

Page 3: CSC501: Operating Systems Principles

Course Overview

q Goals:Q OS internals and OS/architecture interactionQ Current trends in OS research

q Structure:Q Lectures in core OS design:v Review basic materialsv Read and discuss papers to understand advanced

issuesQ Significant projects related to core ideas in OS

3

Page 4: CSC501: Operating Systems Principles

Textbooks -- Recommended

q Silberschatz/Galvin. Operating System Concepts, John Whiley& Sons, 2009. (8th Edition)

q William Stallings. Operating Systems: Internals and Design Principles, Prentice-Hall, 2009. (6th Edition)

q Comer/Fossum. Operating System Design: The XINU approach, Prentice-Hall, 1988 (PC Edition)

4

Page 5: CSC501: Operating Systems Principles

Topics

q Processes, threads, and synchronizationQ Context switching and scheduling

q Memory managementQ Virtual memoryQ Demand paging

q I/O, file systems, distributed systemsq Protection and securityq Advanced topicsQ OS Memory protectionQ Virtualization

5

Page 6: CSC501: Operating Systems Principles

Course Requirements/Schedule

q PrerequisitesQ Undergraduate OS and architectures coursesQ Good programming skills in C and UNIX

q What to expectQ Readings v Esp. kernel source code reading

Q 4 or 5 programming assignments Q Midterm and Final exams

q Course ScheduleQ http://www.csc.ncsu.edu/faculty/jiang/csc501/calendar.html

6

Page 7: CSC501: Operating Systems Principles

Grading

q Midterm 20%q Final 20%q Programming assignments 60%Q Lab 0 – Getting started 5%Q Lab 1 – Process scheduling 15%Q Lab 2 – Reader/write locks 15%Q Lab 3 – Demand paging 20%Q Lab 4 – Survey 5%

7

Page 8: CSC501: Operating Systems Principles

Lab Facilities

q Front-endQ VCL, unity lab, or your own PC

q Back-endQ 100 raw machines

q Typical scenarios:Q Your own PC (Linux) à BackendQ Your own PC (Windows) à VCL (Linux) à Backend

8

Page 9: CSC501: Operating Systems Principles

q Academic integrityQ We will strictly enforce the university, college, and

department policies against academic dishonesty. q Unless otherwise noted, work turned in should

reflect your independent capabilitiesQ Plagiarism not allowed and severely punishedQ If unsure, note / cite sources and help

q For programming assignmentsQ No late submission will be acceptedv unless documented emergency (e.g., medical) in special

circumstances

Course Policies

9

Page 10: CSC501: Operating Systems Principles

Quick Survey 1: Are you familiar with UNIX

environment?

10

Page 11: CSC501: Operating Systems Principles

Quick Survey 2: Any kernel programming experience

before?

11

Page 12: CSC501: Operating Systems Principles

Introduction

CSC501 Operating Systems Principles

12

Page 13: CSC501: Operating Systems Principles

What is an operating system?

13

Page 14: CSC501: Operating Systems Principles

What is an operating system?

q An intermediary program between a user of a computer and the computer hardware

q Operating system goals:Q Execute user programs and make solving user

problems easierQ Make the computer system convenient to useQ Use the computer hardware in an efficient manner

Question: How about security?

14

Page 15: CSC501: Operating Systems Principles

What is an operating system?

q Virtual machines Q Virtualizes the hardware

q Manager/policemanQ Organizes; maintains order

q Autonomic systemQ Make things work beneath the covers

15

Page 16: CSC501: Operating Systems Principles

How does an OS work? à

q Receives requests from the application: system callsq Satisfies the requests: may issue commands to hardwareq Handles hardware interrupts: may upcall the application

hardware

OS

application (user) system calls upcalls

commands interrupts

hardware independent

hardware dependent

Page 17: CSC501: Operating Systems Principles

Keywords in this class

q AbstractionQ Process, memory, I/O, file, socket, …

q TradeoffQ Separation between mechanisms and policies

17

Page 18: CSC501: Operating Systems Principles

Abstraction I : Processes

A process is a system abstraction:illusion of being the only job in the system

hardware: computer

OS: process

user: application

Page 19: CSC501: Operating Systems Principles

Processes: Mechanism and Policy

q Mechanism:Q Creation, destruction, suspension, context

switch, signalling, IPC, etc.q Policy:Q How to share system resources between

multiple processes?

19

Page 20: CSC501: Operating Systems Principles

Abstraction II: Threads

A thread is a processor abstraction: illusion of having 1 processor per execution context

hardware: processor

OS: thread

application: execution context

Process vs. Thread: Process is the unit of resource ownership,while Thread is the unit of instruction execution.

Page 21: CSC501: Operating Systems Principles

Threads: Mechanism and Policy à

q Mechanism:Q Creation, destruction, suspension, context

switch, signalling, synchronization, etc.

q Policy:Q How to share the CPU between threads from

different processes?

Q How to share the CPU between threads from the same process?

21

Page 22: CSC501: Operating Systems Principles

Abstraction III: Virtual memory

hardware: physical memory

OS: virtual memory

Virtual memory is a memory abstraction: illusion of large contiguous memory, often more

memory than physically available

application: address space

Page 23: CSC501: Operating Systems Principles

Virtual Memory: Mechanism

q Mechanism:Q Virtual-to-physical memory mapping, page-fault,

etc.

physical memory:

v-to-p memory mappings

processes:

virtual address spacesp1 p2

Page 24: CSC501: Operating Systems Principles

Virtual Memory: Policy

q Policy:Q How to multiplex a virtual memory that is larger

than the physical memory onto what is available?Q How to share physical memory between multiple

processes?

24

Page 25: CSC501: Operating Systems Principles

Abstraction IV: File System

hardware: disk

OS: files, directories

A file system is a storage abstraction: illusion of structured storage space

application/user: copy file1 file2

Page 26: CSC501: Operating Systems Principles

File System à

q Mechanism:Q File creation, deletion, read, write, file-block-

to-disk-block mapping, file buffer cache, etc.

q Policy:Q Sharing vs. protection?

Q Which block to allocate for new data?

Q File buffer cache management?

26

Page 27: CSC501: Operating Systems Principles

Abstraction V: Messaging

hardware: network interface

OS: TCP/IP protocols

Message passing is a communication abstraction:illusion of reliable (sometimes ordered) transport

application: sockets

Page 28: CSC501: Operating Systems Principles

Message Passing

q Mechanism:Q Send, receive, buffering, retransmission, etc.

q Policy:Q Congestion control and routingQ Multiplexing multiple connections onto a single

NIC

28

Page 29: CSC501: Operating Systems Principles

Next Lecture

q OS Structure

q We will start class on time, so please don’t come late!

29