• Aucun résultat trouvé

Determining Size and Location of a Disk File

A n o t h e r a s p e c t o f t h e p l a n n i n g s t a g e is d e t e r m i n i n g (1 ) h o w m u c h d i s k s p a c e a f i l e r e q u i r e s a n d ( 2 ) w h e r e t h e f i l e w i l l b e l o c a t e d o n t h e d i s k . T h e s e tw o f a c t o r s m u s t b e c o n s i d e r e d t o g e t h e r s i n c e th e y d i r e c t l y a f f e c t e a c h o t h e r . F o r e x a m p l e , t w o f i l e s a r e a l r e a d y w r i t t e n o n a d i s k , o n c y l i n d e r s 8 - 1 5 5 . A t h i r d f i l e i s t o b e c r e a t e d ; i t w i l l o c c u p y 5 5 c y l i n d e r s . S i n c e th e d i s k i n t h i s e x a m p l e c o n t a i n s 2 0 0 c y l i n d e r s , t h i s f i l e h a s to o m a n y c y l i n d e r s to b e c o n t a i n e d o n t h i s d i s k ( 1 5 S + S S = 2 1 0 ) . T h e f i l e m u s t b e w r i t t e n o n a n o t h e r d i s k .

1 .

2 .

3 .

48

Determining the Size of a Disk File

A p p e n d i x A c o n t a i n s e x a m p l e s o f t h e c a l c u l a t i o n s n e c e s s a r y t o d e t e r m i n e h o w m u c h s p a c e a d i s k fi l e r e q u i r e s . T h e fo l l o w i n g f a c t o r s a r e d i s c u s s e d i n A p p e n d i x A :

D e t e r m i n i n g n u m b e r o f r e c o r d s i n a f i l e Calculating record space

. Determining number of tracks needed (5444 and 5445)

o C a l c u l a t i n g i n d e x s p a c e (5 4 4 4 a n d 5 4 4 5 )

o C a l c u l a t i n g s p a c e f o r d i s k t r a c k i n d e x ( b 4 4 5 o n l y )

N o t e : f h e f i l e p l a n n i n g in f o r m a t i o n d i s c u s s e d i n t h i s s e c t i o n is b a s i c a l l y t h e s a m e f o r t h e I B M 5 4 4 4 a n d t h e I B M 5 4 4 5 . T h e c a l c u l a t i o n s f o r d e t e r m i n i n g th e s i z e o f a d i s k f i l e ( A p p e n d i x A ) a r e d i f f e r e n t , h o w e v e r , b e c a u s e : th e 5 4 4 5 h a s only 20 sectors per track as compared to 24 sectors per track for the 5444;tor an indexed file, the disk address in the index entry is four characters in the 5445 instead of three in the 5444; and, a disk track index may exist for a 5445 file, but not for a 5444lile.

Deciding Where the File on Disk is to be Located

A f t e r y o u d e t e r m i n e th e a m o u n t o f s p a c e t h e f i l e r e q u i r e s , y o u c a n d e c i d e w h e r e t h e f i l e s h o u l d b e l o c a t e d o n t h e d i s k . S i n c e th e n u m b e r o f f i l e s a d i s k c a n c o n t a i n d e p e n d s o n t h e s i z e o f t h e f i l e s , it i s a g o o d p r a c t i c e to d o c u m e n t w h i c h f i l e s a r e o n w h i c h d i s k ,

T h e D i s k F i l e L a y o u t C h a r t ( F i g u r e 2 7 ) i s a v a i l a b l e f o r t h i s p u r p o s e . T h e D i s k F i l e Layout Chart shows space available on the fixed and removable 5444 disks. There are 406 positions (0-405), represented on the chart. Each position corresponds to a t r a c k . I n F i g u r e 2 7 , n o t i c e t h a t t r a c k s 0 t h r o u g h T h a v e a l i n e t h r o u g h t h e m . T h e s e tracks are reserved for system use only and are not available for data files.

As you create more files, you can refer to the chart of a particular disk to determine t h e a m o u n t o f a v a i l a b l e s p a c e o n t h a t d i s k . l t i s h e l p f u l t h e n t o i n d i c a t e th e r e -q u i r e d s p a c e fo r e a c h fi l e o n a D i s k F i l e L a y o u t C h a r t . l t i s a l s o h e l p f u l t o i n d i c a t e t h e n a m e o f t h e f i l e o n t h e c h a r t .

