OS Overview & Structure, Lecture notes of Operating Systems

L24: Operating Systems Overview. Quick Virtual Memory Review. ❖ What do Page Tables map? ❖ Where are Page Tables located?

Typology: Lecture notes

2022/2023

Uploaded on 05/11/2023

jdr
jdr 🇮🇹

4.7

(6)

221 documents

1 / 38

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE369, Autumn 2016L01: Intro, Combinational Logic CSE410, Winter 2017L24: Operating Systems Overview
OSOverview&Structure
CSE410Winter2017
Instructor: TeachingAssistants:
JustinHsia KathrynChan,KevinBi,RyanWong,WaylonHuang,Xinyu Sui
SlidesadaptedfromCSE451material
byGribble,Lazowska,Levy,andZahorjan
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26

Partial preview of the text

Download OS Overview & Structure and more Lecture notes Operating Systems in PDF only on Docsity!

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

OS Overview & Structure CSE 410 Winter 2017 Instructor:

Teaching Assistants:

Justin Hsia

Kathryn Chan, Kevin Bi, Ryan Wong, Waylon Huang, Xinyu Sui

Slides adapted from CSE451 materialby Gribble, Lazowska, Levy, and Zahorjan

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

Quick Virtual Memory Review

What do Page Tables map?

Where are Page Tables located?

How many Page Tables are there?

Can your program tell if a page fault has occurred?

True / False: Virtual Addresses that are contiguous will alwaysbe contiguous in physical memory

TLB stands for _______________________ and stores_______________

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

What is an Operating System?

Answers:

“I don't know” – Ed Lazowska, longtime OS researcher

Nobody knows

The book has some ideas – see Section 1.

They’re programs – big, hairy programs

The Linux source has over 1.7 million lines of C codeOkay. Then what are some goals of an OS?

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

The Traditional Picture

“The OS is everything you don’t need to write in order to runyour application”

This depiction invites you to think of the OS as a library

In some ways, it is:

All operations on I/O devices require OS calls (

syscall

s)

In other ways, it isn't:

You use the CPU/memory without OS calls

It intervenes without having been explicitly called

Applications

OS

Hardware

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

Application Benefits of an OS

Programming simplicity

Can deal with high‐level abstractions (files) instead of low‐level hardware details (device registers)

Abstractions are

reusable

across many programs

Portability (across machine configurations orarchitectures)

Device independence: 3com card or Intel card?

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

User Benefits of an OS

Safety

Gives each process the illusion of its own virtual machine

Protects

programs from each other

Fairly

multiplexes

resources across programs

Efficiency (cost and speed)

Share

one computer across many users

Allows for

concurrent

execution of multiple programs

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

More OS Issues…

Concurrency:

How are parallel activities (computationand I/O) created and controlled?

Scale:

What happens as demands or resourcesincrease?

Persistence:

How do you make data last longer thanprogram executions?

Distribution:

How do multiple computers interact witheach other?

Accounting:

How do we keep track of resource usage,and perhaps charge for it?

There are tradeoffs, not right and wrong!

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

Architectural features affecting OS’s

These features were built primarily to support OS’s:

Timer (clock) operation

Synchronization instructions (

e.g.

atomic test‐and‐set)

Memory protection

I/O control operations

Interrupts and exceptions

Protected modes of execution (kernel vs. user)

Privileged instructions

System calls (and software interrupts)

Virtualization architectures

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

System Calls

syscall

instruction

atomically

Saves the current PC

Sets the execution mode to privileged

Sets the PC (

%rip

) to a handler address

It’s a lot like a protected procedure call

Caller puts arguments in a place callee expects

One of the arguments is the

syscall

number

Callee (OS) saves caller’s state (registers, other control state)so it can use the CPU

OS must verify caller’s arguments, then runs handler code

OS returns using a special instruction

Also sets execution mode to user

open

is

syscall

2

mov

$0x2,%eax

syscall #

return

value

in

%rax

cmp

$-4095,%rax

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

A Kernel Crossing Illustrated

user mode kernel mode

Chrome: read(int fileDescriptor, void *buffer, int numBytes)

Save user PCPC = trap handler addressEnter kernel mode Save process stateVerify

syscall

number

Find

sys_read()

handler in vector table

trap handler

sys_read()

kernel routine Verify argumentsInitiate readChoose next process to runSetup return valuesRestore app state

sysret

instruction

PC = saved PCEnter user mode

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

Major OS Components

Processes

Memory

Input/Output

Secondary Storage (Disk)

File Systems

Protection

Shells (command interpreter, or OS UI)

GUI

Networking

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

Hardware (CPU, devices)

Application Interface (API)

Hardware Abstraction Layer

File

Systems

Memory Manager

Process

Manager

Network

Support

Device Drivers

Interrupt Handlers

Boot &

Init

Acrobat

Powerpoint

Chrome

Operating System

Portable

User Apps

Slack

The Classic Diagram

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

Process management

An OS executes many kinds of processes:

Users’ programs

Batch jobs or scripts

System programs

Print spoolers, name servers, file servers, network daemons, …

Process includes the execution context

PC, registers, VM, OS resources (

e.g.

open files), etc…

The program itself (code and data)

The OS’s

process module

manages these processes

Process A:

code, stack

PC, registers

page tables

resources

CSE369, Autumn 2016

L01: Intro, Combinational Logic

CSE410, Winter 2017

L24: Operating Systems Overview

States of a User Process

trap or

exception

interrupt

dispatch interrupt

Running

Ready

Blocked

Finished(“Zombie”)

terminate