An approximation algorithm for reducing expected head movement in linear storage devices

An approximation algorithm for reducing expected head movement in linear storage devices

Volume 13, numbers 4, S INFORMATIONPROCESSINGWM’ERS End 1981 AN APPROXIMA’I.!ON ALGORITIIlHFOR REDUCINGEXPECTEDHEAD MOVEMENTIN LINEAR STORAGE DEVIC...

380KB Sizes 3 Downloads 14 Views

Volume 13, numbers 4, S

INFORMATIONPROCESSINGWM’ERS

End 1981

AN APPROXIMA’I.!ON ALGORITIIlHFOR REDUCINGEXPECTEDHEAD MOVEMENTIN LINEAR STORAGE DEVICES J.M.TROYAarrAA. VAQUERO

Departamento de hforrnhica y Automritica, Facultad de ciencias l%iCas, Unive&bd CbW@iiteW%hfh%$

&Mh

Received December 1988

Placement of records, linear storage devices, Markovchain, approximation aIgo&hm, thne complexity, w&&ted graph

1. Introduction Weconsider the problem of placement of records on linear storage devices in order to minimize the expected read/write head movement. Tape is the proto-typical linear storage device, but the cylinders of a di& also can be seen as a linear medium when the read/write heads are movables [ 11. Weassume that the access mechanism movement is uniform and the same in the two directions. In general, it may be assumed that the access sequence is a stationary Markov chain with n states, each one representing one recqrd [2]. If pu is the probability of making a transition to record j when the device is at record i, and si is the steady state probability for accessing record i, the cost function for a permutation ll of the records is: n

n

(0 where Ilti, 4 = 1ni - rrj) denotes the distance between

the framesni and tlj on the assumptionthat the dlstance between two consecutiveframesis the unit. The cost function can be modlfIedby defining a weightedgraphG =(V, E) in the following way: (a) Eachvertex,vi E V representsone recordi, 1
The problemof tiding a permutationofminimum cost has no solution ln polynomialtlme becausethe correspondingdecisionproblem(optimallinear arrangementproblem)is N&complete[3]. An optlmalsolution may be obtalnedln polynomialtime for two specld cases:independentaccessprobablllties and purelysequent181 accesses[4]. A dynamicpm grammingalgorithmof time complexity0(n32”) to obtain an optimalsolution and an approximation algorithmof time compfexity 0(n3) may be viewed in [S]. In this paperwe show an 0(n2) approximation algorithmthat obtainsgood approximatesolutions. 2. The

Fig. 1. Markovdiagram,and associated graph. 218

algorith .n

For independentsecordrequeststhe optimalsolution is obtainedby placingthe most frequently 002@0190)81@030-0000/$02X (181981 North-Holland

f~~A~ONPRocEssINGtMTEPS

End 1981 .

where record alternatingbetween to the left of these already

Similarly,if q is addedto the left of a partial arrangement Am, the cost for the new partial arrangement A&+*is increasedin: ndent accesses[4] but may be regardedas benchma&for comparisonwith other placementalgorithms[7]. A similarscheme, accord@tothecreatedgtaph,htoarrangethe recordsby the rankiq WI, ...) w,,, where c wg w5Q.v1)E”

VVJEV,

(3)

we name wi the weigbt of the vertexvi and the permutation obtainedby this policy the standardarrangement In general,from these two schemes,the same arrangementis obtainedbecausea higheraccessprobabiUtynormallycorrespondsto a hi#er weight. Wepresentan O(n2) approxim&ionalgorithmthat armngesthe recordsaccordingto the ranking w,,, as the previousscheme does, but pIaces w1 each vertex,consideringthe partialcosts, as follows. l

l

l

IMnMon.ApastMarrangementA,ofsizemisa lineararrangementof m verticesof V. The cost of a partialarrangementAmis:

If a vertexq is addedto the rightof a partialarrangement Am,,the cost of the new partialarrangement Am;r k W%n*IPEl = Wh,,

E) + Wvi,

A,,,) 9

cL(q, Am) =

c

Wij .

(vi,v&E

QAi,A; Vtij E A, .

(6)

Thus, thealgorithmis:

Step 1. (Sort): Sort the vector of vertices V in orderof decreasingweights. Step 2. (Generate AI, AZ, .... Am): CreateAl with V, ; form:=2 tondo if CL&,, A,,,) > CR@&, A,,.,)then add Vm on the rightof A, e&e add V, on the left of A,. As the operationsCL(V,, Am) and CR(V,, Am) may be done in time O(n) the arrangementis generated in time 0(n2). The time used in Step 1 depends on the sorting methods used [6], but it is not higher than O(n2). Therefore the time complexity of the algorithm is 0(n2).

3. Evaluationof the algorithm The algorithm obtains optimal solutions for the two extreme cases of independent and purely sequential accessespreviously mentioned, as it can be easily proved by building up the corresponding graphs from the Markov transition matrices. WCcompare the costs of the permutations obtamed by the algorithm wtth the costs of the standard

Table i w= 35

N= 20

N=50

PI = 0.3

Pl=ow7

Pl = 1

Pl = 0.3

Pl = 0.7

Pl = 1

Pl = 0.3

PI = 0.7

Pl = 1

2 10

aL9936

0.9992

0.9836

0.9985

0.9982

0.9954

a4767

0.6295

0.7980

0.7109

20 3s SO

a2005

0.3465

as493

0.3711

0.6755 0.4941 0.2492

0.7802 0.6893 0.4702

0.9971 0.7651 0.5 168 0.1755 0.0834

0.9977 0.7541 0.6121 0.3181 0.2023

0.9980 0.8762 0.7207 0.5 246 0.4297

0.1167

219

arrangement for a great variety of Markov transition

matrices. These matrices are built up in the following way: first, we construct the matrix for independent access from selected distributions. One of the distributions used is given by si = (l/iP’) k where pl is a parameter and k is the normalization constant for the condition &si = 1. We pass from the Markov matrix to the graph matrix, and then we introduce the sequentiality as follows. Weuse a parameter p2 to measure the dependence between the record accesses in such a way that when p2 increases, the number of edges decreases, and the record accesses are more sequential. So, for each row i of the graph matrix, we delete the (i, k)-ih elements, such that k #j and j=l+i+m=p2,O
4. Conclusion . Wehave presentedan O(nl) approximation alinear recotds

l

dent. The performanceof the al&hm haabeen comparedwith the performanceof a placement rithmthat is optimumwhen the recordrequestsare independent.

[l] E.G. Coffman Jr. and P.J. Dannine, Opwat@ Systems Theory (Prentice Hal&En&wood CUf%,NJ, 19?3). (2) C.K. Wons, Minimb@ expected hsrd movement in onedimensional and twodimensiomd RUSS rtongQ systems, Comput. Sways 12 (2) (1980). M.R Carey, D.S.Johnson and L Stockmeyw, Some simplified Npcomplete graph ptilenu, Theomt. Comput. Sci, l(1976). t41 D.D.Grossmanand H.F. Sihwmtn, Pi&cementof xecords on a secondary storcsgadevke to minimho accws time, J. ACM 20 (3) (1973). VI A. Vaquero and J.M. Troya, placementofmcordson linear storage devices, Proc. of tho 8th WorldComputer coIFIPcon@e!M(k VI F. Knuth, The Art of Computer prOenmm@ (Addison= Wesley,Readine,IMA)vol. 3, chap 5. VI P.C.Yue andCK. Wane,On tho optimalityof the probe bilityrank@ schemein stem applications,J. ACM 20

(4) (1973).

220

End 1981

INFORMATION PROCESSING LETTERS

Volume13, numbers4,s