File Systems Flashcards

1
Q

what is a file?

A

a variable length sequence of bytes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what attributes do files have? (7)

A
  • name
  • identifier
  • type
  • location
  • size
  • protection
  • creation/modification time, date and user id
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

name 6 file operations

A
  • creation/opening
  • reading
  • writing
  • repositioning
  • deletion
  • truncation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is an open file table? what are two types?

A
  • the open() system call will return a pointer to an entry in the open file table
  • this acts as an identifier for the open tile
  • used as a parameter to all subsequent file operation

system-wide file table:

  • all currently open files
  • a count of how many processes have the file open
  • contains copies of FCBs of all open files

per-process open file table:

  • files that a process currently has open
  • entries point to a systemwide entry
  • current file pointer values for the process
  • the access mode
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

remember that file locking is the same as database locking

A

shared locks and exclusive locks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is a file extension and what’s the point?

A

infers a file’s use. a file ending in .pdf should be opened in a reader

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

difference between sequential and direct access?

A

sequential - a linked list. have to read or write from the current position in the file and advance the pointer
direct access - an array. allows random access. supported by disks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what is partitioning?

A

splitting a device into multiple storage volumes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

describe the acyclic structure

A
  • there can be multiple names/paths for the same file or directory
  • space allocated to a file can be reclaimed only when the last reference is deleted, by maintaining a reference count. incremented when a reference is added
  • need to prevent cycles. in Linux symbolic linking to an already existing directory is forbidden
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is a file control block (FCB)?

A

fcb contains information for individual files. these are inodes in unix

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is a VFS?

A

a virtual file system allows unix to support the use of multiple different file systems

the same system call interface can be used for different types of file system

the os provides a single API and so an os can use different file systems for different disks or on the network

local files are distinguished from remote ones

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

describe contiguous allocation

A
  • files are on the disk contiguously
  • there is no additional head movement, no seeking
  • move one track when switching cylinders
  • can be direct access, access i starting from b saying b

problems:

  • allocating dynamic space
  • when files expand they may run up against other files, and have to be copied to larger spaces
  • external fragmentation issues
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

describe the read operation steps

A
  1. read is called at index i
  2. the process is found in the per-process open file table at i
  3. that entry points to the system wide file table
  4. the inode in the system wide table points to the data block
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

described linked allocation, pros and cons

A
  • files in the style of a linked list (not really a linked list)
  • can have variable file sizes
  • no fragmentation
    cons:
  • not resistant to data loss
  • only sequential access, direct access is impossible
  • head movement may be great, because the blocks aren’t contiguous
  • requires overhead for pointers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

describe a FAT

A

file allocation table
a variantion on linked allocation

  • section of the disk holds the FAT
  • – one entry per disk block
  • – indexed by block number
  • used like a linked list
  • directory contains block number of first block of file
  • like a linked list of list heads
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

describe indexed allocation

A
  • index blocks are allocated on file creation
  • contain a list of file locations
  • a hybrid, because we can sequentially access but also direct access by calculating the index
  • can have internal fragmentation because there is unused space in the index block
  • expansion is easy, we just find a free block and update the index block. if the index block is full we can extend it
  • can have multi-level indexes to expand maximum file size
17
Q

describe the unix inode system

A

inodes are stored in a ssytem inode table and addressed by their index

uses a combination of standard indexing and multi-level indexing

  • the first 15 pointers of index block stored in the file’s inode
  • first 12 of those point to direct blocks, small files that dont require multi-level
  • the other 3 are indirect
  • 1 single, 1 double, 1 triple

must by acyclic so no links to already existing directories

18
Q

what is a hard link?

A

more than one directory entry may exist for a single inode

this is known as linking or hard links

19
Q

what is a soft/symbolic link?

A

a file containing the path to the link target

a shortcut

20
Q

what can cause inconsistencies when writing? how to we combat this?

A

write back is delayed and cached for performance. if the system crashes there may be consistency problems.

use this algorithm:

  • create a table with one record per disk block
  • records have two count fields
  • – how many times the block is in a file
  • – how many times the block is in the free list
  • scan is made all inodes and the free list
  • the system is consistent if there is a 1 in exactly one of the fields for each block
  • – a block with two 0s is added to the free list
  • – a block with two 1s is removed from the free list
  • a block with a use count greater than one is copied
21
Q

what is journaling?

A
  • a log is created of what happened, stores meta-data
  • operations are atomic
  • transactions written to the log are committed when the system call returns
  • log entries are replayed across the actual file system structures
  • completed transactions are removed from the log
  • after a crash, the journal is replayed
  • undo changes made by partially executed transactions

overheads:
- write the meta-data twice