Last few days before, I had a lucid dream. The moment I got up, I wished I had some way to store it up. It was beautiful. I wished my pillow would have some sort of memory to store my dreams…
I was thinking of all this and suddenly, something struck in my mind…wait !!! What happens to your files, your documents when you delete them !!!
It’s beautiful to see how sophisticated out technologies and our programs are. Every time I learn something new about technology. about something in my phone or the operating system, it never fails to amaze me with how beautiful this section of programming is !!!
Anyways, I would like to explain deletion of files in simplest possible way. I’m sure you would like it.
Let’s know that any memory itself is arranged in the form of matrix ( let’s assume this for visualization purpose). So my 1GB of memory is a huge set of (X rows) * (Y columns) matrix.
Every time I store something in it, It get’s stored sequentially ( Well there are dynamic methods too but let’s not get into that complexity). So my 10MB file might fill 10 cells in the row, next file will start filling from 10 cells onwards and so on …This way, your memory gets filled.
Look at how this software shows your memory used, filled with different colors.
Now the moment you decide to delete some file in memory, lets say cell number 10-15 in some row, It would get deleted, anything stored in there will be wiped out. Right ? No!!!
It isn’t so .. and there’s reason for it.
This is what happens when you delete your file.
When you press delete button, internally the boss just marks that memory area for deletion but never actually deletes it … Why ? I’ll explain.
That area gets marked for deletion and you are shown that the file has been erased ( mind that actually it’s not erased).
Now this thing provides two advantages.
- Just in case sometime later you thought that you should not have deleted the file and it was important, you can simply recover it. Right ? You just unmark that area for deletion and boom, your file is recovered. Matter of the fact, that’s what the concept of recycle bin is, recycle bin simply holds list of areas marked for deletion and thus you can restore your deleted files.
- It doesn’t clutter your memory cells with unnecessary blanks of these deleted files. Just imagine your 10 GB of memory rows and columns with lot of empty spaces in between. Not at all efficient to read/write right ? So just “marking them for deletion and not actually deleting them” keeps those memory spaces filled and doesn’t introduce any empty spaces in between.
If you read this clearly, you would see a problem here. The problem is, I’m deleting my file, it’s just shown to me that its deleted but actually it’s not and plus that unnecessary info is still there just for the sake of not introducing any empty slots in between.
No !! That’s not what it is, the very fact that the memory area is marked for deletion means that that space could be used for new files to store if required. So based on how big your new file is, if there’s any area marked for deletion that could accommodate your new file, your new file gets stored there.
This is the very reason because of which when you recover your deleted files, not all of them get recovered. The ones that did not get recovered, are already gone because that area was marked for deletion and the new file you stored later, it fit into that area ultimately overriding your deleted files memory.
Soooooo … programmers could have simply deleted those files but they did not .. They optimized the process to get as much out of it as possible … that’s the beauty of coding. Everyone can write code, do 3 months of python course and you are a python coder but writing a code that’s optimized, well thought is a skill.
Anyways, this is what happens when you delete your file. So next time you delete something, think of what happened inside. Who says machines doesn’t fool.
I’ll now go and grab my cup of coffee …