Delete

Share

What does it meant to Delete?

To delete means "to erase" data, except not exactly. We can delete files in our computer, delete folders that contain files, delete layers in an image editor, delete things in all sorts of applications, however, none of this reduces the amount of memory in the computer, it just changes the data that exists in memory.

The files in your PC are stored in a mass storage device such as a hard disk or SSD. These devices can contain a certain volume of data, such as 500 gigabytes of data. What this means is that it's possible to store 500 gigabytes worth of bits in the device. This is the amount of bits that existe PHYSICALLY in the device, and this amount can't be changed, thus, there is no way to "remove" bits, to remove data, we can only change the value of the bits that are in there.

Similarly, data in a program that is currently running is stored in RAM memory, and the cartridges would have a capacity of a few gigabytes. If you have 16 gigabytes of RAM, and you delete a layer that uses 4 gigabytes somehow, you still have 16 gigabytes of RAM. Deleting the layer didn't remove a fragment of the cartridge that is inserted in your motherboard.

So what does deleting do?

When you delete data, you're simply you're making your computer "forget" where the data is.

For example, let's say you have this piece of data, 11110000, that is stored in some memory. Whether in RAM or in disk, we're going to have an immensely long sequence of bits, and our data is going to be there somewhere.

0001000100001000111100001011010010011100

Can you find the data? It starts in the 17th bit and ends in the 24th bit.

If this data was a file of 50 kilobytes, it would span 400000 bits, but the principle is the same.

When the computer wants to retrieve some data, it looks into this sequence and takes the bits starting from one point and ending in another point.

When we delete data, we don't changing the bits, we just forget where the data starts and ends.

How does the computer know where the data starts and ends? It stores that in memory as well! For example, 17 as a binary number is 10001. In the binary code above, we could imagine that the first 8 bits (the first byte) indicates where the data we starts (00010001), while the next byte indicates its size (00001000 equals 8). These concepts are called a pointer and a data size, respectively.

If we want to delete something, all we need to do is make the computer forget where it starts, so we would just change the pointer to a special value that means "undefined," such as the value zero (00000000), also known as a null pointer.

Of course, in this example we only have one tiny piece of data to remember about. In a real program, we would have as many files as we wanted. However, the idea is essentially the same. There will be a piece of data that tells us where the data we want actually resides, and when we delete, we just forget about it.

These systems also operate under the concept of reserved memory. When a space of memory is reserved, that means it's being used by an existing thing (e.g. a file occupies it). When something is deleted, the reservation is freed. It becomes free memory that other files (or layers) can use. When your disk or memory is "full" and you need to delete things, what that really means is that all spaces in memory are reserved by one thing or another, and you need to free some spaces in order to be able to store new data.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *