Ryan Schlimmer

CS 5631

Homework #4

#1 [2 pts] Linux has a "broad concept of files." Explain what this means. Give an example that illustrates Linux's broad concept of files.

Linux’s broad concept of files in the file system are setup such that they are anything that is capable of input or output of data. This means that even directories are truly implemented as files since they contain information about what other files and directories live within it.

#8 [1 pt] Give a labeled diagram of the UNIX inode. Carefully distinguish between index information and file contents. In more general terms, what is a UNIX inode?

In general terms the UNIX inode is similar in function to the implementation of BlockGroup in the beginning FileSystem projects. It contains a list of blocks that contain the data for the node, but is much quicker for direct access when compared to a link implementation.

File Information / Mode
Owners (2)
Timestamps (3)
Size block count
Index Information / Direct blocks / File Contents
Single indirect / File Contents
Double indirect / File Contents
Triple indirect / File Contents

#9 [2 pts] Given 512 byte disk data and index blocks, 32 bit disk (block) addresses, what is the maximum data size of a file (in bytes) that can be represented with a Unix inode that refers to 16 direct blocks, and a single indirect, single double indirect, and single triple indirect reference?

Maximum Data Size of a File (in bytes):

Single Indirect: 512 * 16 = 8192 = 8K

Double Indirect: 512 * (16 ^ 2) = 131072 = 128K

Triple Indirect: 512 * (16 ^ 3) = 2048K = 2M

#18 [3 pts] Given the list of track requests: 51, 10, 36, 48, 20, 0, 100, 15 (with 51 first), apply the FCFS, SSTF, and C-SCAN disk head scheduling algorithms to determine the total head movement for this list of requests. Also give a diagram showing the head movement. Assume the head starts at track 70. Don't include track wrap where this is relevant. Assume a current head direction of "up" (to higher numbered tracks) where this is relevant. Assume a processing direction of "up" where this is relevant. Assume a minimum track number of 0, and a maximum track number of 150.

FCFSTotal = 19+41+26+12+28+20+100+85 = 331

SSTFTotal = 19+3+12+16+5+5+10+100 = 170

C-SCANTotal = 30+100+10+5+5+16+12+3 = 181

No track wrap added in total? With track wrap in total add 100.

#20 [2 pts] The addition of any type of I/O device to an operating system will not alter the kernel of an operating system. E.g., only a device driver needs to be added to the system when any type of device is added to a system. True or False? Explain.

False, for this case was shown with the introduction of USB devices. Upon its introduction certain functionality had to be added to the kernel to provide the needed support for the new device drivers.

#21 [1 pt] What is the difference between polling and interrupt driven processing?

In interrupt driven processing a condition is continually being checked and typically uses more CPU time without accomplishing as much as it could running other processes. Interrupt driven processing deals with the process remaining in the waiting state and not being executed until the specific interrupt is thrown.

#31 [1 pt] In AFS (Andrew File System), explain how callbacks are used to implement server-initated cache consistency.

The AFS keeps track of all the cached files and the callbacks on those files. Whenever an open is attempted on a file if a cache already exist it uses it, otherwise it re-caches the file from the server. When a client closes the file after it has made modifications all callbacks on the cached file are revoked and the data is written back to the server. This ensures that all the clients that have a file open are aware of any changes that are made to its open files.

#37 [2 pts] How many heavy weight processes can have receive rights on a port in Mach? Explain why only this many processes can have receive rights on a port.

In the Mach operating system only 1 heavy weight process can have receiving rights on a port at a time. The reason this is done to avoid conflicts that can occur with messages being passed where the message needs to remain stored somewhere until all threads have received the message or in the case that message receiving is destructive. This would mean that the message would be destroyed for all others (where they’d never receive it) once any one of those threads got to receiving the message first.

#40 [1 pt] On Mach, when a process decreases its CPU usage, its CPU scheduling priority increases. In what common operating system application situation does this help? Explain your answer.

The situation where CPU priority increases with the decrease of CPU usage is beneficial for operating system applications that deal with devices. These types of applications usually don’t run often and therefore take up little CPU usage, but they rely more heavily on when they get executed (running as soon as possible when the device is ready).