COT 5611 Operating Systems Design Principles Spring 2010dcm/Teaching/COP5611Spring... · Software...

Preview:

Citation preview

COT 5611 Operating SystemsDesign Principles Spring 2010

Dan C. MarinescuOffice: HEC 439 BOffice hours: M-Wd 1:00-2:00 PM

Innovations are now full-circle

2

Factors affecting complexity

3

Complexity of computing and communication systems

New components

New applications

Interconnectivity + mobility, embedded

devices

Physical constraints

Larger segment of population using

the systems

Optimization of resource

consumption

TimingConstraints

Software follows hardware

0

10

20

30

40

50

60

Wind

ows 3

.1 (19

92)

Wind

ows N

T (199

2)Sola

ris (1

998)

Wind

ows 9

5W

indow

s 98

Wind

ows N

T 5.0 (

1998

)

RedHat

Linux

6.2 (

2000

)

RedHat

Linux

7.1 (

2001

)W

indow

s XP

Vista

Mill

ions

of

lines

of

sour

ce c

ode

Cheap → Pervasive

Pervasive → qualitative change

year

log

(peo

ple

per c

ompu

ter)

Slide from David Culler, UC Berkeley

Number crunching

EmbeddedSense/control

Word processingCommunication

Latency improves slowly

1

10

100

1000

1 2 3 4 5 6 7 8 9 10 11Year #

Impr

ovem

ent

wrt

yea

r #

1

Moore’s law (~70% per year)

DRAM access latency (~7% per year)

Speed of light(0% per year)

Heat is a problem

Recent Intel CPU Clock Rate

486

Pentium

PentiumPro

Pentium III

Pentium 4

Pentium 4 HT

mH

z

Lecture 210

Systems and the environment

System a set of interconnected components that has a an expected behavior observed at the interface with its environmentThe environment a critical component to be considered in the design of any systemThe systems we are concerned consist of

hardware andsoftware

Lecture 211

Two sources of complexity1. Cascading and interacting requirements

1.1 When the number of requirements grows then the number of exception grows. 1.2 The principle of escalating complexity:

Lecture 212

Two sources of complexity (cont’d)

1.3 Meeting many requirements with a single design the need for generality. Advice: avoid excessive generality.1.4 Requirement changes:

Example: the electric car produced by Tesla.

Lecture 113

Two sources of complexity (cont’d)

2. High performance2.1 Every system must satisfy performance standards. 2.2 The law of diminishing return the more one improves one performance metrics the more effort the next improvement will require

Lecture 214

Modularity for Coping with Complexity

Why does modularity reduce complexity we can focus on the interaction within one module/component.Example: assume that:

B - the # of bugs in a program is proportional with N , the number of statementsT- the time to debug a program is proportional with N x B thus it is proportional with N2

Now we divide the program in K modules each with N/K statements each:

The time to debug a module is proportional with (N/K)2

The time to debug the K modules is K x (N/K)2 = N2/KWe have reduced the time by a factor of K. Is that so?

Lecture 215

Abstractions and Coping with Complexity

Abstraction separation of the interface from the internals or specification from implementation

Example: you do not need to know how the engine of your car works in order to drive the car

Why abstractions reduce complexity because they minimize the interconnections between components.Observations:

Best division usually follows natural boundaries.The goal is defeated by unintentional or accidental interconnections among components.

Lecture 216

More about abstractions

• Abstractions are critical for understanding critical phenomena. Think about the abstract model of computation provided by the Turing Machine.

• Do not be carried away by abstractions. For example, often software designers think about an abstract computer and are not concerned about the physical resources available to them. E.g., the small display of a wireless phone.

Lecture 217

More about abstractions (cont’d)

The robustness principle be tolerant of inputs and strict on outputs.

Lecture 218

More about abstractions (cont’d)

The safety margin principle Keep track of the safety margin of the cliff or you may fall over edge!!

Lecture 219

Layering for Coping with Complexity

Layering building a set of successive functional entities with restricted communication patterns, a layer may only communicate with the layer below it and with the one above it.Examples: networking

Lecture 220

Hierarchy for Coping with Complexity

Hierarchical structures construct a large system from a small collection of relatively large subsystemsExamples:

CorporationsAn armyA computer is a collection of subsystems

Slides by Kaashoek & Morris

What went right?

Unbounded composibilityGeneral-purpose computers

Only need to make one thing fast

Separate architecture from implementationS/W can exploit new H/W

Cumulative R&D investment over years

Lecture 222

Names

Modularity along with abstraction, layering, and hierarchy allow a designer to cope with complexity;Names and addresses provide the means to connect modules. A system a bunch of resources, glued together with namesNaming allows the designer to:

Delay the implementation of some modules; use dummy onesReplace an implementation with another one.

Binding choosing an implementation for a moduleDelayed binding; use a place holder.

Lecture 223

Names and fundamental abstractions

The fundamental abstractions1. Storage mem, disk, data struct, File Systems, disk arrays2. Interpreters cpu, programming language e.g. java VM3. Communication wire, Ethernet

rely on names.Naming:

FlatHierarchical

Lecture 224

Computers a distinct species of complex systems

The complexity of computer systems not limited by the laws of physics distant bounds on composition