P l a n n i n g D i s k F i l e s 4 9

IBl,l

S Y S T € M

Syn.m/3 Di3t Fil. L.vout Ch.n

F r h x 2 t _ 9 r O p n n r - ' n U S A

orrt I

P A O 6 R A M M € F

n

R E M O V A E L € D I S K

il

F r x E o D r s K

5 7 9

llf+l ++J JlTrT t-i111]

t Il

F i g u r e 27. Disk File Layout Charr

F i g u r e 2 8 s h o w s th e s p a c e a n d l o c a t i o n o f t h e n a m e a n d a d d r e s s f i l e u s i n g th e i n -d e x e -d m e t h o -d . T h e c a l c u l a t i o n s t o d e t e r m i n e th e a m o u n t o f d i s k s p a c e re q u i r e d can be done on the back of the chart.

S v r r . m / 3 D r * F r l . L l v o l t C h . n

Brc{RE _ --_ __ ffi--- ---_l

R E C O R D S

r ) ? t 4 a r a 8 1 5 6 1 6 4

-r-ilrll-l--f-l-*'

r

rllT-r_r"|-. : , T , , . ! ' r r r . r

- * - 1 ,

1 3 3 i 4 r i i g j a 7 1 6 4

F i g u r e 2 8 . D i s k F i l e L a y o u t f o r a n I n d e x e d F i l e

5 0

I n p u t ( A d d s )

Obiect Library

Placement of files in relation to each other also has an effect on the performance achieved when processing them. For example. when adding records to a file, it is desirable to have the input on one disk drive and the file on another drive.

In this way, the files can be located as follows for a program that processes an indexed file and adds records to it:

I r.___-___________-a I tl

| | I t l

l l \ l l

I f--- l il

t l

. - v u

I n d e x e d F i l e

lf the program used requires overlays, it might be desirable (depending on your application) for the input file to be located close to the object library to reduce arm movement on drive 1. In each RPG ll cycle, it might be necessary for the arm to go to the input area for records to be added, and then to the object library for overlays.

Consideration might also be given to placing the input close to the index of the file, or near the midpoint of the file, or even near the end of the file, depending on the expected distribution of added records.

After you have determined where to place your file, you can code the LocATloN parameter of the FILE statement to tell disk system management on which track the file is to begin. This sample FILE statement contains a LocATloN para-meter to tell disk system management that FILEA is to be located on disk pack V O L 1 , b e g i n n i n g o n t r a c k 8 :

Automatic File Allocation

l f y o u d o n o t s p e c i f y t h e L O C A T I O N p a r a m e t e r o n t h e F I L E s t a t e m e n t . F I L E A i s located on the disk pack automatically for you.

P l a n n i n g D i s k F i l e s 5 1

1t

-2 .

The process used by disk system management to allocate file space for you is k n o w n a s a u t o m a t i c fi l e allocation.

w h e n a l l o c a t i n g f i l e s p a c e . d i s k s y s t e m m a n a g e m e n t c a l c u l a t e s t h e l e n g t h o f t h e f i l e a n d c h e c k s th e v o r u m e raber to determine which tracks are avairable f o r a l l o c a t i o n . ( T h e v o l u m e l a b e l contains the status of each track and indicates which t r a c k s a r e a v a i l a b l e f o r a l l o c a t i o n . ) D i s k s y s t e m management t h e n :

F i n d s a c o n t i n u o u s s t r i n g o f a v a i l a b l e t r a c k s .

A l l o c a t e s s p a c e f o r p e r m a n e n t f i r e s , t h e n te m p o r a r y f i r e s , a n d fi n a i l y s c r a t c h f i l e s , i f m u l t i p l e f i l e s a r e b e i n g a l l o c a t e d .

D i s k s y s t e m m a n a g e m e n t p r a c e s y o u r f i r e o n t h e s m a i l e s t c o n t i n u o u s s t r i n g o f a v a i l a b l e t r a c k s th a t c a n c o n t a i n y o u r f i l e . For example, it can determine that your f i l e i s 1 0 t r a c k s lo n g a n d f i n d one string of 12 available tracks and another of 15 t r a c k s . l t p l a c e s y o u r f i r e i n t h e s t r i n g of 1 2 tracks because t h e 1 2 - t r a c k s t r i n g i s c l o s e r to t h e l e n g t h o f the f ile.

