# CS372H Spring 2012 Homework 6

## Problem 1:

The MegaGiga hard disk rotates at 5400 rpm with an arm seek time given by = 4 + 0.05t msec, where t is the number of tracks the arm seeks. Assume a block size of 512 bytes, and 1024 tracks with 512 sector/track. The disk controller and DMA read or write data from/to disk at a rate of 4MB/sec.
1. What is the storage capacity of the disk?
2. Assume that we are reading a 16K-bytes file where the sectors happen to be allocated contiguously on the same track. Compute the maximum and minimum disk throughput that is possible while reading the file?

## Problem 2:

You are designing a file system from scratch. The disk driver allows you complete control over the placement of data on the disk. Assuming that you have settled for a File Allocation Table (FAT) architecture, where would be the best place to store the table on disk?

## Problem 3:

The FAT file system uses 16-bit numbers to represent the cluster number that starts the linked list of the clusters that are implementing a file. Explain the implications of limiting the cluster numbers to 16 bits. Modify the FAT file system to use 32-bit numbers to represent the clusters and show how the limitations of FAT can be lifted.

## Problem 4:

Contiguous allocation of files leads to disk fragmentation. Is this internal or external fragmentation?

## Problem 5 (review multi-threads programming)

We have 3 teams: red, green, and blue. A team member calls Game::myTurn(int color) when she or he wants to do something and calls Game::doneTurn() when she or he is done. At most one team may be doing something at a time. Each team gets a turn in the order red, green, blue, red, green, blue, and so on. If a team is not ready when the previous team is done with its turn, the team is skipped and the next ready team gets a chance. If no team is ready, the first team to request a turn gets the next turn. Note that many team members of the same color may want to take a turn; model each as an independent thread. Write the Game class using condition variables and locks. Follow the coding standards we have been using.

List Game's synchronization and state variable here:
Game::Game() // constructor
{

}

Game::myTurn(int color)
{

}

Game::doneTurn()
{

}