Digital systems are noise-free.The hardware is controlled by software

The rate of change unprecedentedThe cost of digital hardware has dropped in average 30% per year for the past 35 years

Lecture 225

Analog, digital, and hybrid systemsAnalog systems:

the noise from individual components accumulate and the number of components is limited

Digital systems:are noise-freethe number of components is not limitedregeneration restoration of digital signal levelsstatic discipline the range of the analog values a device accepts for each input digital value should be wider than the range of analog output valuesdigital components could fail but big mistakes are easier to detect than small ones!!

Hybrid systems e.g., quantum computers and quantum communication systems

Lecture 226

Computers are controlled by software

Composition of hardware limited by laws of physics.Composition of software is not physically constrained;

software packages of 107 lines of code exist

Abstractions hide the implementation beneath module interfaces and allow the

creation of complex softwaremodification of the modules

Abstractions can be leaky. Example, representation of integers, floating point numbers.

Lecture 227

Exponential growth of computersUnprecedented:

when a system is ready to be released it may already be obsolete. when one of the parameters of a system changes by a factor of

2 other components must be drastically altered due to the incommensurate scaling. 10 the systems must be redesigned; E.g.; balance CPU, memory, and I/O bandwidth;

does not give pause to developers to learn lessons from existing systemsfind and correct all errors

negatively affects “human engineering” ability to build reliable and user-friendly systemsthe legal and social frameworks are not ready

Lecture 228

Coping with complexity of computer systems

Modularity, abstraction, layering, and hierarchy are necessary but not sufficient.An additional technique iterationIteration

Design increasingly more complex functionality in the systemTest the system at each stage of the iteration to convince yourself that the design is soundEasier to make changes during the design process

Lecture 229

Iteration – design principles

Make it easy to changethe simplest version must accommodate all changes required by successive versionsdo not deviate from the original design rationalethink carefully about modularity it is very hard to change it.

Take small steps; rebuild the system every day, to discover design flaws and errors. Ask others to test it.Don’t rush to implementation. Think hard before starting to program.Use feedback judiciously

use alpha and beta versionsdo not be overconfident from an early success

Study failures understand that complex systems fail for complex reasons.

Lecture 230

Curbing complexity

In absence of physical laws curb the complexity by good judgment. Easier said than done because:

tempted to add new features than in the previous generationcompetitors have already incorporated the new features the features seem easy to implementthe technology has improvedhuman behavior: arrogance, pride, overconfidence…

Lecture 231

Resource sharing and complexity

A main function of the OS is resource sharing.Sharing computer resources went through several stages with different levels of complexity:

Many-to-oneOne-to-oneMany-to-manyPeer-to-peer

Lecture 132

33

HS – Homo SapiensPC- Personal Computer I

Host Guest

Host Guest

HostGuest

HostGuest

3434

Names and the three basic abstractions

Memory stores named objectswrite(name, value) value READ(name)file system: /dcm/classes/Fall09/Lectures/Lecture5.ppt

Interpreters manipulates named objectsmachine instructions ADD R1,R2modules Variables call sort(table)

Communication Links connect named objectsHTTP protocol used by the Web and file systemsHost: boticelli.cs.ucf.eduput /dcm/classes/Fall09/Lectures/Lecture5.pptget /dcm/classes/Fall09/Lectures/Lecture5.ppt

3535

MemoryHardware memory:

DevicesRAM (Random Access Memory) chipFlash memory non-volatile memory that can be erased and reprogrammedMagnetic tapeMagnetic DiskCD and DVD

SystemsRAIDFile systemsDBMS (Data Base management Systems)

3636

Attributes of the storage medium/system

Durability the time it remembers Stability whether or not the data is changed during the storagePersistence property of data storage system, it keeps trying to preserve the data

3737

Critical properties of a storage medium/system

Read/Write Coherence the result of a READ of a memory cell should be the same as the most recent WRITE to that cell.Before-or-after atomicity the result of every READ or WRITE is as if that READ or WRITE occurred either completely before or completely after any other READ or WRITE

3838

time

WRITE item A in cell M

AM

READ from cell M

AM

A A

Current READ/WRITE

Previous READ/WRITE

Next READ/WRITE

3939

Why it is hard to guarantee the critical properties? Concurrency multiple threads could READ/WRITE to the same cellRemote storage The delay to reach the physical storage may not guarantee FIFO operationOptimizations data may be buffered to increase I/O efficiencyCell size may be different than data size data may be written to multiple cells.Replicated storage difficult to maintain consistency.

4040

Access type; access time

Sequential access TapesCD/DVD

Random access devicesDisk

SeekSearch timeRead/Write time

RAM

41

Physical memory organizationRAM two dimensional array. To select a flip-flop provide the x and y coordinates.Tapes blocks of a given length and gaps (special combination of bits.Disk:

Multiple plattersCylinders correspond to a particular position of the moving armTrack circular pattern of bits on a given platter and cylinderRecord multiple records on a track

41

42

Names and physical addressesLocation addressed memory the hardware maps the physical coordinates to consecutive integers, addressesAssociative memory unrestricted mapping; the hardware does not impose any constraints in mapping the physical coordinates

42

Figure 2.2 from textrbook