37
ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Embed Size (px)

DESCRIPTION

Flavors of OS Mainframe Server Multiprocessor Personal Computer Real-Time Embedded Smart Card

Citation preview

Page 1: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

ITFN 2601Introduction to Operating

Systems

Lecture 2Computer Hardware Review

OS Concepts Overview

Page 2: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Agenda

Flavors of OSHardware ReviewOS Concepts OverviewSystem CallsVarious OS Approaches

Page 3: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Flavors of OS

MainframeServerMultiprocessorPersonal ComputerReal-TimeEmbeddedSmart Card

Page 4: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Mainframe OS

High-end I/O capacity1000+ disksGigabytes of data

High-end web serversB2B (business to business) E-commerceHigh-speed VR/FMV RenderingMany small, simultaneous jobs

Page 5: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Server OS

Large personal computers (kahuna, zidane, etc.)

Print, file servers for small businessesWeb serversCan load balance these to increase

performanceUNIX, Linux, Win2000 Server OS

Page 6: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Multiprocessor OS

Connect multiple computers togetherShare/distribute jobs among multiple

machines/processorsSpecialized protocols for managing

communicationWin2000 Advanced Server

Page 7: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Personal Computer OS

Focus on single user, multiple jobsWhat you’re running on your machineWin9x, Win2000 Pro, Linux

Page 8: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Real-Time OS

Time dominates these machines’ specsData collection from production lines,

factory machineryHard real-time: time critical in all

instancesSoft real-time:

OK to drop occasionally

Page 9: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Embedded OS

Personal Digital AssistantsTVs, microwaves, mobile phonesVery small OS, embedded on chipPalmOS, WinCE

Page 10: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Smart Card OS

Credit card sized devicesSpecialized OS for specialized purposesE-payment cards (e-cash cards)Some JVM coming into play

Page 11: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Hardware Review

CPU

Memory

DisplayController

KeyboardController

FloppyController

Hard DiskController

Display

Keyboard

Floppy

Hard Disk

Bus

Page 12: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Hardware Review

ProcessorsMemoryI/O DevicesBus

Page 13: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

ProcessorsBrain of the computerFetch, decode, execute cycleRegistersProgram Counter (PC)Stack Pointer (SP)Pipelining improves performance, but

complexities of “rolling back” appearKernel vs. User Mode (enables establishing

limitations of instruction set available)

Page 14: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

MemoryTrade off of speed vs. cost/size

Registers (on processor)Cache (processor)Cache (mainboard)Main MemoryDiskOther Network Cache/MachinesTapeSp

eed

decr

ease

s

Cos

t inc

reas

es

Page 15: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

I/O Devices

Typically consist of two parts:ControllerDevice

Controller manages & presents the API of the device to the OS

The software that “talks” to the controller is called a device driver

Page 16: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Memory Allocation

We need a protective and fair way of allocating and resizing memory blocks for processes/jobs

Two sections of memoryCode (typically static)Data (volatile)

OS

Program Code

User 1 Data

User 2 Data

LimitBase

LimitBase

Limit

Base

Page 17: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Computer Memory•The CPU is often referred to as the brain of the computer. This is where all the actual computing is done.

•The chipset supports the CPU. It usually contains several "controllers" which govern how information travels between the processor and other components in the system. Some systems have more than one chipset.

Page 18: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Computer Memory

•The memory controller is part of the chipset, and this controller establishes the information flow between memory and the CPU.

•A bus is a data path in a computer, consisting of various parallel wires to which the CPU, memory, and all input/output devices are connected. •The memory bus runs from the memory controller to the computer's memory sockets

Page 19: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Computer Memory•Memory speed is sometimes measured in Megahertz (MHz), or in terms of access time - the actual time required to deliver data - measured in nanoseconds (ns). •A computer's system clock resides on the motherboard. It sends out a signal to all other computer components in rhythm, like a metronome. •Cache memory is a relatively small amount (normally less than 1MB) of high speed memory that resides very close to the CPU. Cache memory is designed to supply the CPU with the most frequently requested data and instructions.

Page 20: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Invoking Device ActionsBusy wait – execute a kernel-level system call

and wait (ties up the processor )Ask the device to generate an interrupt (signal

that it’s done or failed)Doesn’t tie up the processorAdds complexity

DMA – Direct Memory AccessBypasses the use of the processorAllows the device to write directly to memory once

the “rules of the road” are established

Page 21: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

BusCommunication “highway” for all data to travel uponMultiple buses exist in modern machines

Cache (fastest)Local (on mainboard –other busses connect to it)MemoryPCI (successor of ISA - high-speed I/O)SCSI (high-speed scanners & disks)USB (slow peripherals)IDE (disks, etc.)ISA (slowest – legacy)

Page 22: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

OS Concepts

ProcessesDeadlockMemory ManagementI/OFilesSecurity

                        

Page 23: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

ProcessesDefined as a “program in execution”AKA a “job”Contain

Instructions (code segment)SP, PC, registers, file handlesData segment

Processes can spawn subprocesses & threadsThe OS must ensure fairness & protection,

timeslicing & managing multiple processes at a time

Page 24: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Deadlock

Two or more processes “stalemated” because they can’t make progress

Process AHas resource 1

Waiting on resource 2

Process BHas resource 2

Waiting on resource 1

Page 25: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Memory Management

Providing protection of one process’ memory section from another process (security)

Providing a fair allocation of memory to multiple processes

Swapping memory to disk as needed

Page 26: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Input/Output

All OS must manage I/O devices

Two categories:Device independentDevice dependant (device drivers)

Page 27: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Files

System callsCreate, remove, read, write, etc.

Directories & subdirectoriesCreate, remove, rename, move, etc.

Page 28: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Security

Allocate permissionsDirectoriesFiles

Example UNIX policies to consider:Read, Write, ExecuteUser, Group, World

Page 29: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

System Calls

Services that the OS provides to the userSet of API that user-level programs may

invoke

Flavors of System CallsUNIXWin32

Page 30: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

UNIX System Calls

pid = fork() creates child processexit() terminates processfd = open(file, …) opens files = mkdir(name, mode) creates directorys = chmod(name, mode) sets file/dir

permissionss = kill(pid, signal) sends signal to process

Page 31: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Win32 System Calls

CreateProcess(…) creates new processExitProcess(…) terminates processCreateFile(…) opens fileCreateDirectory(…) creates directory

Page 32: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Approaches to OS

Monolithic

Virtual Machines

Client-Server (microkernel)

Page 33: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Monolithic OS Architecture

OS written as a set of procedures

Each procedure has well-defined interface (parameters)

Very little structure or information hiding

Page 34: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Virtual Machine OS Architecture

Replicate the hardware within software

Trap OS calls and translate/handle themBreaks down if you make direct I/O callsSlow

Other approach: JVM (define an alternate instruction set and translate to various OS)

Page 35: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

Client-Server OS Architecture

Implement as much as possible in user-level modules

The OS is as small as possibleIt only serves to translate and message

pass OS-level calls to service processes

Page 36: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

SummaryVarious levels of OS complexities/sizes exist

(mainframe to smart cards)Important to know your hardware

Processors, memory, I/O, busesImportant topics in OS forthcoming

Processes, deadlock, mem mgmt, files, etc.System calls provide an API to user-level

programsVaried OS architecture approaches

Monolithic, VM, client-server

Page 37: ITFN 2601 Introduction to Operating Systems Lecture 2 Computer Hardware Review OS Concepts Overview

FIN