l f d i s k s y s t e m m a n a g e m e n t f i n d s t w o s t r i n g s a n d b o t h h a v e the same number of a v a i l a b l e t r a c k s , th e f i l e i s p l a c e d a t t h e h i g h e s t numbered available location. Also, i f y o u r f i l e i s t h e f i r s t f i l e p l a c e d on a disk. the system allocates space for the file b e g i n n i n g a t t h e h i g h e s t n u m b e r e d tr a c k . T h e system ailocates s p a c e b e g r n n i n g a t t h e h i g h e s t lo c a t i o n . T h i s a l l o w s y o u as many available t r a c k s a s p o s s i b l e n e x t t o t h e o b j e c t l i b r a r y ( t h e o b j e c t l i b r a r y i s l o c a t e d at the lowest numbered tracks). so t h a t t h e o b j e c t l i b r a r y c a n e x p a n d if n e c e s s a r v .

l f a n a r e a is f o u n d c o n t a i n i n g the same number of avairabre t r a c k s a n d t w o f i r e s a r e a l r e a d y o n e i t h e r s i d e o f t h e area, disk system management d e t e r m i n e s t h e t y p e o f f i l e t o t h e l e f t o f t h e a v a i l a b l e t r a c k . l f t h e f i t e t o t h e l e f t h a s s i m i l a r attri_

b u t e s , th e n e w f i l e i s l e f t - a d j u s t e d ; i f t h e f i l e t o t h e l e f t i s n o t s i m i l a r , the new file i s r i g h t - a d j u s t e d , a s s h o w n b e t o w :

P a r t A

Part B Scratch F

S c r a t c h F i l e

P e r m a n e n t F i l e Disk system management determines the type of file to the left of the available tracks. lf the file to the left is similar, the new fire is reft-adjusted (part A). rf the fire ro the reft is not simirar, it is right_adiusred (part B).

F i l e s a r e p l a c e d a d j a c e n t to f i l e s with similar attributes, so there will be as few u n u s e d tr a c k s b e t w e e n fi r e s as possibre. lt is more important, however, to prace ' a n e w f i l e o n a s t r i n g of tracks as close to the length of your file as possible. There-f o r e , a p e r m a n e n t f i l e c o u l d b e a l l o c a t e d s p a c e n e x t t o a t e m p o r a r y o r s c r a t c h fi l e i f t h e n u m b e r o f t r a c k s a t t h a t r o c a t i o n is greater than or equar to tne number of t r a c k s in t h e p e r m a n e n t f il e .

Consiclerations for Using Automatic File Allocation

I t i s e a s i e r t o l e t d i s k s y s t e m m a n a g e m e n t a l l o c a t e fi l e s p a c e . b u t t h e r e a r e s o m e c o n s i d e r a t i o n s t o m a k e i n d e t e r m i n i n g w h e t h e r o r n o t t o use automatic file alloca-l . i o n . A f t e r y o u h a v e g a i n e d e x p e r i e n c e , y o u s h o u l d b e a b l e t o p l a c e a file on disk

A v a i l a b l e

T r a c k s I New Permanent F

J Z

m o r e e f f ic i e n t l y th a n c a n d i s k s y s t e m m a n a g e m e n t . Disk system management may l e a v e a s t r i n g o f a v a i l a b l e t r a c k s b e t w e e n fi l e s w h i c h i s u n u s a b l e b e c a u s e t h e s t r i n g i s n o t l o n g e n o u g h to c o n t a i n a n o t h e r fi l e .

