45
11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz Lec24.1 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November 28, 2001 John Kubiatowicz (http.cs.berkeley.edu/~kubitron) lecture slides: http://www- inst.eecs.berkeley.edu/~cs152/

CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.1

CS152Computer Architecture and Engineering

Lecture 24

Busses (continued)Queueing Theory

Disk IO

November 28, 2001

John Kubiatowicz (http.cs.berkeley.edu/~kubitron)

lecture slides: http://www-inst.eecs.berkeley.edu/~cs152/

Page 2: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.2

Recap: Making address translation practical: TLB° Virtual memory => memory acts like a cache for the disk

° Page table maps virtual page numbers to physical frames

° Translation Look-aside Buffer (TLB) is a cache translations

PhysicalMemory Space

Virtual Address Space

TLB

Page Table

2

0

1

3

virtual address

page off

2frame page

250

physical address

page off

Page 3: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.3

TLB 4K Cache

10 2

00

4 bytes

index 1 K

page # disp20

assoclookup

32

Hit/Miss

FN Data Hit/Miss

=FN

What if cache size is increased to 8KB?

° If we do this in parallel, we have to be careful, however:

Recap: Overlapped TLB & Cache Access

Page 4: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.4

Recap: A Three-Bus System (+ backside cache)

° A small number of backplane buses tap into the processor-memory bus• Processor-memory bus is only used for processor-memory traffic• I/O buses are connected to the backplane bus

° Advantage: loading on the processor bus is greatly reduced

Processor Memory

Processor Memory Bus

BusAdaptor

BusAdaptor

BusAdaptor

I/O Bus

BacksideCache bus

I/O BusL2 Cache

Page 5: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.5

Recap: Main components of Intel Chipset: Pentium II/III

° Northbridge:

• Handles memory

• Graphics

° Southbridge: I/O

• PCI bus

• Disk controllers

• USB controlers

• Audio

• Serial I/O

• Interrupt controller

• Timers

Page 6: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.6

° Synchronous Bus:

• Includes a clock in the control lines

• A fixed protocol relative to the clock

• Advantage: little logic and very fast

• Disadvantages:

- Every device on the bus must run at the same clock rate

- To avoid clock skew, they cannot be long if they are fast

° Asynchronous Bus:

• It is not clocked

• It can accommodate a wide range of devices

• It can be lengthened without worrying about clock skew

• It requires a handshaking protocol

Recap: Synchronous and Asynchronous Bus

Page 7: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.7

Multiple Potential Bus Masters: the Need for Arbitration° Bus arbitration scheme:• A bus master wanting to use the bus asserts the bus request• A bus master cannot use the bus until its request is granted• A bus master must signal to the arbiter after finish using the bus

° Bus arbitration schemes usually try to balance two factors:• Bus priority: the highest priority device should be serviced first• Fairness: Even the lowest priority device should never

be completely locked out from the bus° Bus arbitration schemes can be divided into four broad classes:

• Daisy chain arbitration• Centralized, parallel arbitration• Distributed arbitration by self-selection: each device wanting the bus places a

code indicating its identity on the bus.• Distributed arbitration by collision detection:

Each device just “goes for it”. Problems found after the fact.

Page 8: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.8

° One of the most important issues in bus design:

• How is the bus reserved by a device that wishes to use it?

° Chaos is avoided by a master-slave arrangement:

• Only the bus master can control access to the bus:

It initiates and controls all bus requests

• A slave responds to read and write requests

° The simplest system:

• Processor is the only bus master

• All bus requests must be controlled by the processor

• Major drawback: the processor is involved in every transaction

BusMaster

BusSlave

Control: Master initiates requests

Data can go either way

Arbitration: Obtaining Access to the Bus

Page 9: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.9

The Daisy Chain Bus Arbitrations Scheme

° Advantage: simple

° Disadvantages:

• Cannot assure fairness: A low-priority device may be locked out indefinitely

• The use of the daisy chain grant signal also limits the bus speed

BusArbiter

Device 1HighestPriority

Device NLowestPriority

Device 2

Grant Grant Grant

Release

Request

wired-OR

Page 10: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.10

° Used in essentially all processor-memory busses and in high-speed I/O busses

BusArbiter

Device 1 Device NDevice 2

Grant Req

Centralized Parallel Arbitration

Page 11: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.11

° Separate versus multiplexed address and data lines:• Address and data can be transmitted in one bus cycle

if separate address and data lines are available

• Cost: (a) more bus lines, (b) increased complexity

° Data bus width:• By increasing the width of the data bus, transfers of multiple words require

