🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

Lecture 2.PPT.pdf

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Document Details

RapidQuantum7027

Uploaded by RapidQuantum7027

2023

Tags

data organization computer science file systems

Full Transcript

File Organization Lecture 2 03/03/2023 Computer Science 9608 1 Logical vs. Physical Organization of Data logical organization  the abstract way that the computer program is able to access the data  use of logical structures (e.g. linke...

File Organization Lecture 2 03/03/2023 Computer Science 9608 1 Logical vs. Physical Organization of Data logical organization  the abstract way that the computer program is able to access the data  use of logical structures (e.g. linked lists) physical organization  the actual physical structure of data in memory  i.e. what the sequence of bits look like in memory 03/03/2023 Computer Science 9608 2 Definitions Database (collection of related files) File (collection of related records)  text file or a binary file (two's complement) graphic, word-processing, and spreadsheet files Record (collection of related fields) key field (uniquely identifies a record. A primary key is a field or set of fields with values that are unique throughout a table. 03/03/2023 Computer Science 9608 3 Basics (General Idea) Records are stored at different places (different indices or locations) To find a record, we need to know its location We can search for the record OR Jump to its location directly (if location is known) OR A combination of jumping and searching 03/03/2023 Computer Science 9608 4 Serial files A serial file contains records which have no defined order. A typical use of a serial file would be for a bank to record Customer transactions. A program would be running. Each time there was a withdrawal or a deposit. The customer records would enter the file in chronological order. A record in a serial file must have a defined format to allow data to be input/output correctly. 03/03/2023 Computer Science 9608 5 Serial files (Continue) 03/03/2023 Computer Science 9608 6 Sequential File Records in a file are stored sequentially (in order) by some key field 2480 Bob 2569 Alice 3020 Paul Originally designed to operate on magnetic tapes For example, if you are trying to remember someone's name, according to sequential processing theory, you would retrieve a name and decide if it is correct. If the name retrieved is correct, the search ends. If it isn't correct, you go to the next name 03/03/2023 Computer Science 9608 7 Sequential File (Continue) 03/03/2023 Computer Science 9608 8 Indexed Sequential Files File index (address) ~ index in a book Index all the records Key field has direct index to a section where record of interest is located 1. Sequential search for key field 2. Directly link to section of records 3. Sequential search for record of interest 03/03/2023 Computer Science 9608 9 Indexed Sequential Files Key Record Record Address 1 A 1 2 B 6 3 4 C 11 5 D 16 6 7 8 9 10 11 12 03/03/2023 Computer Science 9608 10 Direct Access File Record address is located randomly This operation is called “hashing”.  This takes as input the value for the key field and outputs a value for the position of the record relative to the start of the file.  This method will not create unique positions. Example: Index ← CustomerID MOD 10 03/03/2023 Computer Science 9608 11 Direct Access File (Continue) 03/03/2023 Computer Science 9608 12 Direct Access Vs. Sequential File 03/03/2023 Computer Science 9608 13 Fixed-length vs. Variable-length Records Fixed-length  each record is a set size  can be used with direct access file organization access based on math calculations, so size must be fixed in length Variable-length  each record is a variable size  can be used with sequential file organization access is all indexed, so size does not matter 03/03/2023 Computer Science 9608 14

Use Quizgecko on...
Browser
Browser