File Manager Flashcards

1
Q

What is the file manager?

A

Keeps track of every file in the system, providing an abstracted view of files to the user and maps this onto a disk.

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

File Manager Tasks

A

These include:
- organise files into folders
- map file locations
- map logical structures onto physical locations
- enforces restrictions to files
- deal with open, close, read, write and delete operations.
- provides syscalls.
- liaises with device manager to access physical disks within system.

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

Disk Blocks

A

Essentially, each disk is split up into blocks of a certain size in which the OS chooses. Files fill up more than one block normally, but there is only one file per block, so space is wasted if a block if not full.

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

Disk Format

A

Each partition of a physical disk will be formatted with a particular disk format, splitting these blocks into equal sizes.

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

File Allocation Methods

A

The disk format and block usage are both decided by the file allocation method. There are many ways to allocate files to blocks on disks, three being contiguous, linked and indexed.
This also is used for deciding how blocks in a file are accessed.

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

Freelist

A

States whether a block is free or not using 1 and 0 (respectively, in use and free). This is stored on a part of a disk which is reserved for such data.

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

Metadata

A

Used to store information about a file. This is stored on a part of a disk which is reserved for such data.

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

File System Parts

A

Physical Storage On Disk -> FAT, XFS and EXT4.
Logical Naming Scheme -> File/Directory Names.
Permission Model -> Access control such as permissions used by linux.
Syscalls -> System calls, standardised programmatic access to files via kernel.

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

System calls in the file system

A

fopen
fclose
fread
fwrite
fseek
fflush
Any program using these system calls can manipulate data in these files.
User programs can see the logical view of the file system via syscalls.

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

Logical View

A
  • Filenames with extensions, like .txt
  • folder hierarchies
  • shell with drag and drop and copy/paste in terms of files
    For example, file explorer for windows can be considered a logical view of the file management system.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Physical View

A
  • directories and files are just bit patterns stored in blocks of the disk
  • OS needs to know which block belongs to which file
  • contains metadata and freelist
  • arrangement and usage of blocks depends on file allocation method
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Inodes and Disk Format with Inodes

A

Something we use to map logical to physical. Inodes point to physical blocks on disk, with each file having an inode which stores metadata on it. This builds up an inode table, which is then stored on disk in the free allocated space. The parts of the disk then include:
Housekeeping data (contains metadata about the file system)
Freelist
Inode table
Data blocks

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

Housekeeping Data

A

This is data that is used for administrative or management purposes, rather than for direct use by end-users or applications. Essentially, metadata about the file system.

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

Sequential File Access

A

Start with first block and read each block in order until correct one with wanted data is found.

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

Direct File Access

A

Goes directly to the block that contains required data, skipping over other blocks in the meantime.

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

Contiguous Allocation

A

Each file is allocated across contiguous blocks on disk (aka all the blocks are together, and each file is side by side)
This inode stores the start block number, and the number of blocks, making it fast for both sequential and direct access.
However, we have fragmentation of free blocks. This is because once one is deleted, we can’t really use up that space again since we put the next file next to the last file added, which then requires frequent defragmentation. Also, we cannot alter the file sizes to grow, since they are side by side and there are no free blocks aside of them until a file next to them is deleted.

17
Q

Linked Allocation

A

The files are more spaced out, but the head of each block of a file is kept, with the head of one file pointing to the next file’s head.
This makes it easy to grow and shrink files with no defragmentation, but blocks are widely dispersed, making HDDs read/write head move around a lot. As well as this, sequential access and direct access are affected negatively, since they now have to go to the head block, read it, and then figure out when the next block is (remember, these files are no longer in order, and can be stored anywhere so long as there is space. So it is a lot of jumping around). We also have the danger of pointer corruption.

18
Q

Indexed Allocation

A

The first block is reserved to hold the index of all other blocks.
This is very efficient since we have every file’s block information being held in one place, and is very fast for both sequential and direct access.
However, blocks can still be widely dispersed, as well as wasting this one block for small information. We can also, on the other hand, have too much information in this one block, requiring two index blocks, or three etc. The index block(s) could also get corrupted.

19
Q

File Allocation Table and Disk Format

A

An alternative to inodes which splits physical disk into distinct sections and uses indexed allocations, but the index blocks are stored in one place. This contains:
Boot Sector -> housekeeping data
FAT -> master copy of index blocks for each file
FAT (copy) -> backup copy of the FAT
Data Region -> contains blocks that store data.

The advantage to this method is that all the pointers are held together and easier to protect, and no need for a separate freelist, with direct access being much more efficient. However, it requires the HDD head to move constantly between FAT area and file area, and FAT will become large for huge disks.

20
Q

New Technology File System

A

Another alternative to inodes. This is the defaut disk format for new windows installations, which uses a master file table. Apart from that, the general principle is the same as FAT.

This type of disk format provides useful features such as:
- encryption
- journaling
- file compression
- hard links
- shadow copies
- system compression

21
Q

Popular File Systems

A

Below are some popular file systems used:
Windows -> FAT32 and NTFS
MacOS -> APFS
Linux -> EXT4