computers14 ch6

30
Mongolia International University Storage and Storage and Multimedia Multimedia Chapter 6 Chapter 6 B.M.H B.M.H

Upload: miuitprofessor

Post on 02-Nov-2014

38 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Computers14 Ch6

Mongolia International University

Storage and Storage and MultimediaMultimedia

Chapter 6Chapter 6

B.M.HB.M.H

Page 2: Computers14 Ch6

MIUComputers

IndexIndex

How data is organized How data is organized How to access the fileHow to access the file

File organizationFile organization Sequential file organization Direct file organization Indexed file organization

How to process the fileHow to process the file Batch processingBatch processing Transaction processingTransaction processing

Page 3: Computers14 Ch6

MIUComputers

How data is organizedHow data is organized

Raw data is organized intoRaw data is organized into Characters Characters FieldsFields RecordsRecords File File DatabasesDatabases

Page 4: Computers14 Ch6

MIUComputers

How data is organizedHow data is organized

Characters Characters the smallest elementthe smallest element A letter, digit, or special characterA letter, digit, or special character

FieldsFields A set of related charactersA set of related characters

RecordsRecords A collection of related fieldsA collection of related fields

Page 5: Computers14 Ch6

MIUComputers

How data is organizedHow data is organized

File File A collection of related recordsA collection of related records

DatabasesDatabases A collection of interrelated files stored A collection of interrelated files stored

together with minimum redundancytogether with minimum redundancy

Page 6: Computers14 Ch6

MIUComputers

How data is organizedHow data is organized

KeyKey A field of particular interestA field of particular interest A unique identifier for a recordA unique identifier for a record

Ex. custom number, product number, social Ex. custom number, product number, social security number, security number,

Page 7: Computers14 Ch6

MIUComputers

The File PlanThe File Plan

The plan considered by some The plan considered by some computer professionalcomputer professional How to access the fileHow to access the file

File organization How to process the fileHow to process the file

Page 8: Computers14 Ch6

Mongolia International University

How to access the fileHow to access the file

Page 9: Computers14 Ch6

MIUComputers

File organizationFile organization

Three major methods of organizing data Three major methods of organizing data files in secondary storagefiles in secondary storage SequentialSequential file organization file organization DirectDirect file organization file organization IndexedIndexed file organization file organization

Page 10: Computers14 Ch6

MIUComputers

Sequential File Sequential File OrganizationOrganization

Records are arranged sequentiallyRecords are arranged sequentially stored in order according to a key fieldstored in order according to a key field

To find a particular record To find a particular record All the prior records in the file must be readAll the prior records in the file must be read before before

the desired record is reachedthe desired record is reached

Page 11: Computers14 Ch6

MIUComputers

Direct File OrganizationDirect File Organization

RandomRandom file organization file organization Allows direct (random) accessAllows direct (random) access

The ability to go directly to the desired The ability to go directly to the desired record record by using a record keyby using a record key

The benefit The benefit the ability to read, change, and return a the ability to read, change, and return a

record to its same place on the diskrecord to its same place on the disk called called updating in placeupdating in place

Page 12: Computers14 Ch6

MIUComputers

Direct File OrganizationDirect File Organization

To find the record on a diskTo find the record on a disk Used a certain formula to apply to the Used a certain formula to apply to the

record keyrecord key Deriving a number to use as the disk address

Hashing, or randomizing algorithmHashing, or randomizing algorithm The mathematical operation that is applied to a key to

yield a number that represents the address

Page 13: Computers14 Ch6

MIUComputers

Simple Hashing SchemesSimple Hashing Schemes

A general idea of how the process worksA general idea of how the process works

Page 14: Computers14 Ch6

MIUComputers

Page 15: Computers14 Ch6

MIUComputers

Hashing AlgorithmHashing Algorithm

CollisionCollision For a hashing algorithm to produce the For a hashing algorithm to produce the

same disk address (called synonym) for two same disk address (called synonym) for two different recordsdifferent records

Even though the record keys are unique

To recover from a collisionTo recover from a collision One way : to use One way : to use the next available record the next available record

slotslot in the disk in the disk fig 6-13 fig 6-13

Page 16: Computers14 Ch6

MIUComputers

Indexed File OrganizationIndexed File Organization

A compromise between the A compromise between the sequentialsequential and and direct methodsdirect methods RecordsRecords are stored are stored in sequentialin sequential order order The fileThe file also contains also contains an indexan index

