43
Operating Systems High Level View • Chapter 1,2

Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

  • View
    218

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Operating Systems High Level View

• Chapter 1,2

Page 2: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Who is the User?

• End Users

• Application Programmers

• System Programmers

• Administrators

Page 3: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

End Users Want

• Ease of use and learn

• Adaptable to user’s style

• Alternative ways to do things

• Lots of visual cues

• Free of nasty surprises

• Reliable quick response

• Consistency among features

Page 4: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Application Programmers Want

• Easy to write programs– read keystrokes– draw to screen– change windows

• Consistent view of system• Easy to use system facilities

– creating new windows– accessing a network

• Platform portability

Page 5: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

System Programmers Want

• Easy to– create correct programs– configure– debug– maintain– expand

Page 6: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Administrators Want

• Easy to add or remove devices• Protect system and data• Easy to upgrade• Easy to manage user accounts• Good & predictable average response• Affordable

Page 7: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

A Mouse Example

• User moves mouse -> hardware interrupt

• OS driver sees movement in pulse rate

• OS moves cursor on screen

• Application sees “mouseover” event -> updates screen image

• User sees image change – clicks icon

Page 8: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Terms & Concepts

• Operating System - software that manages resources of a computer & provides interfaces to them.

• Device - piece of hardware connected to the main computer hardware.

• Device controller - electronic interface which controls devices connected to the computer.

Page 9: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Terms & Concepts• Bus - conductors connecting many

hardware components in a computer.

• Device driver – a part of the OS that interfaces to a device controller.

• Kernel - part of an OS that implements basic functions – always running.

Page 10: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Terms & Concepts (cont.)

• Service - functions an OS provides to users through programmer interfaces.

• Utility - programs not part of the operating system kernel.

• Shell - user interface to most system services – command interpreter.

Page 11: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Simplified PC Hardware

CPU

Memory

Bus

DiskController

VideoController

KeyboardController

HardDisk

Video Monitor

Keyboard

Page 12: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

One picture of an OS

Operating System KernelOperating System Kernel

OtherPrograms(Browsers,

games, word

processing)

OtherPrograms(Browsers,

games, word

processing)

Devices(disks,

keyboards)

Devices(disks,

keyboards)

UtilitiesUtilitiesShell

(Command Interpreter)

Shell(Command Interpreter)

Memory

Memory

CPUCPU

Page 13: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

A Personal Computer & OS

Operating System KernelOperating System Kernel

Device Drivers

(DVD driver, video driver)

Device Drivers

(DVD driver, video driver)

BIOS

(Interface to hardware)

BIOS

(Interface to hardware)

Command (Command

Interpreter)

Command (Command

Interpreter)

Utilities

Utilities

Other Programs (Browsers, games, word processing)

Other Programs (Browsers, games, word processing)

Devices (Disks, keyboards)

Devices (Disks, keyboards)

CPU CPU Memory Memory

Page 14: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

The Process Concept and OS Process Information

• Process – a program in execution– Also called a job or task

• Has CPU state – registers

• Has allocated resources

Page 15: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Process States

• Started

• Ready

• Running

• Waiting (Blocked)

• Terminated (Ended)

Page 16: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Run

Ready

Wait 5 - Interrupted2 – GetsCPU Time

3 – Needssomething

4 – Got Whatit needed

New

Exit

1 - ProcessInitialized

6 - Finishedor aborted

0 - ProgramLoaded

7 - ExitsSystem

Process State Diagram

Page 17: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

State Transitions

• 0 – OS is preparing the job to run• 1 – Job is ready to run• 2 – Job starts (or resumes) running• 3 – Job is waiting for something• 4 – Job waiting has finished• 5 – Job is preempted• 6 – Job ends or is aborted• 7 – Job exits system

Page 18: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Process Information the OS Maintains

• Process ID – a number (PID)

• Process Control Block (PCB)– Priority information– Process state– Processor (CPU) state– -> Memory access table– -> Open files table– -> Next PCB

Page 19: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Types of Processes

• User or Application Processes

• Systems Program Processes

• OS Processes

Page 20: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Processor Modes

• Privileged –Monitor, kernel, supervisor,

ring 0 or system

