CS 111 Fall 2014 : Lecture 10: File System

by Yoo Jung Choi, Dong Joon Kim, Han Sung Lee, and Seung Won Yoon

Table of Contents

  1. File System Needs
  2. File System Examples
  3. Hardware Components For File System
  4. File System Performance Metrics
  5. Performance Metrics Examples

File System Needs

File System has three needs:
  1. Organization - The system needs to organize the disk space in order to access memory easily.
  2. Performance - The system needs to be able to access memory efficiently and fast.
  3. Reliability - The system needs all the data accesses to be reliable. You do not want loss of data.
Note: There will be trade-offs. The system designer may need to select one from three needs.

File System Examples


General Parallel File System

Six design ideas for GPFS.

  1. Striping - Split single file data among different CPU/drive in stripes. Slow because reading a file requires talking to different CPUs.

  2. Distributed metadata - Catalog itself is distributed. Having a central catalog that maps files to locations creates a bottleneck, if all start talking to that catalog.
  3. Efficient directory indexing - If directory contains too many files, it is impractical to store entire directory in cache, and thus file access becomes slow. Use a tree structure for efficient indexing. (i.e. 2-3 tree)
  4. Distributed locking - Locking system to synchronize multiple shared resources. It is very hard to implement.
  5. Partition awareness - The system needs to function even when there is network partition due to problem in the network. Majority part of the partition gets both read and write access, while the minority part gets read-only access.
  6. File System staying live during maintenance - Do not want system to go down during routine maintenance.

Hardware Components For File System

Traditional hierarchy of hardware components: Note: As you move down this hierarchy, cost per unit goes down but efficiency of access goes up.

File System Performance Metrics

Performance metrics: Note: Throughput and latency are competing objectives. Need to choose one over the other when designing a file system.

Procedure of read access for a disk drive:
  1. Send command to controller.
  2. Accelerate disk heads.
  3. Decelerate disk heads.
  4. Wait until rotation occurs.
  5. Get data into disk controller cache.
  6. Copy into RAM or CPU.
Note: When reading data, most of the delays come from #2 - 4 (Physical Delays). Seek time refers to the delay moving the disk head (#2-3). Rotational Latency refers to #4.

Performance Metrics Examples

Example system:

Basic busy wait approach


	    for(;;) { 
	    char buf[40];
	    read 40 bytes from device to buf;
	    compute(buf);
	    }
			

Batching

Grab larger blocks of data. (attack on device latency)

	    for(;;) { 
	    char buf[840];
	    read 840 bytes from device to buf;
	    compute(buf);
	    }
				

Multitasking

Let some other process to run instead of busy waiting.

	    for(;;) { 
	    char buf[40];
	    send command to controller;
	    do {
	    	block this process until interrupt;
	    	handle interrupt;
	    }while(!ready);
	    read 40 bytes from device to buf;
	    compute(buf);
	    }
				

Batching + Multitasking


	    for(;;) { 
	    char buf[840];
	    send command to controller;
	    do {
	    	block this process until interrupt;
	    	handle interrupt;
	    }while(!ready);
	    read 840 bytes from device to buf;
	    compute(buf);
	    }
				

DMA (Direct Memory Access)

Instead of CPU doing the work of moving data, Disk controller gets a signal to directly put the data into CPU's RAM. Thus, 40 microseconds to read data can be treated as 0.

	    for(;;) { 
	    char buf[40];
	    send command to controller;
	    do {
	    	block this process until interrupt;
	    	handle interrupt;
	    }while(!ready);
	    read 40 bytes from device to buf;
	    compute(buf);
	    }
				

DMA + Polling

Polling instead of blocking in order to get rid of 5 microseconds for handling interrupts

	    for(;;) { 
	    char buf[40];
	    send command to controller;
	    while(DMA slots busy)
	    	yield();
	    read 40 bytes from device to buf;
	    compute(buf);
	    }
				
Note: Even though DMA with polling showed significant improvement in performance metrics, this method is not practical for generalized machines. Polling, which is usually slow, was a win for this example problem because the workflow was nicely synchronized.