From: tom e. <te...@dr...> - 2024-08-19 20:00:12
|
>> > After boot the first time I run a `DIR` command e.g. >> > The directory list returns quickly, but the number of bytes free takes another 30 seconds to appear. >> > Subsequent `DIR` commands return immediately whether in the same directory or elsewhere. > In particular, if you say it takes 30 secs., I would blindly hope a > partition half that size would take only half as long to calculate. Unlikely as the size of the FAT remains exactly the same. > I have some very small and simple ASM code that calculates free space > (8086, int 21h 36h) and another (386, FAT32 with LFNs, int 21h 7303h). > Feel free to ask for it (public domain). Wow. ASM code !! By Ruxulo!! How do you think FreeCOM gets the free space on disk? > But you're saying it's not the slow DIV instruction (to get decimal > output) holding things up. If that were the holdup, you could just > output hexadecimal (no slow DIV needed). Even idiots should be able to deduce that it's not the time for the DIV instruction as this time remains the exact same when it's done later a second time. >> That's something in the design of DOS/FAT. >> When the machine boots, it doesn't know the amount of free clusters on the disk. >> >> When asked about free disk space, it has to read the entire FAT and count the number of unused clusters. >> And it does so one sector of FAT data after he next sector. that's no problem on a FAT16 drive with at most >> 256 sectors in the FAT, but can be a problem for large FAT32 drives. >> >> After this first time, DOS remembers the number of free clusters and keeps track of them over >> creat, write, delete operation so it is much faster. > Doesn't FAT32 already keep the amount of free space stored somewhere? No, And for a good reason. DOS crashes regularily, with no opportunity to write back this number to the disk before shutting down. > No slow calculation at bootup needed. This is not at bootup, but at the first time "free disk space" is requested. Tom |