fewer bus cycles

• Example: SPARCstation 20’s memory bus is 128 bit wide

• Cost: more bus lines

° Block transfers:• Allow the bus to transfer multiple words in back-to-back bus cycles

• Only one address needs to be sent at the beginning

• The bus is not released until the last word is transferred

• Cost: (a) increased complexity (b) decreased response time for request

Increasing the Bus Bandwidth

Page 12: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.12

° Overlapped arbitration• perform arbitration for next transaction during current transaction

° Bus parking• master can holds onto bus and performs multiple transactions as long

as no other master makes request

° Overlapped address / data phases (prev. slide)• requires one of the above techniques

° Split-phase (or packet switched) bus• completely separate address and data phases

• arbitrate separately for each

• address phase yield a tag which is matched with data phase

° ”All of the above” in most modern buses

Increasing Transaction Rate on Multimaster Bus

Page 13: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.13

What is DMA (Direct Memory Access)?° Typical I/O devices must

transfer large amounts of data to memory of processor:

• Disk must transfer complete block • Large packets from network• Regions of frame buffer

° DMA gives external device ability to access memory directly: much lower overhead than having processor request one word at a time.

° Issue: Cache coherence:• What if I/O devices write data that is currently in processor Cache?

- The processor may never see new data!• Solutions:

- Flush cache on every I/O operation (expensive)- Have hardware invalidate cache lines (remember “Coherence”

cache misses?)

Page 14: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.14

Administrivia

° Get going on Lab 7!

• Status update due Monday in Section

• Talk with Tas about the state of your project

° Midterm II on Friday

• 5:30 – 8:30 in 277 Cory- Pizza afterwards

• Topics- Pipelining- Caches/Memory systems- Buses and I/O (Disk equation)- Power- Queueing theory?

• Can bring 1 page of notes- Handwitten, double-sided- CLOSED BOOK!

Page 15: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.15

I/O System Design Issues

Processor

Cache

Memory - I/O Bus

MainMemory

I/OController

Disk Disk

I/OController

I/OController

Graphics Network

interrupts

• Performance

• Expandability

• Resilience in the face of failure

Page 16: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.16

I/O Device Examples

Device Behavior Partner Data Rate (KB/sec)

Keyboard Input Human 0.01

Mouse Input Human 0.02

Line Printer Output Human 1.00

Floppy disk Storage Machine 50.00

Laser Printer Output Human 100.00

Optical Disk Storage Machine 500.00

Magnetic Disk Storage Machine 5,000.00

Network-LAN Input or Output Machine 20 – 1,000.00

Graphics Display Output Human 30,000.00

Page 17: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.17

I/O System Performance

° I/O System performance depends on many aspects of the system (“limited by weakest link in the chain”):

• The CPU

• The memory system:

- Internal and external caches

- Main Memory

• The underlying interconnection (buses)

• The I/O controller

• The I/O device

• The speed of the I/O software (Operating System)

• The efficiency of the software’s use of the I/O devices

° Two common performance metrics:

• Throughput: I/O bandwidth

• Response time: Latency

Page 18: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.18

Simple Producer-Server Model

° Throughput:

• The number of tasks completed by the server in unit time

• In order to get the highest possible throughput:

- The server should never be idle

- The queue should never be empty

° Response time:

• Begins when a task is placed in the queue

• Ends when it is completed by the server

• In order to minimize the response time:

- The queue should be empty

- The server will be idle

Producer ServerQueue

Page 19: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.19

Throughput versus Respond Time

20% 40% 60% 80% 100%

ResponseTime (ms)

100

200

300

Percentage of maximum throughput

Page 20: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.20

Throughput Enhancement

° In general throughput can be improved by:

• Throwing more hardware at the problem

• reduces load-related latency

° Response time is much harder to reduce:

• Ultimately it is limited by the speed of light (but we’re far from it)

Producer

ServerQueue

QueueServer

Page 21: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.21

Disk Capacity now doubles every 18 months; before1990 every 36 months

• Today: Processing Power Doubles Every 18 months

• Today: Memory Size Doubles Every 18 months(4X/3yr)

• Today: Disk Capacity Doubles Every 18 months

• Disk Positioning Rate (Seek + Rotate) Doubles Every Ten Years!

The I/OGAP

The I/OGAP

Technology Trends

Page 22: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.22

° Driven by the prevailing computing paradigm• 1950s: migration from batch to on-line processing

• 1990s: migration to ubiquitous computing

- computers in phones, books, cars, video cameras, …

- nationwide fiber optical network with wireless tails

