More Apple Secrets
From the originals
13 scansMachine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.
These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.
PDF page 12
numbering is important, because that is precisely the order in which DOS reserves the sectors of a track when creating a file. How Disk Reading Works The key routine is the DOS Read/Write TracldSector (RWTS) routine. For any program to read a sector of data, the program makes a machine language subroutine call (JSR) to RWTS, supplying a parameter list containing the desired slot, drive, track, (logical) sector, volume number, and the data's memory address. The DOS 3.3 File Manager is the most common caller ofRWTS. When called, the RWTS first turns the disk drive on, if necessary. Once on, the disk drive keeps turning. Next, the RWTS positions the read/write head to the correct track and then waits for the desired logical sector to rotate under the head. (It looks at the address headers for a match on the corresponding physical sector.) Then the RWTS transfers 342 bytes of encoded raw data from the disk into a special area of memory. The raw data is decoded into a normal 256-byte sector format and moved to the memory location specified by the caller. The same general sequence occurs on a write, except that the data is moved from the caller's memory location, encoded into raw data, and then transferred to the disk. As you can imagine, this process takes time - much more time than the brief interval between the end of one physical sector and the beginning of the next. The alternating spacing of logical data sectors on a track allows time for RWTS to decode and move, and for the caller ofRWTS to process one sector, and then to resume reading the disk before the start of the next logical sector has rotated past the disk's read/write head. This works great as long as the caller ofRWTS doesn't allow too much time to elapse before calling RWTS again. Disk 1/0 Timing A Disk II drive turns at 300 rotations per minute (5 rotations per second). With 16 sectors per track, this rate is equivalent to 80 sectors per second. In reading every other physical sector, the intersector time available for processing is therefore l/80th of a second, or 12.5 milliseconds. RWTS uses about seven milliseconds of this time itself for raw data decoding and moving. This leaves only about five milliseconds of processing time for the caller of RWTS before the next logical sector of the current rack rotates into position under the read/write head of the disk. File Space Files are created one sector at a time. As successive sectors are written, unused disk sectors must be located and reserved before the data is actually transferred. This is necessary to ensure that sectors of other files on the disk are not overwritten by the new file. As the file is written, the DOS File Manager must remember which sectors were used, and in what order. For each file, the File Manager creates a track/sector list that records the track and logical sector number of each successive sector of the file. To choose which sector to allocate to a file, the File Manager first finds a track with some unused sectors. Within that track, the File Manager starts looking for free sectors from sector 15 to sector 0. Once a file is started on a given track, all free sectors on that track are allocated to the file until there are none left Then a new track is selected. Thus, the DOS File Manager is recording successive sectors of a file in exactly the order (15-0) for maximizing the speed of file I/O. Load Performance Now let's see how all the above information pertains to the performance of LOADs. The standard DOS 3.3 LOAD function uses the File Manager, in conjunction with RWTS, to copy data between the disk and the Apple's memory. LOAD reads the program file into memory in exactly the same way as a user's program would read a text file. This process involves 6
Reading notes: Page ends mid-sentence at the LOAD performance section, so the reading order is incomplete.
- Printed product names
- DOS · DOS 3.3 · Disk II · Apple
- Languages
- English