News for hackers. Stuff that matters.
Re:Take care editing bash scripts (2019) by TeMPOraL on Thursday May 07, 2020 @06:41AM (#23101547)
Come to think of it, I started programming on Windows, and my first introduction to the filesystem operations was iostream in C++. Being a kid then, I haven't learned about syscalls or inodes until a lot, lot later. I always imagined the filesystem as a more sophisticated version of an array of pairs <startAddress, length>. Thus I assumed shortening a file is trivial (just decrement the length), but making a file longer may require copying it over to somewhere else, if there isn't $newLength bytes available after the $startAddress. I believed that defragmentation meant removing gaps caused by shortening or deleting files.

(N.b. this is how simple memory allocators work.)

So in the end, for a long while, I hadn't had an issue that would make me double-check those assumptions.

There are no comments on this comment yet.