° Effects on storage industry:• Embedded storage

- smaller, cheaper, more reliable, lower power

• Data utilities

- high capacity, hierarchically managed storage

Storage Technology Drivers

Page 23: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.23

Data densityMbit/sq. in.

Capacity ofUnit ShownMegabytes

1973:1. 7 Mbit/sq. in140 MBytes

1979:7. 7 Mbit/sq. in2,300 MBytes

source: New York Times, 2/23/98, page C3, “Makers of disk drives crowd even mroe data into even smaller spaces”

Disk History

Page 24: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.24

1989:63 Mbit/sq. in60,000 MBytes

1997:1450 Mbit/sq. in2300 MBytes

source: New York Times, 2/23/98, page C3, “Makers of disk drives crowd even more data into even smaller spaces”

1997:3090 Mbit/sq. in8100 MBytes

Disk History

Page 25: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.25

0%

5%

10%

15%

20%

25%

30%

35%

40%

1974 1980 1986 1992 1998

source: New York Times, 2/23/98, page C3, “Makers of disk drives crowd even more data into even smaller spaces”

470 v. 3000 Mb/si

9 v. 22 Mb/si

0.2 v. 1.7 Mb/si

MBits per square inch: DRAM as % of Disk over time

Page 26: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.26

Nano-layered Disk Heads

° Special sensitivity of Disk head comes from “Giant Magneto-Resistive effect” or (GMR)

° IBM is leader in this technology• Same technology as TMJ-RAM breakthrough we described in

earlier class.

Coil for writing

Page 27: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.27

Organization of a Hard Magnetic Disk

° Typical numbers (depending on the disk size):

• 500 to 2,000 tracks per surface

• 32 to 128 sectors per track

- A sector is the smallest unit that can be read or written

° Traditionally all tracks have the same number of sectors:

• Constant bit density: record more sectors on the outer tracks

• Recently relaxed: constant bit size, speed varies with track location

Platters

Track

Sector

Page 28: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.28

Magnetic Disk Characteristic

° Cylinder: all the tacks under the head at a given point on all surface

° Read/write data is a three-stage process:

• Seek time: position the arm over the proper track

• Rotational latency: wait for the desired sectorto rotate under the read/write head

• Transfer time: transfer a block of bits (sector)under the read-write head

° Average seek time as reported by the industry:

• Typically in the range of 8 ms to 12 ms

