1 Review Dave Eckhardt 1 Synchronization ● Exam will be closed-book ● Who is reading comp.risks? ● Some homework questions on.qa.

Slides:



Advertisements
Similar presentations
Chapter 4 Memory Management Basic memory management Swapping
Advertisements

CAS3SH3 Midterm Review. The midterm 50 min, Friday, Feb 27 th Materials through CPU scheduling closed book, closed note Types of questions: True & False,
Operating Systems Review.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 3 Memory Management Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Operating Systems ECE344 Ding Yuan Final Review Lecture 13: Final Review.
1 Virtual Memory Management B.Ramamurthy. 2 Demand Paging Main memory LAS 0 LAS 1 LAS 2 (Physical Address Space -PAS) LAS - Logical Address.
1 Thursday, July 06, 2006 “Experience is something you don't get until just after you need it.” - Olivier.
1 Review Dave Eckhardt 1 Synchronization ● Exam will be closed-book ● Who is reading comp.risks? ● About today's review – Mentioning.
Review: Chapters 1 – Chapter 1: OS is a layer between user and hardware to make life easier for user and use hardware efficiently Control program.
Memory/Storage Architecture Lab Computer Architecture Virtual Memory.
The Memory Hierarchy (Lectures #24) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer Organization.
Memory Management and Paging CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
CS 104 Introduction to Computer Science and Graphics Problems
CMPT 300: Operating Systems Review THIS REIVEW SHOULD NOT BE USED AS PREDICTORS OF THE ACTUAL QUESTIONS APPEARING ON THE FINAL EXAM.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
1 Virtual Memory Management B.Ramamurthy Chapter 10.
OS Spring’04 Virtual Memory: Page Replacement Operating Systems Spring 2004.
Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping
Operating Systems Review. Questions What are two functions of an OS? What “layer” is above the OS? What “layer” is below the OS?
1 OS & Computer Architecture Modern OS Functionality (brief review) Architecture Basics Hardware Support for OS Features.
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
Exam Review cs550 Operating Systems. Preliminary Information Exam will focus on new content, but old content is still fair game. Exam format will be the.
CS 153 Design of Operating Systems Spring 2015 Final Review.
Operating Systems Chapter 8
Chapter 5 Operating System Support. Outline Operating system - Objective and function - types of OS Scheduling - Long term scheduling - Medium term scheduling.
CIS250 OPERATING SYSTEMS Memory Management Since we share memory, we need to manage it Memory manager only sees the address A program counter value indicates.
1 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms.
Cpr E 308 Spring 2004 Real-time Scheduling Provide time guarantees Upper bound on response times –Programmer’s job! –Every level of the system Soft versus.
30 October Agenda for Today Introduction and purpose of the course Introduction and purpose of the course Organization of a computer system Organization.
Chapter 4 Memory Management Virtual Memory.
OPERATING SYSTEMS - I. What is an Operating System OS is a program that manages the computer hardware It provides a basis for application programs and.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Page Replacement Allocation of.
Review °Apply Principle of Locality Recursively °Manage memory to disk? Treat as cache Included protection as bonus, now critical Use Page Table of mappings.
1 Rutgers UniversityCS 416: Operating Systems Final exam details December 22, pm-3pm. Venue: SEC 118. Tips: Spend time reading the questions before.
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
1/31/20161 Final Exam Dec 10. Monday. 4-7pm. Phelp 1160 Similar to midterm The exam is closed book. You can bring 2 page of notes (double sided) Nachos.
What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator –Control program.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
CMPT 300: Operating Systems Course Summary THIS SUMMARY SHOULD NOT BE USED AS PREDICTORS OF THE ACTUAL QUESTIONS APPEARING ON THE FINAL EXAM.
Virtual Memory 1 Computer Organization II © McQuain Virtual Memory Use main memory as a “cache” for secondary (disk) storage – Managed jointly.
MIDTERM REVIEW CSCC69 Winter 2016 Kanwar Gill. What is an OS? What are processes and threads? Process states? Diagram showing the state changes What data.
CS161 – Design and Architecture of Computer
Dave Eckhardt Synchronization (2) Dave Eckhardt
CS161 – Design and Architecture of Computer
Operating System (OS) QUESTIONS AND ANSWERS
Main Memory Management
Chapter 9: Virtual-Memory Management
Operating Systems Review.
Andy Wang Operating Systems COP 4610 / CGS 5675
COMS Prelim 1 Review Session
Sarah Diesburg Operating Systems CS 3430
Exam Review Mark Stanovich Operating Systems COP
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Operating Systems Lecture 1.
Andy Wang Operating Systems COP 4610 / CGS 5675
Major Topics in Operating Systems
February 5, 2004 Adrienne Noble
Computer Architecture
CSE 471 Autumn 1998 Virtual memory
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
CSE 153 Design of Operating Systems Winter 2019
COMP755 Advanced Operating Systems
Sarah Diesburg Operating Systems COP 4610
Virtual Memory.
Andy Wang Operating Systems COP 4610 / CGS 5675
CSE 542: Operating Systems
Presentation transcript:

1 Review Dave Eckhardt

1 Synchronization ● Exam will be closed-book ● Who is reading comp.risks? ● Some homework questions on.qa bboard ● About today's review – Mentioning key concepts – No promise of exhaustive coverage – Reading some of the textbook is advisable

1 OS Overview ● Abstraction/obstruction layer ● Virtualization ● Protected sharing/controlled interference

1 Hardware ● Inside the box – bridges ● User registers and other registers ● Fairy tales about system calls ● Kinds of memory, system-wide picture – User vs. kernel – Code, data, stack – Per-process kernel stack ● Device driver, interrupt vector, masking interrupts

1 Hardware ● DMA ● System clock – “Time of day” clock (aka “calendar”) – Countdown timer

1 Memory hierarchy ● Users want – big, fast – cheap – compact, cold – non-volatile ● Use locality of reference ● To build a pyramid of deception

1 Memory hierarchy ● Small, fast memory – backed by large slow memory – indexed according to large memory's address space – containing most-popular parts ● Line size, CAM ● Placement, associativity ● Miss policy/Eviction, LRU/Random, write policy ● TLB

1 Process ● Pseudo-machine (registers, memory, I/O) ● Life cycle: fork()/exec() – specifying memory, registers, I/O, kernel state – the non-magic of stack setup (argv[]) – the non-magic function that calls main() ● States: running, runnable, sleeping – also forking, zombie ● Process cleanup: why, what

1 Thread ● Core concept: schedulable set of registers – With access to some resources (“task”, in Mach terminology) – Thread stack ● Why threads? – Cheap context switch – Cheap access to shared resources – Responsiveness – Multiprocessors

1 Thread types ● Internal – optional library – register save/restore (incl. stack swap) ● Features – only one outstanding system call – “cooperative” scheduling might not be – no win on multiprocessors

1 Thread types ● Kernel threads – resources (memory,...) shared & reference-counted – kernel manages: registers, kstack, scheduling ● Features – good on multiprocessors – may be “heavyweight”

1 Thread types ● M:N – M user threads share N kernel threads ● dedicated or shared ● Features – Best of both worlds – Or maybe worst of both worlds

1 Thread cancellation ● Asynchronous/immediate – Don't try this at home – How to garbage collect??? ● Deferred – Requires checking or cancellation points

1 Thread-specific data ● printf(“Client machine is %s\n”, thread_var(0)); ● reserved register or stack trick

1 Race conditions ● The setuid shell script attack

1 Wacky memory ● Stores may be re-ordered or coalesced ● That's not a bug, it's a feature!

1 Atomic sequences ● short ● require non-interference ● typically nobody is interfering ● store->cash += 50; ● “mutex” / “latch”

1 Voluntary de-scheduling ● “Are we there yet?” ● We want somebody else to have our CPU ● Not running is an OS service! ● Atomic: – release state-guarding mutex – go to sleep ● “condition variable”

1 Critical section problem ● Three goals – Mutual exclusion – Progress – choosing time must be bounded – Bounded waiting – choosing cannot be unboundedly unfair ● “Slide 15” algorithm ● Bakery algorithm

1 Mutex implementation ● XCHG, Test&Set ● Load-linked, store-conditional ● i860 magic lock bit ● Lamport's algorithm ● “Passing the buck” to the OS (or not!) ● Kernel-assisted instruction sequences

1 Bounded waiting ● One algorithm ● How critical?

1 Environment matters ● Spin-wait on a uniprocessor???? ● How reasonable is your scheduler? – Maybe bounded waiting is free?

1 Condition variables ● Why we want them ● How to use them ● What's inside? ● The “atomic sleep” problem

1 Semaphores ● Concept – Thread-safe integer – wait()/P() – signal()/V() ● Use – Can be mutexes or condition variables ● 42 flavors – Binary, non-blocking, counting/recursive

1 Monitor ● Concept – Collection of procedures – Block of shared state – Compiler-provided synchronization code ● Condition variables (again)

1 Deadlock ● Definition – N processes – Everybody waiting for somebody else ● Four requirements ● Process/Resource graphs ● Dining Philosophers example

1 Prevention ● Four Ways To Forgiveness ● One of them is actually common

1 Avoidance ● Keep system in “safe” states – States with an “exit strategy” ● Assume some process will complete, release resources ● Make sure this enables another to finish ● Banker's Algorithm

1 Detection ● Don't be paranoid (or oblivious) ● Scan for cycles – When? – What to do when you find one?

1 Starvation ● Always a danger ● Solutions probably application-specific

1 Context switch ● yield() by hand (user-space threads) – No magic! ● yield() in the kernel – Built on the magic process_switch() – Inside the non-magic process_switch() ● Scheduling ● Saving ● Restoring ● Clock interrupts, I/O completion

1 Scheduling ● CPU-burst behavior – “Exponential” fall-off in burst length – CPU-bound vs. I/O-bound ● Preemptive scheduling – Clock, I/O completion ● Scheduler vs. “Dispatcher” ● Scheduling criteria

1 Scheduling – Algorithms ● FCFS, SJF, Priority ● Round-robin ● Multi-level ● Multi-processor (AMP, SMP) ● Real-time (hard, soft) ● The Mars Pathfinder story – priority-inheritance locks

1 Memory Management ● Where addresses come from – Program counter – Stack pointer – Random registers ● Image file vs. Memory image ● What a link editor does – relocation ● Logical vs. physical addresses

1 Swapping / Contiguous Allocation ● Swapping – Stun a process, write it out to disk – Memory can be used by another process ● Contiguous allocation – Need a big-enough place to swap in to – External fragmentation (vs. internal)

1 Paging ● Fine-grained map from virtual to physical – Page address -> frame address ● Page table per process – Per-page bits: valid, permissions, dirty, referenced – Fancy data structures ● Multi-level page table ● Inverted page table ● Hashed/clustered page table

1 Segmentation ● Concept – Hardware expression of “memory region” – Protection boundary, sharing boundary ● Typically combined with paging – The beautiful complex x86

1 Less is more ● Software-managed TLB – Choose your own page table structure – “Explain” it via TLB miss faults

1 Virtual Memory ● Observations – Some stuff is “never” needed in memory – Some stuff isn't needed in memory to start – Some stuff is sometimes needed in memory ● Approach – RAM is just a cache of system memory – Page-valid bits record swapping out of pages – Page-fault handler fixes everything up

1 Page-fault handling ● Map address to region ● Deduce semantic reason for fault ● Special techniques – COW – Zero pages – Memory-mapped files

1 Paging ● Page replacement policy – FIFO, optimal, LRU – Reality: LRU approximations ● Clock algorithm ● Backing store policy ● Page buffering ● Reclaim faults

1 Paging ● Frame allocation policy – Equal/proportional/... ● Thrashing – Just not enough pages – Working-set model – Fault-frequency model ● Reducing paging – Simple program optimizations