• Non-privileged –user or application

Page 21: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Types of OSs

• Single-user

• Multi-tasking or

multi-programming

• Time Sharing

• Network and distributed

• Real-Time

Page 22: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Single-user OS

• One user

• One process running

• Limited memory management

• File services

• I/O services

Page 23: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Multi-tasking OS

• Multiple processes running

• May still be single user

• All that a single task system does, +

• CPU scheduling– Context switching

Page 24: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Multi-user OS

• Multiple users

• Users are interactive

• Jobs– are short

– need fewer resources

– need fast response time

Page 25: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Network/ Distributed OS

• Low-level services– Connect to the network– Send messages between systems

• Higher-level services– Browsing– File sharing– Print services

Page 26: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Real-Time OS

• Time deadlines

• Hard deadlines– Useless results or

catastrophe

• Soft deadlines– Some lateness tolerated

Page 27: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Architectural Approaches to Building an OS

• Monolithic single-kernel

• Microkernel and Layered

• Object-oriented Approach

• Virtual Machines

Page 28: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Monolithic Architecture

• One dense module

• RAM was expensive

• Started adding features

• Got bloated– Harder to add to– Harder to maintain

Page 29: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Layered Architecture

• Functions divided into Layers

• Each layer higher abstraction

• Hopefully don’t skip layers– Faster

– Less portable

Page 30: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Layered Architecture

Device Drivers

Shell(Command Interpreter)

Utilities User Programs

(Browsers, games, word processing)

Memory Management

Processor Scheduling

File System

Devices (disks, keyboards)

CPU Memory

API

Kernel

Page 31: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Microkernel Architecture

• One small module

• RAM getting cheaper

• Started removing features– Moved into higher layers

– Run in user mode

– Still OS functions

Page 32: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Microkernel Architecture

Microkernel

Shell(Command Interpreter) Utilities

Other Programs(Browsers, games, word

processing, …)

Devices (disks, keyboards, …)

Memory Management

Processor Scheduling

File System

USER Mode

KERNEL Mode

Page 33: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Implementation Techniques

• Interrupt Handling– Interrupt Vectors

• System Calls

• Queues and Tables

• Object Oriented Approach

• Minimalist vs. Maximalist Approaches

• Backward Compatibility

Page 34: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Interrupt Handling – Interrupt Vectors

• Hardware signals an event– I/O completion or fault

• Interrupt register holds interrupt #

• # used to select routine address– Vector table in low RAM

Page 35: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Interrupt Vector

Illustrating an for handling interrupts

Address of interruptservice routine 1

Index into interrupt vector

Interrupt Register

Interrupt Vector

Address of interruptservice routine 2

Address of interruptservice routine 3

o o o

Address of interruptservice routine N

Page 36: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

System Calls

• Load registers/ variables with arguments

• TRAP instruction

• Generates an interrupt

• Automatic switch to kernel mode

• Arguments tell OS what to do

• Afterwards

• “return” as from a function call

• Force return to user mode

Page 37: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

04/18/23 B.Ramamurthy 37

System Call

There are 11 steps in making the system call read (fd, buffer, nbytes)

Page 38: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

04/18/23 B.Ramamurthy 38

Some System Calls For Process Management and File Management

Page 39: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

OS Queues and Tables

• Tables– PCB

– Open File Table

– Page Tables

• Queues– Ready processes

– I/O requests

– event waits

Page 40: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Object Oriented Architecture

• A collection of objects

• Better software engineering

• Performance penalty

• Any object can use any other

Page 41: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Virtual Machine Architecture

• OS emulates hardware architecture

• Runs other OS, not user applications

• Good for OS development

• Related – simulate abstract machines– Java– .Net CLR

Page 42: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Hardware Virtual Machine Model

Virtual Machine

Shell, Utilities, or Programs

Shell, Utilities, or Programs

Shell, Utilities, or Programs

Devices (disks, keyboards, … ), CPU, Memory

Kernel 1

Kernel 2 Kernel 3

Page 43: Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators

Minimalist vs. Maximalist

• Less is more– Minimum in kernel– Else in libraries and layers– More choices– Linux

• All in One– Operating Standards– MAC OS