The index contain The record key The address associated with the key

Page 17: Computers14 Ch6

MIUComputers

Storage mediaStorage media

Tape storageTape storage Limited to Limited to sequentialsequential file organization file organization

Disk storage Disk storage May be May be sequentialsequential, and also accessed , and also accessed

directlydirectly a direct-access storage device (DASD)a direct-access storage device (DASD)

The computer can go directly to the desired record on the disk

Page 18: Computers14 Ch6

Mongolia International University

How to process the fileHow to process the file

Page 19: Computers14 Ch6

MIUComputers

Processing stored dataProcessing stored data

Most business file processingMost business file processing involves processing involves processing transactionstransactions to update to update

a a master filemaster file TransactionTransaction : a business event that required : a business event that required

the business’s records to be updatedthe business’s records to be updatedEx. a retail sale, the receipt of ordered goods

Master fileMaster file : contains data that must be : contains data that must be updated as transactions occurupdated as transactions occurEx. an inventory file, an employee file, a customer file

Page 20: Computers14 Ch6

MIUComputers

Processing stored dataProcessing stored data

Two main methods Two main methods Batch processingBatch processing Transaction processingTransaction processing

Page 21: Computers14 Ch6

MIUComputers

Batch processingBatch processing

A technique of processing transaction A technique of processing transaction data data in groupsin groups at a more convenient at a more convenient later timelater time Transactions are collected into batchesTransactions are collected into batches to be processed at a time to be processed at a time

when the computer may have few online users and thus be more accessible, often during the night

No direct user interactionNo direct user interaction

Ex. web page club’s member fileEx. web page club’s member file

Page 22: Computers14 Ch6

MIUComputers

Batch processingBatch processing

Transaction fileTransaction file Contains all changes to be made to the Contains all changes to be made to the

master file: additions, deletions, and master file: additions, deletions, and revisionsrevisions

Master fileMaster file Periodically updated with the changes Periodically updated with the changes

called for in the transaction filecalled for in the transaction file

Page 23: Computers14 Ch6

MIUComputers

Batch processingBatch processing

1.1. Changes are stored in transaction filesChanges are stored in transaction files

2.2. Transaction file is sorted by a key fieldTransaction file is sorted by a key field All the transactions are in sequential orderAll the transactions are in sequential order

Ex. By the member number of the webpage Ex. By the member number of the webpage clubclub

3.3. Matching the keys from the mater file Matching the keys from the mater file and transaction filesand transaction files

Records of mater file already are in orderRecords of mater file already are in order

4.4. CPU processes the appropriate actionCPU processes the appropriate action

5.5. A newly updated master file is createdA newly updated master file is created

Page 24: Computers14 Ch6

MIUComputers

Page 25: Computers14 Ch6

MIUComputers

Batch processingBatch processing

AdvantageAdvantage EfficiencyEfficiency

DisadvantageDisadvantage The master file is current only immediately The master file is current only immediately

after processingafter processing

Page 26: Computers14 Ch6

MIUComputers

Transaction processingTransaction processing

A technique of processing transactions A technique of processing transactions immediately, as they occur immediately, as they occur Each transaction is handled immediatelyEach transaction is handled immediately Real-time processingReal-time processing

A transaction is processed fast enough for the result to come back and be acted upon right away

Online : Online : the terminals must be connected directly to the

computer

Ex. bank withdrawal, flight reservationEx. bank withdrawal, flight reservation

Page 27: Computers14 Ch6

MIUComputers

Transaction processingTransaction processing

Use disk storage Use disk storage For direct access to the desired recordFor direct access to the desired record

Advantage Advantage Immediate accessImmediate access to stored data to stored data Immediate updatingImmediate updating of the stored data of the stored data

Page 28: Computers14 Ch6

MIUComputers

Page 29: Computers14 Ch6

MIUComputers

Batch & Transaction Batch & Transaction ProcessingProcessing

Numerous computer system Numerous computer system combine the best features of both methods combine the best features of both methods

of processingof processing Transaction processing : used for activities related to the

current needs of people Batch processing : done at any time, even in the middle

of the night

Page 30: Computers14 Ch6

MIUComputers

Batch & Transaction Batch & Transaction ProcessingProcessing

Ex. Store systemEx. Store system Updating the individual item’s inventoryUpdating the individual item’s inventory

Needed transaction processing Producing daily and weekly sales report Producing daily and weekly sales report

Used batch processing