TOPIC 4: STORAGE DEVICES AND FILE PROCESSING
(Electronic Facts)

Why Secondary Storage?

	Computer Storage - the ability to store many records in extremely compressed form and to have quick access to them - is unquestionably one of the most valuable assets of the computer.

4.1 The Benefits of Secondary Storage

	Secondary storage, or auxiliary storage, is necessary because memory, or primary storage, can be used only temporarily. Also, memory is limited in size, whereas secondary storage media can store as much data as necessary.

	The benefits of secondary storage are:

•	Economy. It is less expensive to store data on magnetic tape or disk, the principal means of secondary storage, than in filing cabinets.
•	Reliability. Data in secondary storage is basically safe, since secondary storage is physically reliable. Also, the data in it is stored in such a way that data tampering is difficult.
•	Convenience. With the help of a computer, authorized people can locate and access data quickly.

This benefits apply to all the various secondary storage devices.

What Are the Choices and Which is Best?

	Two common means of secondary storage are magnetic tape - used mostly for backup and transferring data from  one machine to another - and magnetic disk - relatively low cost and ease of use; optical storage is a newer technology, which can store vast amount of data - usually in a highly portable and secure form.

4.2 Data: Getting Organized

	Submitting data to a computer cannot be chaotic in the least - it must be carefully planned.
	To be processed by the computer, raw data is organized into characters, fields, records, files, and databases.

•	A character is a letter, number, or special character (such as $, ?, or *). A character is essentially the same as a byte, consisting of 8 bits. One or more related characters constitute a field.
•	A field contains a set of related characters. For example, suppose a health club is making address labels for a mailing. For each person, it might have a member-number field, a name field, a street-address field and so on.
•	A record is a collection of related fields. Thus, on the health club mailing list, one person’s member number, name, address and so on constitute a record.
•	A file is a collection of related records. All the member records for the health club compose a file.
•	A database is a collection of interrelated files stored together with minimum redundancy. Specific data items can be retrieved for various applications.

4.3  Processing Data into Information

	The two main methods of data processing are batch processing ( processing data transactions in groups ) and transaction processing ( processing data transactions one at a time ). Many computer systems combine features of both types of processing.

Batch Processing

	Batch processing is a technique in which transactions are collected into groups, or batches, to be processed at a time. Batch processing involves a master file, which contains semi-permanent data, and a transaction file, which contains additions, deletions, and changes to be made to up-date the master file. The result is a new, up-to-date master file.
	In batch processing, the transaction file must be sorted so that all the transactions are in sequential order according to a field called a key. The key is a unique identifier for a record. The master file, which is already in order, is then updated by being compared against the transaction file.
	During processing, the computer matches the keys from the master and transaction files, carrying out the appropriate action to add, revise, or delete.
	An advantage of batch processing is the economy of processing records in groups. Disadvantages include both the delay in receiving the initial output and the additional time needed later to locate a particular record in a group.

Transaction Processing

	In transaction processing, the transactions are processed in the order they occur, without any pre-sorting.
	Transaction processing is real-time processing. Real-time processing can obtain data from the computer system in time to affect the activity at hand. In other words, a transaction is processed fast enough for the result to come back and be acted upon right away. For processing to be real-time, it must also be on-line, that is the terminals must be connected directly to the computer.
	The great leap forward in the technology of real-time processing was made possible by the development of the magnetic disk as a data storage medium, where you can move directly to one particular piece of data.
	Transaction processing systems are usually time-sharing systems, in which users share access to a central computer that can process their transactions almost at the same time.
	Advantages of transaction processing include quick results and permits continual updating of a customer’s record. Disadvantages include the expense, where transaction processing allows access to the computer at all times, unlike batch processing which uses the computer only for the amount of time needed to get the job done. However, the added expense may be a minor matter.
	A more serious drawback is security risk. If many users have access to the same data, it is more difficult to protect that data from theft, tampering, destruction by disgruntled employees, or unauthorized use.

Batch and Transaction Processing: The Best of Both Worlds
	
	Numerous computer systems combine the best features of both of these methods of processing. An oil company credit-card system, for instance, combine both methods: A credit-card machine at the pump can instantaneously register the amount of your purchase, but for billing purpose all your gasoline purchases may be batched and totaled at one time.

4.4  Magnetic Tape Storage

	Magnetic tape looks like the tape used in music cassettes - plastic tape with a magnetic spots, which a tape unit can read into the main storage of a computer.
	The amount of data on a magnetic tape is expressed in terms of density, which is the number of characters per inch (cpi) or bytes per inch (bpi) that can be stored on the tape.