• (Sum of the time for all possible seek) / (total # of possible seeks)

° Due to locality of disk reference, actual average seek time may:

• Only be 25% to 33% of the advertised number

SectorTrack

Cylinder

HeadPlatter

Page 29: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.29

Typical Numbers of a Magnetic Disk

° Average seek time as reported by the industry:• Typically in the range of 8 ms to 12 ms• Due to locality of disk reference may

only be 25% to 33% of the advertised number

° Rotational Latency:• Most disks rotate at 3,600 to 7200 RPM• Approximately 16 ms to 8 ms

per revolution, respectively• An average latency to the desired

information is halfway around the disk: 8 ms at 3600 RPM, 4 ms at 7200 RPM

° Transfer Time is a function of :• Transfer size (usually a sector): 1 KB / sector• Rotation speed: 3600 RPM to 10000 RPM• Recording density: bits per inch on a track• Diameter typical diameter ranges from 2.5 to 5.25 in• Typical values: 2 to 40 MB per second

SectorTrack

Cylinder

HeadPlatter

Page 30: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.30

Disk I/O Performance

° Disk Access Time = Seek time + Rotational Latency + Transfer time

+ Controller Time + Queueing Delay

° Estimating Queue Length:

• Utilization = U = Request Rate / Service Rate= / • Mean Queue Length = U / (1 - U)

• As Request Rate -> Service Rate

- Mean Queue Length -> Infinity

ProcessorQueue

DiskController

Disk

Service RateRequest Rate

Queue

DiskController

Disk

Page 31: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.31

Disk Latency = Queueing Time + Controller time + Seek Time + Rotation Time + Xfer Time

Order of magnitude times for 4K byte transfers:

Average Seek: 8 ms or less

Rotate: 4.2 ms @ 7200 rpm

Xfer: 1 ms @ 7200 rpm

Disk Device Terminology

Page 32: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.32

Example

° 512 byte sector, rotate at 5400 RPM, advertised seeks is 12 ms, transfer rate is 4 MB/sec, controller overhead is 1 ms, queue idle so no service time

° Disk Access Time = Seek time + Rotational Latency + Transfer time

+ Controller Time + Queueing Delay

° Disk Access Time = 12 ms + 0.5 / 5400 RPM + 0.5 KB / 4 MB/s + 1 ms + 0

° Disk Access Time = 12 ms + 0.5 / 90 RPS + 0.125 / 1024 s + 1 ms + 0

° Disk Access Time = 12 ms + 5.5 ms + 0.1 ms + 1 ms + 0 ms

° Disk Access Time = 18.6 ms

° If real seeks are 1/3 advertised seeks, then its 10.6 ms, with rotation delay at 50% of the time!

Page 33: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.33

Reliability and Availability

° Two terms that are often confused:

• Reliability: Is anything broken?

• Availability: Is the system still available to the user?

° Availability can be improved by adding hardware:

• Example: adding ECC on memory

° Reliability can only be improved by:

• Better environmental conditions

• Building more reliable components

• Building with fewer components

- Improve availability may come at the cost of lower reliability

Page 34: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.34

Simple Producer-Server Model

° Throughput:

• The number of tasks completed by the server in unit time

• In order to get the highest possible throughput:

- The server should never be idle

- The queue should never be empty

° Response time:

• Begins when a task is placed in the queue

• Ends when it is completed by the server

• In order to minimize the response time:

- The queue should be empty

- The server will be idle

Producer ServerQueue

Page 35: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.35

Disk I/O Performance

Response time = Queue + Device Service time

100%

ResponseTime (ms)

Throughput (% total BW)

0

100

200

300

0%

Proc

Queue

IOC Device

Metrics: Response Time Throughput

latency goes as Tser×u/(1-u) u = utilization

Page 36: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.36

° Queueing Theory applies to long term, steady state behavior Arrival rate = Departure rate

° Little’s Law: Mean number tasks in system = arrival rate x mean reponse time

• Observed by many, Little was first to prove• Simple interpretation: you should see the same number of

tasks in queue when entering as when leaving.

° Applies to any system in equilibrium, as long as nothing in black box is creating or destroying tasks

“Black Box”Queueing

System

Arrivals Departures

Introduction to Queueing Theory

Page 37: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.37

° Queuing models assume state of equilibrium: input rate = output rate

° Notation: average number of arriving customers/secondTser average time to service a customer (tradtionally µ = 1/ Tser )u server utilization (0..1): u = x Tser (or u = / µ )Tq average time/customer in queue Tsys average time/customer in system: Tsys = Tq + Tser

Lq average length of queue: Lq = x Tq

Lsys average length of system: Lsys = x Tsys

° Little’s Law: Lsys = x Tsys(Mean number customers = arrival rate x mean service time)

Proc IOC Device

Queue server

System

A Little Queuing Theory: Notation

Page 38: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.38

° Server spends a variable amount of time with customers• Weighted mean m1 = (f1 x T1 + f2 x T2 +...+ fn x Tn)/F

= p(T)xT• variance = (f1 x T12 + f2 x T22 +...+ fn x Tn2)/F – m12

= p(T)xT2 - m12

• Squared coefficient of variance: C = variance/m12

- Unitless measure (100 ms2 vs. 0.1 s2)° Exponential distribution C = 1 : most short relative to average, few others

long; 90% < 2.3 x average, 63% < averageHypoexponential distribution C < 1 : most close to average, C=0.5 => 90% < 2.0 x average, only 57% < averageHyperexponential distribution C > 1 : further from average C=2.0 => 90% < 2.8 x average, 69% < average

Avg.

A Little Queuing Theory: Use of random distributions

Avg.

0

Proc IOC Device

Queue server

System

Page 39: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.39

° Disk response times C 1.5 (majority seeks < average)° Yet usually pick C = 1.0 for simplicity

• Memoryless, exponential dist• Many complex systems well described

by memoryless distribution!° Another useful value is average time

must wait for server to complete current task: m1(z)• Not just 1/2 x m1 because doesn’t capture variance• Can derive m1(z) = 1/2 x m1 x (1 + C)• No variance C= 0 => m1(z) = 1/2 x m1• Exponential C= 1 => m1(z) = m1

A Little Queuing Theory: Variable Service Time

Proc IOC Device

Queue server

System

Avg.

0 Time

Page 40: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.40

° Calculating average wait time in queue Tq:• If something at server, it takes to complete on average m1(z)• Chance server is busy = u; average delay is u x m1(z)

• All customers in line must complete; each avg Tser

Tq = u x m1(z) + Lq x Ts er

Tq = u x m1(z) + x Tq x Ts er

Tq = u x m1(z) + u x Tq

Tq x (1 – u) = m1(z) x uTq = m1(z) x u/(1-u) = Ts er x {1/2 x (1+C)} x u/(1 – u))

