Everyone:

Next week, we will discuss how to enforce consistency in file systems and how to maintain data integrity.

TL;DR

For this reading assignment, you are to read about maintaining consistency and integrity in file systems, and submit your responses to the Reading 12 Quiz.

Reading

The readings for this week are:

  1. Operating Systems: Three Easy Pieces

Optional

These readings may be covered in class, but you will not be quizzed on the following:

  1. ZFS 101—Understanding ZFS storage and performance

  2. The Google File System

  3. MapReduce

Optional AI Conversation

Using Learn About from Google, have a conversation about file systems consistency and integrity by asking the following questions:

  1. How does a traditional unix file system maintain consistency?

  2. What does the fsck utility do?

  3. How does journaling help with file system consistency?

  4. How does a file system maintain data integrity?

  5. Is crash consistency the same thing as data integrity?

As you explore, feel free to dive into the suggested related questions or to "simplify", "go deeper", and "get images".

Quiz

Once you have done the readings, answer the following Reading 12 Quiz questions:

Program

For this week, you are to write a program that analyzes a stream of bytes that uses an even parity bit scheme to check for consistency within each block of data:

# Check byte stream for consistency (no errors)
$ printf '12345670' | ./program ; echo $?
0

# Check byte stream for consistency (1 error)
$ printf '12345671' | ./program ; echo $?
1

The byte stream is encoded in the following format:

Each Block of bytes consists of seven bytes followed by a parity byte, which is computed by XORing all the bytes together.

Your task is to read in a stream of Blocks and verify that the parity byte of each Block is consistent with the provided data within the Block. At the end of your program, return the number of inconsistent blocks as the status code.

Hints

  1. You can use the Block structure defined above.

  2. You can use fread to read in one Block at a time.

  3. To compute XOR, you can use ^.

Submission

To submit you work, follow the same process outlined in Reading 01:

$ git checkout master                 # Make sure we are in master branch
$ git pull --rebase                   # Make sure we are up-to-date with GitLab

$ git checkout -b reading12           # Create reading12 branch and check it out

$ cd reading12                        # Go into reading12 folder
$ $EDITOR answers.json                # Edit your answers.json file

$ ../.scripts/check.py                # Check reading12 quiz
Checking reading12 quiz ...
     Q01 0.40
     Q02 0.20
     Q03 0.10
     Q04 0.35
     Q05 0.45
     Q06 0.20
     Q07 0.30
   Score 2.00 / 2.00
  Status Success

$ git add answers.json                # Add answers.json to staging area
$ git commit -m "Reading 12: Quiz"    # Commit work

$ $EDITOR program.c                   # Edit your program.c file

$ make test-program                   # Check reading12 program
Checking reading12 program...
 disk1                                                        ... Success
 disk1 (inconsistent byte)                                    ... Success
 disk1 (inconsistent parity)                                  ... Success
 disk1 (swapped bytes)                                        ... Success
 disk2                                                        ... Success
 disk2 (inconsistent byte)                                    ... Success
 disk2 (inconsistent parity)                                  ... Success
 disk2 (swapped bytes)                                        ... Success
 disk3                                                        ... Success
 disk3 (inconsistent byte)                                    ... Success
 disk3 (inconsistent parity)                                  ... Success
 disk3 (swapped bytes)                                        ... Success
 disk4                                                        ... Success
 disk4 (inconsistent byte)                                    ... Success
 disk4 (inconsistent parity)                                  ... Success
 disk4 (swapped bytes)                                        ... Success
   Score 2.00 / 2.00
  Status Success

$ git add Makefile                    # Add Makefile to staging area
$ git add program.c                   # Add program.c to staging area
$ git commit -m "Reading 12: Code"    # Commit work

$ git push -u origin reading12        # Push branch to GitHub

Pull Request

Once you have committed your work and pushed it to GitHub, remember to create a pull request and assign it to the appropriate teaching assistant from the Reading 12 TA List.