登录

File Organisation

Introduction

  • Computers are used to access vast amounts of data and to present it as useful information.

  • Millions of people expect to be able to retrieve the information they need in a useful form when they ask for it.

  • This information is all stored as data in files, everything from bank statements to movie collections.

  • In order to be able to find data efficiently it needs to be organised.

  • Data of all types is stored as records in files.

  • These files can be organised using different methods.

# File organisation
- Serial
- Sequential
- Random

Serial file organisation

  • The serial file organisation method physically stores records of data in a file, one after another, in the order they were added to the file.

  • New records are appended to the end of the file.

  • Serial file organisation is often used for temporary files storing transactions to be made to more permanent files.

First record

Second record

Third record

Fourth record

Fifth record

Sixth record

and so on

Sequential file organisation

  • The sequential file organisation method physically stores records of data in a file, one after another, in a given order.

  • The order is usually based on the key field of the records as this is a unique identifier.

  • For example, a file could be used by a supplier to store customer records for gas or electricity in order to send regular bills to each customer.

  • All records are stored in ascending customer number order, where the customer number is the key field that uniquely identifies each record.

Customer 1 record

Customer 2 record

Customer 3 record

Customer 4 record

Customer 7 record

Customer 8 record

and so on

Add Record 5

Customer 1 record

Customer 2 record

Customer 3 record

Customer 4 record

Customer 5 record

Customer 7 record

Customer 8 record

and so on

Random file organisation

  • The random file organisation method physically stores records of data in a file in any available position.

  • The location of any record in the file is found by using a hashing algorithm on the key field of a record.

Customer 1 record

Customer 2 record

Customer 3 record

Customer 4 record

Customer 5 record

Customer 7 record

Customer 8 record

and so on

Customer 6 record not found

File Organisation
填空题
ID:217

The file organisation method physically stores records of data in a file, one after another, in the order they were added to the file

[0/1]

File Organisation
填空题
ID:218

The file organisation method physically stores records of data in a file, one after another, in a given order

[0/1]

File Organisation
填空题
ID:219

The file organisation method physically stores records of data in a file in any available position

[0/1]

File access

  • There are different methods of file access (the method used to physically find a record in the file).

  • We will consider two of them: sequential access and direct access.

# File access

- Sequential

- Direct(hash)

Sequential access

  • The sequential access method searches for records one after another from the physical start of the file until the required record is found, or a new record can be added to the file.

  • This method is used for serial and sequential files.

  • Sequential access is efficient when every record in the file needs to be processed, for example, a monthly billing or payroll system.

  • These files have a high hit rate during the processing as nearly every record is used when the program is run.

Direct access

  • The direct access method can physically find a record in a file without other records being physically read.

  • Both sequential and random files can use direct access.

  • This allows specific records to be found more quickly than using sequential access.

  • Direct access is required when an individual record from a file needs to be processed.

  • For example, when a single customer record needs to be updated when the customer’s phone number is changed.

  • Here, the file being processed has a low hit rate as only one of the records in the file is used.

File Organisation
填空题
ID:220

The access method searches for records one after another from the physical start of the file until the required record is found, or a new record can be added to the file

[0/1]

File Organisation
填空题
ID:221

The access method can physically find a record in a file without other records being physically read

[0/1]

Hashing algorithms

  • In the context of storing and accessing data in a file, a hashing algorithm is a mathematical formula used to perform a calculation on the key field of the record.

  • The result of the calculation gives the address where the record should be found.

  • More complex hashing algorithms are used in the encryption of data.

File Organisation
填空题
ID:222

In the context of storing and accessing data in a file, a is a mathematical formula used to perform a calculation on the key field of the record

[0/1]

登录