MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

32
MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007

Transcript of MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Page 1: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

MM File Management

Karrie Karahlaios and Brian P. BaileySpring 2007

Page 2: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Announcements

Page 3: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Physical Disk Structure

• Sector• Track• Platter• Cylinder• R/W head

• Example– 16 heads x 1400 cyls x

16 sectors/track x 512 bytes/sector = 183.5MB

Page 4: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Measures of Performance

• Seek time (ms)– time to move disk arm

to a specific track

• Latency (ms)– time for sector to

rotate under disk arm

• Transfer rate (Mbps)– data that can be read

in one time unit

Page 5: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Zoned Bit Recording

• Utilize larger, outer tracks– early disks could not handle

varying number of sectors / track– reduce density of outer sectors

• Each zone (set of tracks) has variable number of sectors– outer part can hold more data

and support higher transfer rates

Page 6: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

File System

• Mapped onto physical disk structure– want to match user’s conceptual model

• Collection of files and directories– file is logical storage unit– directories contain information about files

(names, type, location, size, protection, etc.)• Basic operations

– create, write, read, reposition, delete– sequential and random access

Page 7: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Allocation Methods

• Contiguous

• Linked

• Constrained

• Striping

• … and many others

Page 8: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Continuous

• Occupy contiguous set of blocks

• Strengths– minimizes seek time– supports sequential and random access

• Weaknesses– suffers external fragmentation

Page 9: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Linked

• Stored as a linked list of blocks

• Strengths– eliminates external fragmentation– supports files of arbitrary length

• Weaknesses– random access slow, overhead of pointers– susceptible to block errors

Page 10: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Constrained

• Linked structure, but allocate next block based on “distance” from previous one– distance = predicted seek and latency

• Strengths– improves sequential access– minimizes seek time

• Weaknesses– increases algorithm complexity

Page 11: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Striping (RAID-0)

• Stripe file across an array of N disks– divide file into stripes, dive stripe into units,

assign each unit to different disk

• Strengths– reduces disk access time by N

• Weaknesses– susceptible to failure of any one disk – p(failure) = N * p(any one disk failing)

Page 12: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

MM File System Requirements

• Storing/retrieving multimedia files – large size; continuous periodic requests

• Maintain high throughput

• Support RT and non RT requests

• Guarantee a sustained level of service

Page 13: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Meeting the Requirements

• Methods of placing data on disk

• Scheduling algorithms

• Admission control policies

• Maximize transfer time

Page 14: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Zipfs Law

• Probability of occurrence of the kth most common word is proportional to 1/k– applies to many observable events

• More generallyPi = k / iα where

– i is the ith most popular item; k is a constant; alpha is close to 1

Page 15: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Apply to File Allocation

• For multimedia, assume that– alpha=1

– Sum(Pi)=1

• Compute the probability of each multimedia file being accessed– use for layout and prefetching

Page 16: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Scheduling Algorithms

• FCFS

• SSTF

• SCAN and C-SCAN

• EDF

• SCAN-EDF

• Understand each algorithm and weigh advantages and disadvantages

Page 17: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

FCFS

• Serve requests based on incoming order

• Inherently fair

• Does not consider location of requests– can lead to high overhead

Page 18: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

SSTF

• Select request closest to current position– minimizes seek time/overhead

• May cause starvation of some requests

Page 19: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

SCAN and C-SCAN

• Serves all requests in current direction– reverses when no more requests– serves middle tracks better than edges

• C-SCAN scans across disk in cycles– more fair to the edge tracks

Page 20: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

EDF

• Attach deadlines to each request– select request with earliest deadline– can have high overhead

Page 21: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

SCAN-EDF

• SCAN-EDF selects – earliest deadline, or if same deadline– select request closest to the disk’s center

• Use EDF, but perturb deadlines– Di = Di + f(Ni); where f(Ni) = Ni / Nmax

– Consider direction?

Page 22: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Admission Control

• Based on the admission control policy discussed in the paper:

– C. Martin, P.S. Narayan, B. Ozden, R. Rastogi, and A. Silberschatz. The Fellini Multimedia Storage System, Journal of Digital Libraries, 1997.

Page 23: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Mathematical Setup

• Client requests received in cycles of duration T– T is referred to as the common period of the system– assumes circular (C-SCAN) scan of the disk

– consumption rate of each real-time client is ri

• Retrieval rate for each client must be > T*ri

• Ensure that the file system in each period T can retrieve T*ri bits for each client

Page 24: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Setup (cont.)

• Serve both real and non-real time clients

• Serve real-time clients using fraction of T– Use to serve real-time clients– Use to serve non real-time clients

• To retrieve T*ri bits for each client, the controller must ensure time to retrieveT*r1, …, T*rn bits does not exceed

TT )1(

T

Page 25: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Number of Disk Blocks

• If b is block size, then maximum number of disk blocks to be retrieved for ri is

b

rT i

Page 26: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Latency

• Retrieval of a disk block involves a seek to the track containing the block, a settle time delay, and a rotational delay

• Let tseek, trot, and tsettle be the worst case times for each measure

Page 27: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Maximum Latency

• Thus, the maximum latency for servicing clients r1, r2, …, rq is

q

i

settleroti

seek ttb

rTt

1

)()(2

Page 28: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Transfer Time

• If the transfer rate from the innermost track of the disk is rdisk, then the time to transfer T*ri bits of data for request ri is

disk

i

r

rT

Page 29: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Admission for Real-Time Clients

• Thus, the total time to retrieve T*r1, …, T*rq bits for requests R1, …, Rq is the sum of the latency and transfer times

• Admit new client, if on adding it, this equation is still satisfied

Tr

rTtt

b

rTt

q

i disk

iq

i

settleroti

seek

11

)()(2

Page 30: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Admission for Non RT Clients

• Remainder of the period is for requests from non real-time clients

• Let di be the data requested from Ci

• Number of blocks is

T )1(

b

di

Page 31: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Admission for Non RT Clients

• For each request, latency plus transfer time is

• Over all requests p, this becomes

• Admit new non RT client, if on adding it, above equation is still satisfied

disk

isettlerot

i

r

dtt

b

d

)(

p

i

p

i disk

isettlerot

iT

r

dtt

b

d

1 1

*)1()(

Page 32: MM File Management Karrie Karahlaios and Brian P. Bailey Spring 2007.

Example

• Transfer rate (rdisk) = 100 KB / sec

• Cycle time (T) = 10ms

• Max latency = 1ms

• Client A data rate (r1) = 45 KB/sec

• Client B data rate (r2) = 40 KB/sec

• Are the two real-time clients admissible?

• If so, what proportion of the cycle time is needed to serve these clients?