Operating Systems Operating Systems CMPSC 473 CMPSC 473 Operating - - PowerPoint PPT Presentation

operating systems operating systems cmpsc 473 cmpsc 473
SMART_READER_LITE
LIVE PREVIEW

Operating Systems Operating Systems CMPSC 473 CMPSC 473 Operating - - PowerPoint PPT Presentation

Operating Systems Operating Systems CMPSC 473 CMPSC 473 Operating Systems Structure Operating Systems Structure January 24, 2008 - Lecture January 24, 2008 - Lecture 3 3 Instructor: Trent Jaeger Instructor: Trent Jaeger Last class:


slide-1
SLIDE 1

Operating Systems Operating Systems CMPSC 473 CMPSC 473

Operating Systems Structure Operating Systems Structure January 24, 2008 - Lecture January 24, 2008 - Lecture 3 3 Instructor: Trent Jaeger Instructor: Trent Jaeger

slide-2
SLIDE 2
  • Last class:

– Computer architecture support for systems

  • Today:

– Operating Systems Structures and Basics

slide-3
SLIDE 3

Interlude

  • Recap of OS goals

– Resource management

  • Memory, Devices

– Scheduling – Security – Services to programs/applications

slide-4
SLIDE 4

Functionality Expected from a Modern OS

slide-5
SLIDE 5

Libertarian View

  • Everyone should get to do

whatever they want

– As long as they let others live

  • Processes should feel they have

the entire computer

– Infinite CPU, RAM, … – No threat of someone harming them

slide-6
SLIDE 6

Socialistic View

  • To each according to

his needs

– Co-operative existence enforced by govt/OS – Fair allocation of resources

slide-7
SLIDE 7

OS as a Communist Govt.

  • Centralized control

and monitoring

  • Allocate resources

efficiently

  • Misbehavior =>

Termination

slide-8
SLIDE 8

Theory vs. Practice

  • Performance

– Efficient and fair resource allocation, illusion of unlimited resources

  • Isolation

– Protect everyone from each other and from the OS

  • How to do this efficiently?

– Hardware support

slide-9
SLIDE 9

Operating System Approaches

  • Monolithic

– Everything in one program – Lacks structure

  • Kernel

– Core services

  • Management of Abstractions
  • Microkernel

– Core concepts

  • Fundamental objects; Management in servers
  • Exokernel

– No abstractions; interface to hardware

slide-10
SLIDE 10

Monolithic OS

  • Management in kernel
slide-11
SLIDE 11

Microkernel OS

  • All management is outside kernel

– Servers

slide-12
SLIDE 12

Monolithic Systems

slide-13
SLIDE 13

Operating System Layers

slide-14
SLIDE 14

System Layers

  • Application
  • Libraries (in application process)
  • System Services
  • OS API
  • Operating system kernel
  • Hardware
slide-15
SLIDE 15
  • Application Programming Interface

– Library functions (e.g., libc)

  • Examples

– printf of stdio.h

  • All within the process’s address space

– Static and Dynamic linking

Applications to Libraries

slide-16
SLIDE 16

Applications to Services

  • Maintain the system software configuration

– E.g., cron

  • Provide syntactic sugar for using resources

– E.g., printing, network, files, etc.

  • UNIX man pages, sections 1 and 8
slide-17
SLIDE 17

Libraries to System

  • System call interface

– UNIX man pages, section 2 – Examples

  • open, read, write, unistd.h
  • Special files

– Drivers, /proc, sysfs

slide-18
SLIDE 18

System to Hardware

  • Software-hardware interface
  • OS kernel functions

– Concepts == Managers -- Hardware – Files == drivers -- devices – Address space == virtual memory -- memory – Instruction Set == process model -- CPU

  • OS provides abstractions of devices and hardware
  • bjects (files)
slide-19
SLIDE 19

System Call Overview

slide-20
SLIDE 20

System Call Handling

slide-21
SLIDE 21

System Call Handling

  • Procedure call in user process
  • Initial work in user mode

(libc)

  • Trap instruction to invoke kernel

(int 0x80)

  • Preparation

(e.g., sys_read, mmap2)

  • I/O command

(read from disk)

  • Wait

(disk is slow)

  • Completion

(interrupt handling)

  • Return-from-interrupt instruction
  • Final work in user mode

(libc)

  • Ordinary return instruction
slide-22
SLIDE 22

Resource Manager

  • OS is a resource manager

– Devices, Time, Space, Power, etc.

  • OS provides abstractions for resources

– Files, sockets, etc.

  • Resource allocation
  • Resource management
slide-23
SLIDE 23

Two Processes and an OS

  • Access to persistent data

– File on a disk

  • Allocation

– Each allocates an abstract resource (file) – E.g., OS allocates physical resource on disk

  • Management

– Processes may access own files – E.g., OS protects access to disk via protecting access to file abstraction

slide-24
SLIDE 24

Two Processes and an OS

  • OS competes with the processes for resources

– E.g., OS uses disk to swap

  • Allocation

– Kernel maps memory to disk – How does the kernel know disk blocks to use?

  • Management

– System memory is managed in cache, virtually, physically,

  • n disk, …

– Kernel must keep all of these straight

slide-25
SLIDE 25

Summary

  • Operating systems must balance many needs

– Impression that each process has individual use of system – Comprehensive management of system resources

  • Operating system structures try to make use of system

resources straightforward

– Libraries – System services – System calls and other interfaces

  • Resources are allocated and managed by kernel

– May require mapping between different representations

slide-26
SLIDE 26
  • Next time: Processes