STONE RIDGE, N.Y. 12484
INSTRUCTOR:
Karl Wick SEMESTER: Spring 1999
|
0-64k |
System ROM (Holds the BIOS) |
|
64k-640k |
Conventional Memory - for programs and system drivers |
|
640k-1meg |
Expanded Memory - for drivers |
|
1meg-32meg |
Extended Memory - for programs and cache use. |
Note: The above table applies to the DOS operating system. Windows simply uses one large continuous block of memory with the beginning holding the BIOS and the rest divided by the system as neccessary.
At power up, the micro-processor always looks at memory location zero, where it should find the BIOS ROM and its first instructions.
The size of the ROM can vary, and may be overlapped with RAM in many machines.
Before we go on, here are some definitions:
|
Random Access Memory. The largest section of memory in a computer. Application programs use it. RAM is volitile. It will forget its data if the power is removed. It is temporary storage and very fast. |
|
|
Read Only Memory. Permanent memory whose contents are fixed. ROM retains its data even without power. It usually contains the system BIOS and other system specific and critical information. |
|
|
Electrically Erasable Programmable ROM. Like ROM but electrically erasable and re-programmable |
|
|
CMOS Ram |
A special type of memory used to store system parameters. It retains its information through a battery backup system. It is used to store system hardware parameters, and may be reprogrammed via a special routine in the BIOS. This routine is accessible only at boot up. For computers with AMI |
Formatting is the process of preparing a floppy disk to store data. There are various types of format in use, but th emost common is the 3-1/2" disk capable of holding 1.44 megabytes of information.
Some disks come pre-formatted for a particular operating system (they are not interchangable), and others come unformatted. Pre-formatted disks are mass formatted at the factory and occasionally contain errors or bad places.
We format a disk for the following reasons;
|
5-1/4" Single Sided |
360 kilobytes |
Early Floppy for PC |
|
5-1/4" Double Sided |
1200 kilobytes |
Old Style Floppy for PC |
|
3-1/2" Double Density |
720 kilobytes |
Older PC type disk |
|
3-1/2" High Density |
1.44 megabytes |
Standard PC type disk |
|
3-1/2" Double Spaced |
2.88 megabytes |
Special format, less reliable |
|
Zip 100 |
100 megabytes |
PC and Apple drives |
|
LS-120 |
120 megabytes |
PC and Apple drives |
|
Zip 200 |
200 megabytes |
PC and Apple drives |
|
Jazz |
1000, 2000 megabytes |
PC and Apple drives |
|
Hard Disk |
Up to 12 gigabytes + |
PC and Apple drives |
Format.com is an External file which usually resides in the \DOS\ sub-directory. Because it is an external command it must be loaded from disk each time that it is invoked. If it is not present on a disk then an error will be generated.
Here is a visual illustration of what takes place when we format a disk. Although we show only one side of the disk, both sides are divided in similar fashion.
|
|
Picture a new disk as a blank piece of media. On the back of a 3-1/2" disk is a notch marking an arbitrary starting point. The older 5-1/4" floppies had a small indexing hole near the spindle. |
|
The first stage of format electrically divides the surface of the disk into a series of concentric circles called tracks. On a hard disk the tracks may be called cylinders. The number of tracks or cylinders depends on what type of disk is being formatted. |
|
|
|
The next step of the process divides each track into equal length sectors. The number of sectors per track depends on the type of disk and each sector typically holds 512 bytes (or characters) of information. |
Disk storage space = (# of tracks per side) * (# of sectors per track) * (# of sides) * (512 bytes).
Note: The 512 bytes per sector is typical and may vary with some systems.
Example: (80 Tracks per side) * (18 sectors per track) * (2 sides) * (512 bytes per sector) =
1,474,560 bytes. Why is this not 1.44 as in megabytes? A very good question. Actually a megabyte is often thought of as being 1000 kilobytes (a moot point by the way), but a kilobyte is 1024 bytes instead of 1000, so ... 1,474,560 / 1024 = 1440 kilobytes or about 1.44 megabytes.
|
Disk Size |
Tracks per Side |
Sectors per Track |
|
360 kiloByte |
40 |
9 |
|
720 kiloByte |
80 |
9 |
|
1.2 MByte |
80 |
15 |
|
1.44 MByte |
80 |
18 |
|
2.88 MByte |
80 |
36 |
|
1.2 gigabyte 16 sided HD |
2100 |
63 |
|
3.1 gigabyte 16 sided HD |
6136 |
63 |
so DOS will mark them as unusable and display a message telling how many bytes of data storage space will be unusable.
|
1440000 bytes total disk space |
|
40000 bytes in bad sectors |
|
1400000 bytes available on disk |
Insert a disk into the drive and type Format A: <enter>
After the format is complete you will be asked for a"Volume Label". You can either give the disk a name here or simply type <enter> to use none.
Then you will see several lines of information telling you the results of the format operation and asking if you want to format another. If you say yes, then the format routine (which is still in memory at this time) begins again. If not, then those memory loactions become available for use by other programs.
In addition to dividing the disk surface into tracks and sectors, the Format command does several other things.
A boot disk contains three special files, two of these files are 'hidden' (do not appear in directory listings) so that the casual user cannot inadvertantly delete of modify them.
These files are: IO.SYS, MSDOS.SYS, and Command.com, with the first two being the hidden files.
DOS looks for these files locations at the beginning of the directory area. (the first sector of the first track, after the MBR.) If they are not there then the disk cannot boot the system.
The best way to make sure that these entries are at the beginning of the directory is to load these files is to load them onto the disk right after formatting and before any other information is stored on the disk.
|
A bootable disk is created with the /S switch. |
Format A: /S |
The format process is identical to the regular version, with the exception that the three critical files are loaded onto the disk automatically as soon as format is complete.
It will even give the message "Loading system files".
|
The first sector of the first track of a disk contains special information called a boot record. The boot record contains information about the type of disk, its size, number of tracks and sectors and a small program. If it is a bootable disk, this program tells the BIOS where to find the special DOS files so that it can load them. If it is not a boot disk, then this program simply displays the message "Non-System disk or disk error" "Replace and press any key when ready". NOTE: Replace means replace or simply remove if a floppy disk (to allow booting from the hard disk instead.) |
|
|
Every file on a disk is stored in a series of sectors (may be one or more in length). A table of exactly which sectors correspond with which files is stored on a part of the disk called the File Allocation Table or FAT. This file allocation table is stored on the disk in the sectors immediately following the boot sector. Without the FAT, you cannot normally access any file on the disk. Because errors do happen, DOS (by default) makes a copy of the FAT and uses it if the main FAT becomes corrupted.
A larger FAT allows more room for entries but takes up more sectors for the actual table. |
|
After creating the FAT, DOS sets aside the next few sectors for something called the root directory. This is true for all disks whether system type or not. Every time a file or sub-directory is stored (or created) on the disk, DOS reserves a 32 byte storage location for information about that file or sub-directory. This area will store the name, size, date and time of modification of the file or sub-directory. Once the root directory is filled, you cannot store any additional files on the disk even though the actual physical disk space may not be full. |
|
The root directory of a "standard" 3-1/2" floppy will occupy 14 sectors. You might recall that a sector on these disks holds 512 bytes of information, so the entire root directory can hold 14 * 512 bytes or 7168 bytes (or about 0.5% of the available space on the disk.) Since each entry holds only 32 bytes of information this is enough for 244 file and sub-directory names.
Occasionally, if a disk has many very small files (244 to be exact) and you try to create another you will see the message "File creation error". This means that the root directory is full and cannot hold any more names. You will need to:
The size of the root directory cannot be changed after formatting.
Now let us further complicate matters
DOS (And other operating systems) add another level of complication to the whole storage process. When storing a file, the space reserved for that file is not usually the same as the actual size of the file in bytes or even in sectors.
Space is set aside for a file in fixed amounts called Allocation Units. An allocation unit may contain one sector or more than sector depending on the OS and the size of the disk. The number of allocation units set aside to store a particular file is the minimum amount of disk space reserved for that file.
For example, after formatting a floppy disk, the OS may give a message saying that it created 2847 allocation units on the disk with 512 bytes per allocation unit. This may be the same size as one sector or an integer multiple of sectors.
Let us assume that an allocation unit on a particular disk is 512 bytes (the same size as one sector), and we have five files named "SMALL", "LARGE", "LARGER", "TINY", and "EXACT".
The space that DOS will reserve for each file is the smallest integer number of allocation units which has a total space at least as large as the file.
|
File Name |
Actual Size |
Number of Allocation Units Reserved for file |
Space reserved on disk for storage of the file |
Wasted Bytes |
% Wasted |
|
SMALL |
495 bytes |
1 |
512 bytes |
17 |
3.3% |
|
LARGE |
800 bytes |
2 |
1024 bytes |
224 |
21.9% |
|
LARGER |
1025 bytes |
3 |
1536 bytes |
511 |
33.3% |
|
EXACT |
512 bytes |
1 |
512 bytes |
0 |
0% |
|
TINY |
1 byte |
1 |
512 bytes |
511 |
99.8% |
Notice that more space is actully reserved to store a file than the file really needs. This results in a certain amount of wasted space on the disk. With some files like SMALL, the wasted space is almost insignificant, with others like LARGE it becomes relative substantial (about 20% of the total allocated space)
Notice that the files LARGE and TINY both have 511 wasted bytes in their allocations. With LARGE this is about 1/3 of the total but with TINY it is almost all of the total.
So, it is more efficient to store large files ... but eventually a file becomes too large to fit onto the disk so you need a larger disk.
The following table lists some of the allocation unit sizes created by DOS when it formats a hard disk:
|
Hard Disk or Partition Size |
Bytes per allocation Unit |
|
32 Megabytes |
2 kilobytes |
|
128 Megabytes |
2 kilobytes |
|
256 Megabytes |
4 kilobytes |
|
512 Megabytes |
8 kilobytes |
|
1 Gigabyte |
16 kilobytes |
|
2 Gigabytes |
32 kilobytes |
|
DOS cannot recognize a partition over 2 GB in size. |
|
|
Windows 98 can recognize a partition of up to 2 TerraBytes |
FAT 32 cuts sizes by about 75% (512 MB minimum) |
The moral of the story is: Every disk has a lot of wasted space!
Well, basically it would make the FAT huge.
The FAT tells DOS which clusters of the disk are:
To keep track of a 1 gigabyte disk with 512 KByte sectors by sector would require 2000 entries in the FAT and each entry would probably be 16 bytes long, using 32kB just for the FAT. Two copies of the FAT would require twice as much space.
It would take an inordinate amount of time to search through all of this data to find a particular file, thus decreasing the throughput of the entire system.
Again, a tradeoff has been made, some wasted disk space give us acceptable speed.
(chapter 42 in book)
When a file is first stored on an empty disk DOS tries to store it in sequential locations. This makes reading it back into the computer a lot easier and faster. (Just find the starting point and keep reading).
When a file is deleted, the actual data is NOT removed from the disk. The FAT is simply updated to show the allocation units occupied by that file as available. The data remains until another file is written to those locations.
When the size of a file is larger than the longest continuous set of allocation units left on the disk, it cannot be stored in sequential locations. Instead, parts of the file may be stored in several places on the disk. The FAT must keep track of the allocation units used and the order in which to access them. It also takes longer because other sectors must pass under the disk head while rotating to the needed one.



The white areas are empty of data.


If we needed to add a file over 4 allocation units in length, it would not fit on the disk. If we need to add a file 3 or 4 allocation units in length, it would have to be stored in non-sequential locations. The file would be Fragmented.

In order to read this file we need to jump around to three different parts of the disk.

The files on this disk are much faster to read as they require less overhead during access.
Defragmentation
is the process of consolidating the files on a disk into sequential allocation unitsUse the CHKDSK command to test a dist for fragmentation. You must add a drive or directory specification after the command. CHKDSK *.* will check all directories.
If CHKDSK finds more than a few fragented files, they can be consolidated using the DEFRAG command.
In case you don't see two buttons above, click here to go to chapter 5.