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

Post on 19-Dec-2015

216 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

Transcript

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

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

System Programmers Want

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

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

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

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.

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.

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.

Simplified PC Hardware

CPU

Memory

Bus

DiskController

VideoController

KeyboardController

HardDisk

Video Monitor

Keyboard

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

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

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

Process States

• Started

• Ready

• Running

• Waiting (Blocked)

• Terminated (Ended)

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

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

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

Types of Processes

• User or Application Processes

• Systems Program Processes

• OS Processes

Processor Modes

• Privileged –Monitor, kernel, supervisor,

ring 0 or system

• Non-privileged –user or application

Types of OSs

• Single-user

• Multi-tasking or

multi-programming

• Time Sharing

• Network and distributed

• Real-Time

Single-user OS

• One user

• One process running

• Limited memory management

• File services

• I/O services

Multi-tasking OS

• Multiple processes running

• May still be single user

• All that a single task system does, +

• CPU scheduling– Context switching

Multi-user OS

• Multiple users

• Users are interactive

• Jobs– are short

– need fewer resources

– need fast response time

Network/ Distributed OS

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

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

Real-Time OS

• Time deadlines

• Hard deadlines– Useless results or

catastrophe

• Soft deadlines– Some lateness tolerated

Architectural Approaches to Building an OS

• Monolithic single-kernel

• Microkernel and Layered

• Object-oriented Approach

• Virtual Machines

Monolithic Architecture

• One dense module

• RAM was expensive

• Started adding features

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

Layered Architecture

• Functions divided into Layers

• Each layer higher abstraction

• Hopefully don’t skip layers– Faster

– Less portable

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

Microkernel Architecture

• One small module

• RAM getting cheaper

• Started removing features– Moved into higher layers

– Run in user mode

– Still OS functions

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

Implementation Techniques

• Interrupt Handling– Interrupt Vectors

• System Calls

• Queues and Tables

• Object Oriented Approach

• Minimalist vs. Maximalist Approaches

• Backward Compatibility

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

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

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

04/18/23 B.Ramamurthy 37

System Call

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

04/18/23 B.Ramamurthy 38

Some System Calls For Process Management and File Management

OS Queues and Tables

• Tables– PCB

– Open File Table

– Page Tables

• Queues– Ready processes

– I/O requests

– event waits

Object Oriented Architecture

• A collection of objects

• Better software engineering

• Performance penalty

• Any object can use any other

Virtual Machine Architecture

• OS emulates hardware architecture

• Runs other OS, not user applications

• Good for OS development

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

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

Minimalist vs. Maximalist

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

• All in One– Operating Standards– MAC OS

top related