Professional Documents
Culture Documents
Data
Pertemuan 5 :
File Sekuensial
1
Sequential (Ordered) File
1231...
1175...
1152 ...
1122...other data
File Sekuensial
4
Sequential File Characteristics
6
File Sekuensial
7
Inserting Records in SAM files
Insertion
– Slow:
Sequential search to find where the record goes
If sufficient space in that page, then rewrite
If insufficient space, move some records to next page
If no space there, keep bumping down until space is
found
– May use an “overflow” file to decrease time
8
Deletions and Updates to SAM
Deletion
– Slow:
Find the record
Either mark for deletion or free up the space
Rewrite
Updates
– Slow:
Find the record
Make the change
Rewrite
9
Interesting problems:
10
Performansi File Sekuensial
R=aV
a : jumlah atribut pada satu rekord
V : Panjang rata-rata nilai atribut (byte)
Fetch Rekord (TF)
– Pencarian menggunakan atribut bukan kunci
Belum ada File Log rata-rata, ½ file akan ditelusuri
TF = ½ waktu pencarian seluruh blok
= ½ b. B/t’ = ½. n R/t’
Sudah ada file Log
TFo = ½. o’ R/t’
TF = ½ (n + o) R/t’
11
– Pencarian menggunakan atribut kunci (pencarian
biner)
Belum terbentuk log
TF = 2log (b) (s + r + btt + c)
= 2log (n/Bfr) (s + r + btt+ c)
Sudah terbentuk log
TF = 2log (n/Bfr) (s + r + btt+ c) + ½ o (R/t’)
12
TN = waktu transfer 1 blok x peluang ditemukannya
rekord dalam blok yang sama
= btt . 1/Bfr = R/t
13
Waktu Update
– Bukan kunci
TU = TF + TRW
– Terhadap Kunci : find rekord, hapus rekord,
sisipkan rekord
TU = TF(main) + TI (file log)
14
Waktu Pembacaan Seluruh Rekord (Tx)
Tx = Tsort(o) + (n+o) R/t’
15
Latihan
Diketahui File sekuensial :
- Putaran disk = 8000 rpm
- Seek time = 5 ms
- Transfer rate = 2048 byte/ms
- TRW = 2r
- Ukuran blok = 4096 byte
- Ukuran Pointer blok = 8 byte
- IBG = 1024 byte
- Jumlah rekord di file = 100000 rekord
- Jumlah field = 8 field
- Panjang nilai = 25 byte
- Jumlah rekord file log = 5000 rekord
- Waktu pemrosesan = 2 ms
16
Hitung :
R, TF, TN, TI, TU, Tx, Ty jika metode bloking :
1. Fixed
2. Variable length Spanned
3. Variable length Unspanned
17
Pembahasan
18
Pembahasan
t’ = (t/2)(R/R+W)
= (2048/2)(200/200+51.2) = 1024.(0.796)
= 815.10 ms
TF = ½ n R/t’
= ½ (100000)(200/815.10) = 50000(0.245) =
= 12268.43 ms = 12.26843 s
TN = btt/Bfr
Cari btt btt = B/t = 4096 / 2048 = 2 ms
TN = 2/20 = 0.1 ms
19