l f y o u p l a n y o u r o w n f i l e s a n d k e e p y o u r l a y o u t chart up-to-date, y o u c a n d e t e r m i n e w h e r e f i l e s a r e lo c a t e d b y c h e c k i n g t h e D i s k F i l e L a y o u t c h a r t . l f y o u allocate s p a c e f o r s o m e f i l e s a u t o m a t i c a l l y a n d th e n w a n t to p l a c e a f i l e o n d i s k y o u r s e l f , h o w -e v -e r , y o u m u s t check t h e v o l u m e l a b e l t o d e t e r m i n e w h a t tr a c k s a r e a v a i l a b l e . T h i s c a n b e d o n e b y u s i n g t h e F i l e a n d V o l u m e L a b e l D i s p l a y u t i l i t y p r o g r a m . ( s e e t h e IBM system/3 Model l0 Disk system control programming Reference Manual, GC21-7512, the l8M System/3 Modet 6 Operation Control Language and Disk Utili-ty Programs Reference Manuar, GC2r-7s16, or the rgM system/3 Moder rs system Control Programming Reference Manual, GC21-5077, for more information on this u t i l i t y p r o g r a m . )

Automatic file allocation can increase the time needed to copy programs using the Disk Copy/Dump utility program. (See the appropriate disk utilities reference manual previously referenced for more information on this utility program.) For example, you have used automatic file allocation and now wish to copy a file onto tracks 30 through 50 of the disk on Fl. However, disk system management placed the file to be copied on tracks 50 through 70 of the disk R1. Copying time increases when a file is copied from one location on a disk to another location on anotner disk, because the access mechanism must move. lt would therefore be advantageous to allocate the file space on tracks 30 through 50 of R1 yourself so that the file can be copied onto the same tracks (tracks 30 through 50) of F1.

U s i n g t h e a u t o m a t i c w o r k f i l e a l l o c a t i o n f u n c t i o n ( a u t o - a l l o c a t e ) w h e n ru n n i n g t h e Disk Sort program generally increases the time needed to run a sort job; auto-allocate does not always provide the work file arrangement needed for a fast sort r u n . l f y o u a r e c o n c e r n e d w i t h m i n i m i z i n g s o r t r u n t i m e . u s e a w e l l p l a n n e d w o r k file and work file statement, rather than auto-allocate. An advantage of using auto-allocate is that if sufficient contiguous space is not available, the system will find work space that may be located in different areas of the same pack or on different packs.

A u t o m a t i c f i l e a l l o c a t i o n p r o v i d e s f o r e f f e c t i v e u s e o f f i l e s p a c e , b u t n o t f o r f i l e u s a g e ; i t d o e s n o t p r o v i d e p l a n n i n g f o r m u l t i p l e i n p u t fi l e s in a p r o g r a m o r j o b - t o - j o b t r a n s i t i o n s . l f y o u p l a n y o u r o w n f i l e l o c a t i o n s , y o u c a n p l a c e f i l e s t h a t a r e u s e d t o g e t h e r n e a r o n e a n o t h e r o n d i s k . W h e n f i l e s u s e d t o g e t h e r a r e p l a c e d n e a r o n e a n o t h e r , p r o c e s s i n g t i m e m a y b e im p r o v e d .

S p l i t C y l i n d e r C a p a b i l i t y ( 5 4 4 5 )

T h e 5 4 4 5 h a s a s p l i t c y l i n d e r c a p a b i l i t y f o r s e q u e r r t i a l o r d i r e c t f i l e s (s e e F i g u r e 29). This means that two or more sequential or direct files can be arranged on two or more cylinders with each file occupying a corresponding part of each c y l i n d e r . F o r e x a m p l e , y o u m a y allocate F i l e A o n t r a c k s 0 - 3 o f c y l i n d e r s 3 - 5 a n d F i l e B o n t r a c k s 4 - 7 o n c y l i n d e r s 3 - 5 . T h e a d v a n t a g e o f t h e s p l i t c y l i n d e r capability is that you can arrange your files in combinations to decrease the access time required. For instance, the first file on the cylinder could be a master file and the remaining tracks on the cylinder could be reserved for files associated with the master f ile.

P l a n n i n g Disk Files 53

l * . . a r , i n d e r s +

|

,

-tnn I

o0

- )

( r i t e n ' M a s r e r F i t e ' _ I Tracks G3 Cylinders 35

- l r i l e e

_ / T r a c k s 4 - 7 Cytinders 35 T r a c k s i n

a C y l i n d e r

I I

I

I

1 9

I

u y r I n o e r s J - 5 F i g u r e 2 9 . C y l i n d e r Concept on the IBM 5445 Showing Sptit Cytinder Capabitity

Documents relatifs