Data Representation on Tape

	A tape contains tracks, or channels (see figure 4-5), that run the length of the entire tape. On most tapes a cross section representing one character contains 9 bits, one for each track. A magnetized spot represents a 1 bit; a location with no magnetization represents a 0 bit.

The Magnetic Tape Unit

	A magnetic tape unit records and retrieves data by using a read/write head, an electromagnet that reads the magnetized areas on the tape and converts them into electrical impulses. The reverse procedure is called writing. When the machine is writing on the tape, the erase head first erases any data previously recorded on the medium.
	The magnetic tape is inserted into the unit on a supply reel, passed through the read/write head, and attached to the take-up reel. During processing, the tape moves back and forth between the two reels, then is rewound onto the supply reel when the processing is complete.

Blocking

	Speed of access to records is important. Since fast-moving magnetic tape cannot stop instantly, some blank stopping space is necessary between records. This space is called an interblock gap (IBG), or interrecord gap (IRG). Typically, it is blank space on the tape 3/5 inch long (see figure 4-7).

	However, having many IRGs on a tape wastes space. To avoid this, records are grouped together, using a process called blocking. Blocking consists of putting together logical records, the records written by the applications program (it is called logical because it is related to the logic of the program), into one physical record (the collection of logical records grouped together on a tape), or block, followed by an interblock gap. The term blocking factor refers to the number of logical records in one physical record.

DAT and Helical Scan Recording

	Helical scan recording is a technique that uses a rotating read/write head to write the data in diagonal tracks across the tape. Its advantages are high data density and long tape life. One format that uses helical scan recording is digital audio tape, DAT, which uses technology developed for music recording.

4.5  Magnetic  Disk Storage

	A hard magnetic disk, or hard disk, consists of a metal platter coated with magnetic oxide. When more than one hard disk is assembled as a unit, the group is called a disk pack. Each disk has a top and bottom surface on which to record data. Another form of magnetic disk storage is the diskette, which is a round piece of plastic coated with magnetic oxide.

How Data Is Stored on a Disk

	The surface of a magnetic disk has tracks on which data is recorded as magnetic spots. All the tracks are closed circles having the same centre, and the same amount of data is stored on each track, from outermost to innermost, and it takes the same amount of time to read the data on the outer track as on the inner (see figure 4-10).
	A magnetic disk is a direct-access storage device (DASD), (unlike magnetic tape, which requires the read/write head to read all the preceding records on the file), where you can go directly to the record you want.

The Disk Drive

	A disk drive is a machine that allows data to be read from a disk or written on a disk. In the disk drive a diskette rotates at speeds of 300 to 400 revolutions per minute. Typically, hard disks rotate 3600 revolutions per minute.
	The mechanism for reading or writing data on a disk is an access arm; it moves a read/write head into position over a particular track. A disk pack has a series of access arms. However, only one read/write head can operate at any one time.

Winchester Disks

	A Winchester disk combines disks, access arms, and read/write heads in a sealed module. Many Winchester disks are built-in, but some are removable in the sense that the entire module can be contains the disks and access arms. Hard disks on personal computers usually employ Winchester technology.

How Data Is Organized on a Disk

	The two main methods of writing data on a disk or diskette are the sector method and the cylinder method.

The Sector Method - In the sector method, each track is divided into sectors that hold a specific number of characters (see figure 4-13). Data on the track is accessed by referring to the surface number, track number, and sector number where the data is stored. The sector method is used for diskettes as well as disk packs.
	Diskettes seldom have the same number of tracks and sectors, even if they are physically the same size. This is why diskettes from one computer may not work in another.

The Cylinder Method - Most hard disks use the cylinder method. The purpose is to minimized seek time, the time it takes to move the access arms into position. It is clear that once the access arms are in position, they are in the same vertical position on all disk surfaces.
	The data is recorded on the tracks that can be accessed by one positioning of the access arms - that is on one cylinder. The cylinder method means all tracks of a certain cylinder on a disk pack are lined up one beneath the other, and all the vertical tracks of one cylinder are accessible by the read/write heads with one positioning of the access arms mechanism. Tracks within a cylinder are numbered according to this vertical perspective: A 20-surface disk pack contains cylinder tracks numbered 0 through 19, top to bottom (see figure 4-14).
	The disk address is the cylinder number, surface number, and record number, in that order.

Disk Access to Data

	Four primary factors determine the time needed to access data:

