Pile

download Pile

of 16

Transcript of Pile

CS2323 Sistem BerkasPertemuan 4 : Organisasi File Pile

1

File StructureHeap (Pile) Files Hash (Direct) Files Ordered (Sorted) Files B - Trees

2

Single File Access ConceptsPile Sequential Indexed Sequential Indexed Direct or Hashed

3

Unordered FilesAlso called a heap or a pile file. New records are inserted at the end of the file. Data are collected in the order they arrive Records may have different fields No structure

4

Unordered FilesA linear search through the file records is necessary to search for a record.This requires reading and searching half the file blocks on the average, and is hence quite expensive.

Record insertion is quite efficient. Reading the records in order of a particular field requires sorting the file records.5

Unordered Files contRecord size in Pile Insertions - Very efficient Search - Very inefficient (Linear Search) Deletion - Very inefficientLazy Deletion

Problems? When are they Used?6

Pile

7

Pengukuran Kuantatif FileTF : waktu yang dibutuhkan untuk mengambil (fetch) satu rekord TN : waktu untuk mendapatkan satu rekord berikutnya TI : waktu insert satu rekord TU : waktu update satu rekord Tx : waktu pembacaan seluruh rekord TY : waktu reorganisasi file8

Pengukuran Kinerja PileRecord Size (R) , rekord size rata-rataR = a(A+V+2) a = rata-rata jumlah atribut A = ukuran rata-rata atribut (field) V = ukuran rata-rata nilai

Fetch Record (TF)Data tidak tersusun baik, maka TF relatif tinggi Rekord dicari secara serial, blok per blok TF = 1/2b (B/t)

Get next Record (TN)Tidak ada pengurutan dalam pile, TN = TF9

Pengkuran Kinerja PileInsert TimeRecord baru disimpan di akhir file TI = s + r + btt + tRW

Update TimeBila ukuran rekord tetap TU = TF + TRW Bila berubah TU = TF + TRW + TI

Baca seluruh File (Tx) = n TF = n. R/t10

Pengukuran Kinerja FileReorganization Time (Ty) Ty = (n+o) R/t + (n+o-d) R/t file akan bertambah dari n ke n+o-d o : jumlah rekord yang ditambahkan o = ninsert+ v ninsert : jumlah rekord yang diinsert v : jumlah rekord yang diupdate dengan menandai yang dielete dan menambah rekord baru. d : jumlah rekord yang ditandai untuk didelete

11

Latihan Soal - PileDiketahui data suatu sistem dikelola menggunakan struktur Pile dengan Jumlah rekord di file = 10.600 rekord Jumlah field rata-rata = 5 field Panjang nama field rata-rata = 7 byte Panjang nilai rata-rata = 15 byte Data tersebut akan disimpan pada harddisk dengan karakteristik Putaran disk = 6000 rpm Seek time = 5 ms Transfer rate = 2048 byte/s Waktu untuk pembacaan dan penulisan (TRW) = 2r Ukuran Blok = 1024 byte Ukuran pointer blok = ukuran record mark = 8 byte Ukuran IBG = 512 byte12

Latihan Soal - PileHitunglah : a. Panjang rekord b. Waktu Fetch sebuah rekord c. Waktu mendapatkan next record d. Waktu Insert sebuah rekord e. Waktu Update f. Waktu baca seluruh file g. Waktu Reorganisasi Jika metode blocking yang digunakan adalah variable-length spanned blocking13

Pembahasan Soal - PilePanjang rekord (R)R = a(A+V+2) = 5 (7+15+2) = 5 (24) = 120 byte

TF = b (B/t) = (n.R/B)(B/t) = n (R/t) hitung dulu t t = (t/2)(R/R+W) hitung dulu W W = M + (P+G)/Bfr hitung dulu Bfr Bfr = (B-P) / (R+M) = (1024-8)/(120+8) = 7.93 = 7 rekord14

Pembahasan Soal - PileW = M + (P+G)/Bfr = 8 + (8 + 512) / 7 = 8 + (520/7) = 8+74.28 =82.28 byte t = (t/2)(R/R+W) = (2048/2)(120/120+82.28) = 1024 (120/202.28) = 1024 (0.593) = 607.232 byte/ms15

Pembahasan Soal - PileTF = n (R/t) = 10600 (120/607.232) = 10600 (0.1976) = 1047.37 ms c. TN = TF = 1047.37 ms Kerjakan sisa soal lainnya sbg latihan !16