Notation: average number of arriving customers/second

Tser average time to service a customeru server utilization (0..1): u = x Tser

Tq average time/customer in queueLq average length of queue:Lq= x Tq

m1(z) average residual wait time = Ts er x {1/2 x (1+C)}

A Little Queuing Theory: Average Wait Time

Little’s Law

Defn of utilization (u)

Page 41: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.41

° Assumptions so far:• System in equilibrium• Time between two successive arrivals in line are random• Server can start on next customer immediately after prior finishes• No limit to the queue: works First-In-First-Out• Afterward, all customers in line must complete; each avg Tser

° Described “memoryless” or Markovian request arrival (M for C=1 exponentially random), General service distribution (no restrictions), 1 server: M/G/1 queue

° When Service times have C = 1, M/M/1 queueTq = Tser x u / (1 – u)

Tser average time to service a customeru server utilization (0..1): u = x TserTq average time/customer in queue

A Little Queuing Theory: M/G/1 and M/M/1

Page 42: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.42

° Processor sends 10 x 8KB disk I/Os per second, requests & service exponentially distrib., avg. disk service = 20 ms

• This number comes from disk equation:Service time = Ave seek + ave rot delay + transfer time + ctrl overhead

° On average, how utilized is the disk?• What is the number of requests in the queue?• What is the average time spent in the queue?• What is the average response time for a disk request?

° Notation: average number of arriving customers/second = 10Tser average time to service a customer = 20 ms (0.02s)u server utilization (0..1): u = x Tser= 10/s x .02s = 0.2Tq average time/customer in queue = Tser x u / (1 – u)

= 20 x 0.2/(1-0.2) = 20 x 0.25 = 5 ms (0 .005s)Tsys average time/customer in system: Tsys =Tq +Tser= 25 msLq average length of queue:Lq= x Tq

= 10/s x .005s = 0.05 requests in queueLsys average # tasks in system: Lsys = x Tsys = 10/s x .025s = 0.25

A Little Queuing Theory: An Example

Page 43: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.43

Memory System I/O Performance?

° Pipelined Bus with queue at controller?

• Time to transfer request

• Tqueue= Queueing Delay+service time

• Time to transfer data

° DRAM has DETERMINISTIC service time

• Tser= tRAC + (n-1) * tPC + tprecharge

• Tq = m1(z) x u/(1-u) = Ts er x {1/2 x (1+C)} x u/(1 – u))with C=0

Processor

Queue

DRAM

Service Rate?Request Rate

MemoryController

Page 44: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.44

Bus Summary

° Buses are an important technique for building large-scale systems

• Their speed is critically dependent on factors such as length, number of devices, etc.

• Critically limited by capacitance• Tricks: esoteric drive technology such as GTL

° Important terminology:• Master: The device that can initiate new transactions• Slaves: Devices that respond to the master

° Two types of bus timing:• Synchronous: bus includes clock• Asynchronous: no clock, just REQ/ACK strobing

° Direct Memory Access (DMA) allows fast, burst transfer into processor’s memory:

• Processor’s memory acts like a slave• Probably requires some form of cache-coherence so that DMA’ed

memory can be invalidated from cache.

Page 45: CS152 / Kubiatowicz Lec24.1 11/28/01©UCB Fall 2001 CS152 Computer Architecture and Engineering Lecture 24 Busses (continued) Queueing Theory Disk IO November

11/28/01 ©UCB Fall 2001 CS152 / Kubiatowicz

Lec24.45

I/O Summary:° I/O performance limited by weakest link in chain between OS and device

° Queueing theory is important

• 100% utilization means very large latency

• Remember, for M/M/1 queue (exponential source of requests/service)

- queue size goes as u/(1-u)

- latency goes as Tser×u/(1-u)

• For M/G/1 queue (more general server, exponential sources)

- latency goes as m1(z) x u/(1-u) = Tser x {1/2 x (1+C)} x u/(1-u)

° Three Components of Disk Access Time:

• Seek Time: advertised to be 8 to 12 ms. May be lower in real life.

• Rotational Latency: 4.1 ms at 7200 RPM and 8.3 ms at 3600 RPM

• Transfer Time: 2 to 12 MB per second

° I/O device notifying the operating system:

• Polling: it can waste a lot of processor time

• I/O interrupt: similar to exception except it is asynchronous

° Delegating I/O responsibility from the CPU: DMA, or even IOP