•	Seek time. This is the time it takes the access arm to get into position over a particular track.
•	Head switching. The access arms on the access mechanism do not move separately; they move together, all at the same time. However, only one read/write head can operate at any one time. Head switching is the activation of a particular read/write head over a particular track on a particular surface.
•	Rotational delay. The time necessary for the appropriate record to get into position under the head.
•	Data transfer. This activity is the transfer of data between memory and the place on the disk track - to the track if you are writing, from the track to memory if you are reading.

	Two common measures of the speed of a disk drive are the average access time (which is usually measured in milliseconds, ms) , that is the speed with which a disk can find the data being sought, and the data transfer rate, which tells how fast the data can be transferred once it has been found.

4.6 File Organization: Three Methods

	There are three major methods of storing files of data in secondary storage:
•	Sequential file organization, in which records are organized in sequential order by key.
•	Direct file organization, in which records are organized randomly - not in any special order.
•	Indexed file organization, which is a combination of sequential and direct organization. Indexed records are organized sequentially, but indexes built into the file allow a record to be accessed either sequentially or directly.

Sequential File Processing

	In sequential file processing, records are usually in order according to a key field.

Direct File Processing
	
	Direct file processing, or direct access (sometimes called random access), allows you to go directly to the record you want by using a record key; the computer does not have to read all preceding records in the file as it does if the records are arranged sequentially.

	Once the record has been placed on disk, it must be possible to find it again. Hashing, or randomizing, is the name given to the process of applying a formula to a key to yield a number to use as the disk address (see figure 4-16).

Indexed File Processing

	Indexed file processing, or indexed processing, represents a compromise between the sequential and direct methods. It is useful in cases where files need to be in sequential order but where, in addition, you need to be able to go directly to specific records.
	
An indexed file works as follows: Records are stored in the file in sequential order, but the file also contains an index. The index contains entries consisting of the key to each record stored on the file and the corresponding disk address for that record. The index is like a directory, with the key to all records listed in order. To access a record directly, the record key must be located in the index; the address associated with the key is then used to locate the record on the disk.

	You can access a record sequentially in two different ways:-
•	begin with the first record and proceed through the rest of the records.
•	begin some where in the middle of the file - and then proceed through the rest of the file.

	A disadvantage of indexed processing is that the process of looking up the key in the index adds one more operation to retrieval. It is therefore not as fast as direct file processing.

4.7 Disk Storage

	Disk storage provides high-volume data capacity. Disk storage does indeed seem the very model of a good storage medium:
•	Data on disk is very reliable.
•	Disk files may be organized directly, which allows immediate access and updating of any given record. This is the biggest advantage and is basic to real-time systems.
•	Using direct access, data may be updated easily. In contrast to a sequential processed record, a single direct-access record may be read, updated, and returned to the disk, without the necessity of rewriting the entire file.

	Tape storage does not allow direct file processing, but it has certain advantages that make it a viable storage medium. It is portable and less expensive than disk storage. The uses of magnetic tape today include archiving information, transporting data and backup - all involving a great need for high storage capacity but where direct access is less important.

4.8  Improving Disk Drive Performance

	Several methods have been used to improve the performance of disk drives.

Caching

	Caching is a technique that uses a relatively small amount of semi conductor memory, called a cache, to speed up the performance of a disk. When data is needed, the central processing unit requests it first from the cache. If the data is not there, the central processing unit requests it from the disk, it is also loaded to the cache. The next time the CPU wants the data, it finds it in the cache - immediately, avoiding the relatively slow process of a disk access. The percentage of time that the computer finds what you want in the cache is called the hit rate.

	Two forms of caching are write-through and write-back. In write-through caching, when data is saved (written) on the disk, it is written to the cache and the disk at the same time. This has the advantage of always keeping the disk up-to-date, but writing takes a fairly long time. Write-back caching first writes only to the cache, without updating the disk immediately. Writing to the disk may be delayed until the disk is idle. This saves time but involves a risk that the disk will not be updated correctly should a problem occur.

	Caching can also be used between the registers of the central processing unit and the main memory.

Zone Recording

	The distance around the tracks on the outside of the disk is greater than that of the tracks on the inside. A given amount of data that takes up 1 inch of a track on the inside of a disk might be spread over several inches on a track near the outside of a disk. This means that the tracks on the outside are not storing data as efficiently.

	Zone recording involves dividing a disk into zones to take full advantage of the amount of storage available on all tracks. Tracks in outer zones have more sectors than those in inner zones (see figure 4-19). Since each sector on the disk holds the same amount of data, more sectors mean more data storage than if all tracks had the same number of sectors. One disadvantage of zone recording is that the disk drive motor has to change speeds when moving  to a zone with a different number of sectors.

