29
CMSC 104 Operating Systems I An Introduction to Operating System Concepts

CMSC 104 1 Operating Systems I An Introduction to Operating System Concepts

Embed Size (px)

Citation preview

CMSC 104 1

Operating Systems I

An Introduction

to

Operating System

Concepts

CMSC 104 2

What’s an Operating System?

“The Boss” “The Big Cheese” “The Godfather” “The Power Behind the Scenes” A control program the manages all the

resources of the computer on which it runs.

CMSC 104 3

OS Introduction

Most computers multitask (do many things “at once”)o read/write disks and tapes

o send/receive network traffic

o run several programs.

Resources must be shared and programs coordinated

CMSC 104 4

OS Introduction

The operating system manages multi-tasking systems.o What resources are available.o Who gets to use them.

--- “Not now Bobby, it’s Sally’s turn.” --- Also provides:

o standard interfaces (ways to use) to computer hardware

o standard utility programs supporting other software.

CMSC 104 5

“McDonalds Model” of an Operating System

Counter Drinks

Grill

Fries

Customers(Applications)

Crew(Operating System)

Crew Serves Customers. Customers Don’t Cross Counter

CMSC 104 6

Operating System Evolution “Batch” Operating Systems

“One-at-a-time” in a “batch”o Usually single-task

o Execution required significant setup of equipment and software

o Each program was a job (“batch job”)

o OS designed to simplify setup and transition between jobs

CMSC 104 7

Batch Operating Systems (cont’d)

Operators served as “High Priests.”o Users didn’t touch computers

� User’s “submitted” jobs � Picked up program output� Written/punched input and instructions� Printed/punched output and error reports

o Turn around: minutes to days

“Error 410: Unterminated Do Loop, line 66”

CMSC 104 8

Operating System EvolutionInteractive Processing

OS for Interactive Processingo Started with “operator-like” single usero Users interact directly via remote terminals

(workstations) --- “On-Line processing”o Users demand timely responseo Machines too expensive for single users

N.B. “real-time” means “must respond in limited time or fail” --- not on-line system

CMSC 104 9

Operating System EvolutionTime-Sharing Systems

Really “time-slicing” systems Operating system:

o puts jobs in a “circular queue”o gives each job a predetermined “time slice”o swaps old job out and new one in at the

end of each sliceo repeats fast enough to give illusion of

simultaneously execution

CMSC 104 10

Operating System EvolutionTime-Sharing Systems (continued)

“Radar O’Reilly” model of operating systemso Read the mailo Make the coffeeo Check on Hawkeyeo Answer the phone

Only one job at a time, but all progress “on the average.”

CMSC 104 11

Operating System Evolution Time Sharing (cont’d)

Other Benefits:o best allocation of user time --- no “dead

time” at the keyboardo no waiting for peripherals --- other

processes can execute while one waits. Costs:

o complexity

CMSC 104 12

Operating System EvolutionExamples

Batch Systems:o IBM 1620, early MITS

Interactive systems:o DOS, early MacOS, VIC20, Commodore

64 Time-Sharing systems:

o Unix, Linux, Multics, IBM MVS, DEC VMSo Windows 95/98/NT, later MacOS

CMSC 104 13

Different Operating Systems on the Same Machine ?

Only one at a timeo VAX: VMS or Ultrixo IBM PCs: Linux or Windows or OS/2

Emulators let one OS act like anothero “Soft-PC”: Mac Windowso “Wine” and “Wabi”: Linux Windowso Cygnus Windows: Win95/98/NT Unixo Not always complete

CMSC 104 14

Inside the Operating SystemThe OS Shell

Defines interface between OS and userso Windows GUIo UNIX command lineo UNIX users can choose among a variety of

shells� csh is the “C shell”

� tcsh is an enhanced “C shell”

o Shell programming

CMSC 104 15

Inside the Operating SystemOS Shell interface

O / S

shell

Users

UsersUsers

CMSC 104 16

Inside the Operating SystemDifferent Shells/Same Results

OperatingSystem

BASH

TCSH

CSH

SHDifferentCommand

SetsSameResults

CMSC 104 17

Inside the Operating SystemThe OS Kernel

Central part (“hard nugget”) of Operating System

Kernel Componentso File Managero Device Driverso Memory Managero Schedulero Dispatcher

CMSC 104 18

Inside the Opeating SystemFile Manager

Maintains information about the files that are available on the systemo locationo size, type, and protectionso what storage is still available

Files usually allowed to be grouped in directories or folders. Allows hierarchical organization.

CMSC 104 19

Inside the Operating SystemDevice Drivers

Software to communicate with peripheral devices or controllers

Each driver is unique Translates general requests into

specific steps for that device

“read poker.exe”“read poker.exe”“read device 0xA3,cylinder 3, track 13,sector 43”

DeviceDriver

CMSC 104 20

Inside the Operating SystemMemory Manager

Controls use of main memory Allocates memory for each program and

its data Reclaims memory when programs

release it (or finish). Is supposed to know what areas are

free. “Memory leak” manager loses track

CMSC 104 21

Inside the Operating SystemMemory Manager (cont’d)

Virtual memory (“Imaginary memory”)o Programs only need their current data in

memory. (“What’s your VIN?”)o Store remainder on disk & keep location.o Bring other data back (and put this data out)

when other data is needed.o Creates the illusion of additional memory by

rotating (swapping) programs and data between main memory and mass storage

CMSC 104 22

Inside the Operating SystemVirtual Memory for People

You

Calendar

Stickynotes

Notebooks

CMSC 104 23

Inside the Operating SystemScheduler

Maintains a record of processes that are present, adds new processes, removes completed processes

Trackso memory area(s) assignedo priorityo state of readiness to execute (ready/wait)

CMSC 104 24

Inside the Operating SystemDispatcher

Executes processes when scheduled and ready

Gives each process a small (50 ms) time slice in which to execute

Stops process when time is up. Waits for scheduler to update process

record Starts next scheduled process.

CMSC 104 25

What’s a Process

The dynamic activity of executing a program

The process state is a “snapshot” of the machine, including values of the CPU registers, program counter and other memory cells

A single program can be associated with multiple processes simultaneously

CMSC 104 26

Inside the Operating SystemTypes of software

Applications softwareDo something “for the outside world.”Often transportable

System SoftwarePerforms tasks supporting operation of

computer systems (“not outside world”) e.g. operating systems

Usually tightly coupled to hardware

CMSC 104 27

Inside the Operating SystemTypes of software (cont’d)

Utility softwareo provides fundamental not included OS

(check spelling, count words, calculator)o “extend” the OS (or “support” applications)o Distinction between applications and

utilities is often vagueo Distinction between OS and utilities is also

vague

CMSC 104 28

Inside the Operating SystemUtilities

Operating Systems usually come with some associated utility programs

UNIX usually has the text editors emacs and vi (and sometimes pico)

UNIX has its own sort utility UNIX has its own mail utility(The contraction “it’s” means “it is,” not “belonging to it.”)

CMSC 104 29

Inside the Operating SystemSummary

Shell -- interface to user File Manager -- manages mass memory Device Drivers -- communicate with

peripherals Memory manager -- manages main

memory Scheduler & Dispatcher -- manage

processes