Zero Size Files - Computerphile

Computerphile · Intermediate ·📰 AI News & Updates ·9y ago

Key Takeaways

The video explains how zero-size files can exist on a computer, discussing the difference between file data and metadata, and how file systems like FAT store information about files in a directory.

Full Transcript

one of our loyal viewers sent in a question the other day he was asking why when he creates an empty text document on his computer does it have a file size of Zer bytes well there's no text in it so that sort of makes sense but he realized well actually there's some information associated with it this thing's like it's got a file name there's how big a size it is there's the time it was created and so on where's all that information stored why does it have zero bites and yet we know there's some information stored alongside it so we can um demonstrate what this actually means if we use the computer so let's just create a simple text document this document's got nothing in it so let's save this out to disk and we'll call it empty. txt so we're creating an empty text file and if we look on our system we can see that we have created a file called empty. txt with zero brights in it it's an empty file there's nothing in there and if we have a look at all the data that's in there we try and C file there's nothing in there that's an empty document just to prove that a real text document would have some information in it let's create one that says Hello computer file and save that out and we'll call this as not empty. txt and if we look at that one now we see we' got two files empty which has got zero bites associated with it and not empty which has 21 bytes associated with it if we just look at what's inside not empty we see that that those 21 bytes form the asy codes for Hello computer file so we have these two files one's empty which has nothing in it and one of them has 21 characters in it and the Line Feed at the end for Hello computer file but neither of them actually have the file name stored in them they don't have the date there they don't have how big the file is so where is all that stored what's going on there well actually we need to think about these bits of information about being two things we have one bit of information which is the document in this case it's either empty or it's got some asky characters in it but the other information isn't really part of the document it's describing that document so it's information which tells us what we want to call the document how big it is when we edited it and so on it isn't actually about the document and the easiest way to think about that is think about it if you rename a document you don't change a document so if I rename the file not empty. txt to be still not empty. txt we've changed the file name but the files still the same even though we've given it a longer file name so if we hex dump this one the bites matched between the two different ones so the thing we have to think about first is that we have our document and if we draw that out so we have computer icon for the document and we also have alongside that the information about what we called that in this case empty. txt we said that this document is called empty. txt and it has a size which is zero by and it'll have a date we created it and as we change things about this as we move it around this information will change so we might change the file name so we call it still empty. txt and we get rid of the old file name but we haven't actually changed the document that stayed the same so just as we think about these things as being separately we have the name which describes the document but isn't part of the document the file system in the computer does exactly the same so if you remember back to the videos we did on how data is stored on a disk we divide the dis up into a set of tracks and we break those tracks up into single sectors so as well as storing the documents on the tracks and sectors on the system even if it's an SSD it's still emulating a lot of the time this old system that hard dis tend to use as well of storing the data we also store a directory or catalog that represents where that information is stored I'm going to use the fat file system as an example here because it's relatively straightforward to understand systems like ndfs X2 Etc ZFS will all use different variations but they have similar Concepts they use more efficient ways of representing the catalog so on a fat file system the directory is really just a special type of file so there's a special directory called the root directory which is the one that the system knows about where to find but inside that you'll find entries that point to other directories and also point to files and each of those entries in the original fat system is made up a 32 bytes of data and these are stored consecutively after each other so if we had another one it would immediately follow these 32 bytes so the first 8 bytes for example are used to store the first part of the file name so if we had a file name let's call it empty which is what we use we had the e m p t y so that's five characters and we store the other three being spaces the next three bites store the extension so T XT we don't store the DOT so we have the name pad it up to spaces then we have the extension there we then have various other flags and so on some of which tell it whether it's a directory a special file and so on and then towards the end we have the size and there's four bytes which is specified for that which means you can't have a file bigger than 4 gabt on a fat file system and there's also two bytes which say where the file starts so in this directory at the beginning of the disc we have this information which describes the file most importantly it tells us where on the disc to find it what where it starts and how big it is now we need to know how big it is because we can only allocate uh a whole number of sectors or technically we use clusters which is multiple sectors joined together to store this file so we know where the first one is and then there's another section of the system which tells you which are the ones sort of form together to form a link list of the files that are used we'll go to that in another video or someone will and so we have the size so we know exactly where to stop in the last cluster that we're using so in this case this will be zero because the file is empty and we have the name of it stored here interestingly if the file's zero you can say that the start cluster is also zero so you don't actually have to take up a whole cluster storing nothing so in terms of actual disc space this empty file will St take up no disc space at all because it's all the information it needs is part of the directory now this's one caveat to that as we said each of these files take up 32 bytes and eventually you'll fill up the cluster that is being used to store that directory when you do that the next file will need to start using another cluster and so that will take up another a whole kilobyte of disc or a whole 512 bytes of disc or whatever it is depending on how the file system set up so at some points you will create a file and will use some disc space that might just depend on how many other files you've got as to whether the next file takes any space or not yes so it depends on exactly so as we add more files into a directory more empty files they won't take up any space and then suddenly you'll add an empty file and it'll take up a whole kilobyte of space on dis and then you'll keep adding more and then it won't take up any extra space then you'll add another one and you'll take up a whole kilobyte so you could theoretically fill up your whole hard disk with empty files and have no space on there if you want to try it do so but don't blame me if you suddenly find your computer doesn't work properly you'd have to find some way of deleting the empty files but your computer probably wouldn't boot properly and we know one uses fat these days anyway he created the empty. jxt file and didn't have anything in it and it took up zero bytes now we discussed why it actually takes up some space but he also created uh a rich text file uh an RTF document