Data Compression

Data compression takes advantage of the fact that data falls into patterns. Various techniques can exploit these patterns to encode them more efficiently (see figure 4-20). Compression is also useful when transmitting data through a computer network. The result is transmission that is faster and cheaper.

Using Several Disks Together

	There are many ways that multiple disks can work together, both for increased security and faster access.

	Disk mirroring uses two identical disks that are updated simultaneously. If anything happens to one disk, the data is stored on the other. RAID (redundant array of inexpensive disks) technology uses a number of methods involving multiple disks to improve data access and security. One problem with this concept is that it is more difficult to design devices that will control and coordinate several disks acting together.

4.9  Personal Computer Storage

	The market for data storage devices surged with the popularity of personal computers. Common storage media for personal computers are diskettes and hard disks.

Diskettes

	Diskettes have been popular since shortly after personal computers entered the market. The older, 5 ¼ inch diskette is still in use. The 3 ½ inch diskette is usually used with newer computers.

	The 3 ½ inch diskette comes in a hard plastic housing and offers several advantages. It is sturdier and easier to store - fitting into a shirt pocket or purse.

Hard Disks

	A hard disks is more expensive than a floppy disk, but it does provide more storage and faster processing. Hard disks are extremely reliable, since they are sealed against contamination by outside air or human hands.

	Hard disks can save you time as well as space. Accessing files on a hard disk is significantly faster than accessing files on a diskette - up to 20 times faster. Today most personal computers come with a hard disk installed.

Removable Storage

	Hard disks are internal or external devices of a fixed size. They cannot be transported easily without a tangle of cables. Removable hard disk cartridges is a units that provide portability and an unlimited capacity.
	Whenever you fill up a removable hard disk cartridge, you remove it and place a fresh one in its place.
Hardcards

	Instead of buying another hard-disk drive and attaching it to your machine (and taking up more desk space), you can install a hardcard in a slot inside your computer. The primary advantage of a hardcard is that it is out of sight and does not clutter up your desk.

RAM Disks

	A RAM disks is not a disk at all. It is a part of random-access-memory as if it were a disk drive for storing programs and data. A RAM disks works much faster than a standard disk. It is often used for temporary files, and it is particularly helpful if a user is sending data from one computer to another. The disadvantage of RAM disks is that it is volatile - its contents are lost if the computer is turned off or if there is a power failure. Data files, which are always changing, must be saved on disk before you turn off your computer.

Flash Memory

	Flash memory is a type of writable, nonvolatile semiconductor memory. It is a special type of programmable read-only memory (PROM). The contents of flash memory can be altered and it is a good substitute for disk storage where power use is critical, such as with laptop computers. However, due to its higher cost and physical size per megabyte, flash memory is not likely to replace disks for everyday use.

Backup Systems

	Despite the reliability of data storage devices, a backup system - a way of protecting data by copying it and storing it in more than one place is vital. Hard disks can be backed up efficiently with a tape backup system, which can hold many megabytes of data. A key advantage of a tape backup system is that it can copy the entire hard disk in minutes.

Optical Storage: Superdisc Takes Off

	Opticaldisc is cheaper, more compact and more versatile with greater capacity.

How Optical Discs Works

	In optical disc technology, a laser beam records data by producing tiny spots on the metallic surface of an optical disc. Data is read by having the laser scan the disc surface while a lens picks up different light reflections from the spots.

	Optical storage technology is categorized according to its read/write capability. Read-only media are recorded on by the manufacturer and can be read from but not written to by the user.

	Write-once, read-many media, also called WORM media, may be written to once. Once filled, a WORM disc becomes a read-only media. A WORM disc is nonerasable.

	A variation on the optical technology is the CD-ROM, which stands for compact disc read- only memory. CD-ROM has the same format as audio compact discs.

4.10 The Future Approaches

	Today, optical discs can be written to and erased many times. Two competing technologies are magneto-optical discs and phase-change discs. Magneto-optical discs use a laser to heat a spot on disc while magnetizing it. This magnetism can then be read by changing the laser light reflected from the spot. Phase-change media use two laser beams of different powers to melt a spot on a disc. One power creates a 0, the other creates a 1. The different in power results in a difference in the way the spots reflect light, which can be detected by the reading laser. Though magneto-optical arrived first, it has the disadvantage of having to first erase a spot before writing it, thereby doubling the time required to write.

Onward

	Whatever the technology, it seems likely that we will be seeing greater capabilities in the future.