4 ms·
What on earth is nanosecond data resolution? Does it just means file create/modify timestamps are saved with that level of precision? If so, who cares about th
by robertlagrant 10y ago
What on earth is nanosecond data resolution? Does it just means file create/modify timestamps are saved with that level of precision?
If so, who cares about that?
- aembleton 10y agoApparently it's important for tracking the order of operations. I don't know why a ledger couldn't be kept. https://arstechnica.com/apple/2016/06/digging-into-the-dev-documentation-for-apfs-apples-new-file-system/ https://arstechnica.com/apple/2016/06/digging-into-the-dev-d...
- phaemon 10y agoHah, you were too quick for me! Must type faster!
- moomin 10y agoIf it's anything like systems I'm familiar with, it is a ledger: if two things happen at exactly the same time, one happens a nanosecond later.
- simonh 10y agoA ledger is a separate write that slows down I/O and uses up disk space. Any way the question should by why a ledger wasn't used, not why it couldn't. Of course it could, but it's not necessarily desirable.
- phaemon 10y agoYes, exactly that. I had to follow a few links, but Ars Technica has a better story. To quote: "It also massively increases the granularity of object time-stamping: APFS supports nanosecond time stamp granularity rather than the 1-second time stamp granularity in HFS+. Nanosecond timestamps are important in a modern file system because they help with atomicity—in a file system that keeps a record of writes, having nanosecond-level granularity is important in tracking the order of operations." Full thing is at: https://arstechnica.com/apple/2016/06/digging-into-the-dev-documentation-for-apfs-apples-new-file-system/ https://arstechnica.com/apple/2016/06/digging-into-the-dev-d...
- ridiculous_fish 10y agoHigh precision timestamps allow you to more reliably determine if a file has changed. If a writer uses the rewrite-then-move approach for atomic updates, and the reader polls with stat() to detect a change, it's possible that the reader will fail to observe a change if the timestamps are low resolution.
- soneil 10y agoWhat they missed with nanosecond timestamps is that it's a feature which is essentially free - What you're actually looking at is 64bit timestamps. With the 'unix epoch' way of doing things (counting seconds since 1970), a (signed) 32bit int will run out of values in 2038. If they'd counted milliseconds since 1970, they would have exhausted int32_t in less than 36 minutes, and nanoseconds would have exhausted same in less than 2 seconds. So the move to 64bit timestamps solves the '2038 problem' (for the filesystem, at least) - but at some point someone has decided this filesystem does not need to support the year 292,277,026,596AD, and has chosen to use some of the space for granularity instead. (Given 292 billion years is 20 times the estimated age of the universe, they were probably correct in their assumption that we'll have a new filesystem before then). If the number of people who need to differentiate between two files created in the same second, is more than the number of people who expect their Watch to still work after our sun is a cold shrivelled mass - they've made the more logical use of the valuespace.
- rplst8 10y ago> If they'd counted milliseconds since 1970, they would have exhausted int32_t in less than 36 minutes, and nanoseconds would have exhausted same in less than 2 seconds. Milliseconds would have lasted 24 days. Microseconds would have been 36 mins.
- soneil 10y agoYou're right, of course. I wish I could say this was the first time I've confused milli~ with millionth.
- FireBeyond 10y agoOn the bright side, your way can make you a millionaire!
- PhantomGremlin 10y agosomeone has decided this filesystem does not need to support the year 292,277,026,596AD, and has chosen to use some of the space for granularity instead. I don't know where you came up with that number. It is from Apple documentation? A true nanosecond timestamp wouldn't get you anywhere near the number you suggest. Here's a back of the envelope calculation: A 32-bit timestamp with one-second resolution is good for, more or less, 68 years. Or 136 years if unsigned. That's the traditional "unix epoch" setup. Now add 32 more bits to the LSBs of the timestamp. There are 1 billion nanoseconds in a second. A 32 bit integer can hold over 4 billion different values. So the 32 LSBs, if they represent nanoseconds, will overflow in just over 4 seconds. What that means is the 32 MSBs now have a range of just over 4x the traditional Unix timestamp. If it was 68 or 136 years before, it becomes 291 or 582 years. That's what I would have done if I were Apple. I would have set the LSB of a 64 bit unsigned counter to represent 1 nanosecond. I would keep year 0 as 1970. So, problem solved until (roughly) 1970 + 582 = 2552.
- octo_t 10y agoWell for the MIFID-II regulations coming out this year, you need to support at least microsecond precision for audit purposes. And if you're doing microseconds, why not go for the full nanoseconds?