Original Description

How can a file take up no space on disk? Dr Steve Bagley explains how '0' size files can exist. Magnetic Media (Floppies & Tapes) https://youtu.be/cWKo_dMUw7M Password Cracking: https://youtu.be/7U-RbOKanYs Google Deep Dream: https://youtu.be/BsSmBPmPeYQ Air Traffic Control: https://youtu.be/QK4wwxTRoAY EXTRA BITS: https://youtu.be/oC7UwnZlYR8 http://www.facebook.com/computerphile https://twitter.com/computer_phile This video was filmed and edited by Sean Riley. Computer Science at the University of Nottingham: http://bit.ly/nottscomputer Computerphile is a sister project to Brady Haran's Numberphile. More at http://www.bradyharan.com
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Computerphile · Computerphile · 0 of 60

← Previous Next →
1 Follow the Cookie Trail - Computerphile
Follow the Cookie Trail - Computerphile
Computerphile
2 EXTRA BITS - Follow the Cookie Trail - Computerphile
EXTRA BITS - Follow the Cookie Trail - Computerphile
Computerphile
3 Musical Floppy Drives - Computerphile
Musical Floppy Drives - Computerphile
Computerphile
4 The Hair Algorithm - Computerphile
The Hair Algorithm - Computerphile
Computerphile
5 Getting Sorted & Big O Notation - Computerphile
Getting Sorted & Big O Notation - Computerphile
Computerphile
6 Quick Sort - Computerphile
Quick Sort - Computerphile
Computerphile
7 Hyper History and Cyber War - Computerphile
Hyper History and Cyber War - Computerphile
Computerphile
8 Entropy in Compression - Computerphile
Entropy in Compression - Computerphile
Computerphile
9 Original Elite on the BBC B - Computerphile
Original Elite on the BBC B - Computerphile
Computerphile
10 IP Addresses and the Internet - Computerphile
IP Addresses and the Internet - Computerphile
Computerphile
11 A Career in Video Games - Computerphile
A Career in Video Games - Computerphile
Computerphile
12 Error Detection and Flipping the Bits - Computerphile
Error Detection and Flipping the Bits - Computerphile
Computerphile
13 Programming BASIC and Sorting - Computerphile
Programming BASIC and Sorting - Computerphile
Computerphile
14 Birthplace of the World Wide Web - Computerphile
Birthplace of the World Wide Web - Computerphile
Computerphile
15 Punch Card Programming - Computerphile
Punch Card Programming - Computerphile
Computerphile
16 Programming Paradigms - Computerphile
Programming Paradigms - Computerphile
Computerphile
17 CERN Computing Centre (and mouse farm) - Computerphile
CERN Computing Centre (and mouse farm) - Computerphile
Computerphile
18 Error Correction - Computerphile
Error Correction - Computerphile
Computerphile
19 Home-Made Code - Computerphile
Home-Made Code - Computerphile
Computerphile
20 Security of Data on Disk - Computerphile
Security of Data on Disk - Computerphile
Computerphile
21 Gesture Controls - Computerphile
Gesture Controls - Computerphile
Computerphile
22 How Intelligent is Artificial Intelligence? - Computerphile
How Intelligent is Artificial Intelligence? - Computerphile
Computerphile
23 Encryption and Security Agencies - Computerphile
Encryption and Security Agencies - Computerphile
Computerphile
24 Virtual Machines Power the Cloud - Computerphile
Virtual Machines Power the Cloud - Computerphile
Computerphile
25 Hacking Websites with SQL Injection - Computerphile
Hacking Websites with SQL Injection - Computerphile
Computerphile
26 How Huffman Trees Work - Computerphile
How Huffman Trees Work - Computerphile
Computerphile
27 Cracking Websites with Cross Site Scripting - Computerphile
Cracking Websites with Cross Site Scripting - Computerphile
Computerphile
28 Cloud Computing (Cloudy with a Chance of Pizza) - Computerphile
Cloud Computing (Cloudy with a Chance of Pizza) - Computerphile
Computerphile
29 Texting Cabbage with a Recorder - Computerphile
Texting Cabbage with a Recorder - Computerphile
Computerphile
30 Hashing Algorithms and Security - Computerphile
Hashing Algorithms and Security - Computerphile
Computerphile
31 How YouTube Works - Computerphile
How YouTube Works - Computerphile
Computerphile
32 How NOT to Store Passwords! - Computerphile
How NOT to Store Passwords! - Computerphile
Computerphile
33 A New Golden Age of Video Games - Computerphile
A New Golden Age of Video Games - Computerphile
Computerphile
34 A Universe of Triangles - Computerphile
A Universe of Triangles - Computerphile
Computerphile
35 Cross Site Request Forgery - Computerphile
Cross Site Request Forgery - Computerphile
Computerphile
36 The True Power of the Matrix (Transformations in Graphics) - Computerphile
The True Power of the Matrix (Transformations in Graphics) - Computerphile
Computerphile
37 The Great 202 Jailbreak - Computerphile
The Great 202 Jailbreak - Computerphile
Computerphile
38 EXTRA BITS - Printing and Typesetting History - Computerphile
EXTRA BITS - Printing and Typesetting History - Computerphile
Computerphile
39 Triangles to Pixels - Computerphile
Triangles to Pixels - Computerphile
Computerphile
40 The Problem with Time & Timezones - Computerphile
The Problem with Time & Timezones - Computerphile
Computerphile
41 The Visibility Problem - Computerphile
The Visibility Problem - Computerphile
Computerphile
42 Lights and Shadows in Graphics - Computerphile
Lights and Shadows in Graphics - Computerphile
Computerphile
43 The Penguin Barcode - Computerphile
The Penguin Barcode - Computerphile
Computerphile
44 Typesetters in the '80s - Computerphile
Typesetters in the '80s - Computerphile
Computerphile
45 The Font Magicians - Computerphile
The Font Magicians - Computerphile
Computerphile
46 The Little Mac with the Big Bite - Computerphile
The Little Mac with the Big Bite - Computerphile
Computerphile
47 EXTRA BITS - More on the Original Mac at 30 - Computerphile
EXTRA BITS - More on the Original Mac at 30 - Computerphile
Computerphile
48 XP to Ubuntu with an 8yr old Hacktop - Computerphile
XP to Ubuntu with an 8yr old Hacktop - Computerphile
Computerphile
49 EXTRA BITS - Hacktop Real-Time Boot Comparison - Computerphile
EXTRA BITS - Hacktop Real-Time Boot Comparison - Computerphile
Computerphile
50 EXTRA BITS - Making a Bootable USB in Linux - Computerphile
EXTRA BITS - Making a Bootable USB in Linux - Computerphile
Computerphile
51 EXTRA BITS - Installing Ubuntu Permanently - Computerphile
EXTRA BITS - Installing Ubuntu Permanently - Computerphile
Computerphile
52 The Dawn of Desktop Publishing - Computerphile
The Dawn of Desktop Publishing - Computerphile
Computerphile
53 What is Bootstrapping? - Computerphile
What is Bootstrapping? - Computerphile
Computerphile
54 Reverse Polish Notation and The Stack - Computerphile
Reverse Polish Notation and The Stack - Computerphile
Computerphile
55 Home-Made Z80 Retro Computer - Computerphile
Home-Made Z80 Retro Computer - Computerphile
Computerphile
56 Should Everybody Learn to Code? - Computerphile
Should Everybody Learn to Code? - Computerphile
Computerphile
57 Programming in PostScript - Computerphile
Programming in PostScript - Computerphile
Computerphile
58 Heartbleed, Running the Code - Computerphile
Heartbleed, Running the Code - Computerphile
Computerphile
59 YouTube's Secret Algorithm - Computerphile
YouTube's Secret Algorithm - Computerphile
Computerphile
60 YouTube Search & Discovery - Computerphile
YouTube Search & Discovery - Computerphile
Computerphile

The video explains how zero-size files can exist on a computer by discussing the difference between file data and metadata, and how file systems like FAT store information about files in a directory. This is important for understanding how computers store and manage files.

Key Takeaways
  1. Create an empty text document
  2. Save the document to disk
  3. Examine the file size and contents
  4. Understand the difference between file data and metadata
  5. Learn about file systems like FAT
💡 Zero-size files can exist because the file system stores metadata about the file, such as its name and size, in a directory, rather than in the file itself.

Related Reads

Up next
Man dies after horror Gold Coast house fire; high-speed Sydney motorway pursuit | 9 News Australia
9 News Australia
Watch →