220 likes | 426 Views
Haiku Error Messages: Chaos reigns within. Stop, reflect, and reboot. Order shall return. Yesterday it worked Today it is not working Windows is like that.
E N D
Haiku Error Messages: Chaos reigns within. Stop, reflect, and reboot. Order shall return. Yesterday it worked Today it is not working Windows is like that. Windows XP crashed. The Blue Screen of Death. No one hears your screams.
Device Management III. File Management D. something 1. smaller some
Device Management main sub
E. Access Methods Logical Level How are records located within a file?
method to use depends upon file’s intended application fixed length records vs.variable length records
Fixed length record - all records in file are same size Class ID Number Sex Last Name 4 char 9 int 1char 20 char
Variable length record - records in file are diff sizes Name Birthplace Personal Mission Statement 5-10 char 10 - 20 char 0 - 100 char
fixed length records =easy to implement,but may waste space variable length records =difficult to implement, but no wasted space
1. Sequential Access Records are logically ordered within the file Records are accessed one after the other in order
1. Sequential Access analogy - phone book but must search it in order
2. Random Access Records are located directly within the file Hashing algorithm determines the record’s logical address
2. Random Access analogy - phone book open book to exactly the right page and put your finger on exactly the right record
it’s not magic, it’s an algorithm Hashing Algorithm: key field value modulo file’s prime numberyields logical address
Hashing Algorithm ex: 45 (key field value) modulo11 (file’s prime number)yields[4] r1 (logical address)
Logical Record # File Key Field (eg ID number) 0 1 2 3 4 5 6 7 8 9 10 Zeb - 45 - $0.02 45 Hashing Algorithm 45 % 11 = 1
Logical Record # File Key Field (eg ID number) 0 1 2 3 4 5 6 7 8 9 10 Zeb - 45 - $0.02 15 Zeke - 15 - $5.00 Hashing Algorithm 15 % 11 = 4
Logical Record # File Key Field (eg ID number) 0 1 2 3 4 5 6 7 8 9 10 Zeb - 45 - $0.02 58 Martha - 58 - $25 Zeke - 15 - $5.00 Hashing Algorithm 58 % 11 = 3
Logical Record # File Key Field (eg ID number) 0 1 2 3 4 5 6 7 8 9 10 Zeb - 45 - $0.02 32 Martha - 58 - $25 Zeke - 15 - $5.00 Hashing Algorithm 32 % 11 = 10 Mable - 32 - $50
Logical Record # File Key Field (eg ID number) 0 1 2 3 4 5 6 7 8 9 10 Zeb - 45 - $0.02 47 hash clash Martha - 58 - $25 Zeke - 15 - $5.00 Hashing Algorithm 47 % 11 = 3 Mable - 32 - $50
3. Indexed Access features of both add an index “layer” on top of the file
B-tree Index 37 33 Logical Record # File 0 1 2 3 4 5 6 7 8 9 10 21 33 21 19 18 18 Zerub, 19, $1.98 17 10 10 8 9 8 6