1

I'm studying xv6: unix like operating system.

For exercise quiz, it asks:

Due to sector granularity, the call to readseg in the text is equivalent to readseg((unchar*) 0x100000, 0xb500, 0x1000). In practice, this sloppy behavior tunrs out not to be a problem. Why doesn't the sloppy readsect cause problem?

What is sector granularity???

p.s sloppy behavior? readseg((unchar*) 0x100000, 0xb500, 0x1000)..?? I have no idea what's going on.

merry-go-round
  • 4,533
  • 10
  • 54
  • 102
  • 1
    I believe *sector granularity* is just the size of the sector. On a disk drive, the smallest amount that can be read or written is a sector. For more information, go to www.google.com and search for "sector granularity". The term "sloppy" in the above text is probably itself a little sloppy. It just means "imprecise" since the granularity is sector, not byte. – lurker Jan 23 '18 at 12:03
  • 1
    The quote is referencing a missing part. What's probably going on, if [this](http://www.cse.iitd.ernet.in/~sbansal/os/previous_years/2011/xv6_html/bootmain_8c-source.html#l00078) is the implementation of `readseg(uchar* va, uint count, uint offset)`, is that `va` is aligned on 512 byte *backward* (rounded down) and an integral number of sectors is read, even if this exceeds the requested `count` bytes. Thus there exists different inputs that gives the same results (e.g. `readseg(0x1ff, 0x1, ...)` is equivalent to `readseg(0x0, 0x200, ...)`). P.S. Try to make questions self-contained. – Margaret Bloom Jan 23 '18 at 12:16
  • thank you guys... I appreciate that. It gives me some sense of understanding the problems – merry-go-round Jan 23 '18 at 12:39

0 Answers0