Quick question about file size. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Quick question about file size.

As most people on this app know files are stored as 0s and 1s but is 1gb 1,000,000,000 sets of digits or 1,000,000,000 individual digits of 0s and 1s?

4th Jul 2017, 8:17 PM
Cheesy Game Studios
Cheesy Game Studios - avatar
3 Answers
+ 3
It's 1024 * 1024 * 1024 bytes where each of them on most platforms would be consist of 8 bits (1 or 0)
4th Jul 2017, 8:28 PM
soman
+ 3
@Verkatesh Pitta: Even if on disk there are 'chunks' of any size, the file size reported correspod to the real file size, not to the disk space used ;) @soman: A byte is ever a group of 8 bits, whatever the platforms (what's differ among platform is the length of 'words' which are multiple of bytes, so multiple of 8 bits... today 64 bits is common, using 'words' of 8 bytes)... @Cheesy Game Studios: 'b", 'kb', 'mb', 'gb' and so on are confusing because the 'b' can stand for 'bit' as for 'bytes'... a little ore explicit is that we use as well 'o', 'ko'... where 'o' stand for octet (wich is near same that byte): so 1gb is 1,000,000,000 x 8 individuals digits of 0s and 1s ;) ... or approximatively ;P Because in computer logic, 1k is not 10^3 (1,000) like in human decimal logic, but 2^10 (1024)... So strictly, 1gb is 1024*1024*1024*8 bits :P But commercial purpose have abused, and sold memory support using the shortcut 1k = 1000, not false itself, to sold us less memory than expected : a hard disk of 500gb would be expected to be 536,870,912,000 octets, but is only 500,000,000,000 :( And now, they have success to impose the idea that 'normal' count is human kilo count, and that the gap between 'real' size and expected one was lost in the format process (sic)... TV sellers have done similar cheating, measuring size of TV box rather than size of TV screen...
5th Jul 2017, 3:24 AM
visph
visph - avatar
0
in chunks of 512 or some other 2 raised to x. You can decide this when creating disk slices or partitions based on what your chosen filesystem allows. databases being different beasts, use their own chunk sizes. I think the database lingo for it is extant. The various sizes described above are dictated by requirements such as time and/or space optimization.
4th Jul 2017, 10:29 PM
Venkatesh Pitta
Venkatesh Pitta - avatar