Lecture 7 - Secondary Storage Flashcards

1
Q

<p>What is Secondary Storage?</p>

A

It is a non-volatile repository for (both user and system) data and programs

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

<p>Who manages Secondary Storage?</p>

A

File System –part of the OS

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

<p>What kind of data can be stored in Secondary Storage?</p>

A

Programs (source, object), temporary storage, virtual memory

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

<p>What are the main requirements on file systems?</p>

A
  • Should provide persistent storage
  • Handle very large information (large chunks, large numbers)
  • Concurrent access
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

<p>What are main user requirements of file system?</p>

A
  • How the storage appears to them

* File naming and protection, operations allowed on files

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

<p>What is a file?</p>

A

A file is a named collection of related information, usually as a sequence of bytes, with two views.

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

<p>What are the two views of a file?</p>

A

Logical (programmer’s ) view, as the users see it.

Physical (operating system) view, as it actually resides on secondary storage.

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

<p>What is the difference between a file and a data structure in memory?</p>

A
  • files are intended to be non-volatile; hence in principle, they are long lasting
  • files are intended to be moved around (i.e., copied from one place to another), accessed by different programs and users
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

<p>What are file attributes? Give a few examples</p>

A

Each file is associated with a collection of information, known as attributes:

  • NAME, owner, creator* type (e.g., source, data, binary)
  • location (e.g., I-node or disk address)
  • organization (e.g., sequential, indexed, random)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

<p>What are file names?</p>

A

Files provide a way to store and retrieve data from backing storage using file names

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

<p>What's the difference between UNIX and Windows file name extensions?</p>

A
  • In UNIX, files extensions are just conventions and not enforced by OS
  • MS-Windows associates programs with files using file extensions.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

<p>How does UNIX system know what a file's type is?</p>

A

By checking the file’s fingerprint against a hash table, eg: first few lines.

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

<p>What is a directory?</p>

A

Is a symbol tablethat can be searched for information about the files. Implemented as a file.
* Directories give a name space for the objects (files) to be placed.

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

<p>What is a directory entry?</p>

A

Directory entry contains information (attributes) about a file.

Entries are added in a directory as files are created, and are removed when files are deleted.

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

<p>Name 3 common directory structures and briefly explain each.</p>

A

Single-level (flat):shared by all users –worlds’ first supercomputer CDC 6600 also had

Two-level: one level for each user –should have some form of “user” login to identify the user and locate the user’s files.

Tree: arbitrary (sub)-tree for each user –login required.

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

<p>What structure do UNIX directories use?</p>

A

UNIX uses directed acyclic-graph (DAG) structure for directory

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

<p>What are the 5 basic services of a file system?</p>

A
  1. keeping track of files (knowing location),
  2. I/O support, especially the transmission mechanism to and from main memory,
  3. management of secondary storage,
  4. sharing of I/O devices,
  5. providing protection mechanisms for information held on the system.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

<p>What are the 4 levels of File system abstraction? Name their Objects and Typical Operations</p>

A
  1. Interactive (Shells)
    + files
    - copy, delete, rename
  2. Applications and system programs
    + logical elements (records)
    - open/close, buffering seek (logical)
  3. File system
    file system check soft repair partitioning
  4. Devices
    + physical elements (head, cylinder, …)
    - raw read/write,seek (physical)low-level format
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

<p>What are the 5 components of a Unix filesystem's disk partitions?</p>

A
  1. Boot Block
  2. Super Block
  3. Free space management
  4. I-nodes
  5. Files and directories
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is the disk partition represented as?

A

Array of blocks

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

What is the main issue with File Sharing?

A

File sharing raises the issue of protection

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

Name one approach to protect file systems.

A

One approach is to provide controlled accessto files through a set of operations such as read, write, delete, list, and append.

One popular protection mechanism is a condensed version of access list containing: user, group, and other

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

What are the 7 common file operations? Briefly explain each.

A
  1. Create
    * file is created with no data
    * sets some file attributes
  2. Delete
    * file is no longer needed
    * storage released to free pool
  3. Open
    * process first opens a file –fetch the attributes and list of disk addresses into main memory
  4. Close
    * frees the internal table space
    * OSs enforce by limiting number of open files
  5. Read
    * comes from current position in file
    * bytes to read and where to put specified
  6. Seek
    * repositions the file pointer for random access
    * after seeking data can be read or written
  7. Write
    * data written to file at current position
    * If current position is at end-of-file, file’s size increases
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What are the three file access methods?

A

Sequential: in order, one record after another. Convenient with sequential access devices (e.g., magnetic tape).

Direct (random): in any order, skipping the previous records.

Indexed: in any order, but accessed using particular key(s); e.g., hash table or dictionary. Database access (e.g., patient database in a hospital).

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

What is the file allocation problem?

A

File allocation impacts spaceand time

  • Space usage on disk (wastage due to fragmentation)
  • Access speed (latency of access)
26
Q

What are three common file allocation techniques?

A

Contiguous
Chained (linked)
Indexed

27
Q

Why does an increase in block size increase data rate, but reduce disk utilisation?

A

A larger block size means that more data can be accessed at once, but that even small files need at least one block, and a lot of space is wasted.

28
Q

What is the file system layout?

A

File systems are stored on disk partitions.
Sector 0 of the disk is called the MBR (master boot record)

  1. Read Master Boot Record.
  2. Read the Partition Table.
  3. Determine the Active Partition.
  4. Read and Execute the Boot Block.
29
Q

Define Contiguous Allocation. Name Advantages and Disadvantages.

A

Keep a free list of unused disk space. Allocate space in continous blocks

Advantages:

  • easy access, both sequential and random
  • simple
  • few seeks

Disadvantages:

  • external fragmentation
  • may not know the file size in advance
30
Q

What is internal fragmentation?

A

When a block is not completely used, the wasted bytes are “internal” fragmentation.

31
Q

Define Chained Allocation. Name Advantages and Disadvantages.

A

Linked-list implementation on blocks.

Advantages:

  • no external fragmentation
  • files can grow easily

Disadvantages:

  • lots of seeking
  • random access difficult
32
Q

How can a chained allocation be enhanced?

A

Enhancements:

* Can be enhanced with a in-memory table –called File allocation table (FAT)

33
Q

What is a File Allocation Table?

A

A table that stores all the block numbers corresponding to a given file in disk.

34
Q

Define Indexed Allocation. Name Advantages and Disadvantages.

A

Allocate an array of pointers during file creation. Fill the array as new disk blocks are assigned.

Advantages:

  • small internal fragmentation
  • easy sequential and random access

Disadvantages:

  • lots of seeks if the file is big
  • maximum file size is limited by the size of a block
35
Q

Which type of disk allocation does Unix use?

A

Indexed Allocation

36
Q

Why is free space management needed?

A

Disk space is fixed

  • Need to reuse space freed by deleted files
  • Need to keep track of free space as in main memory management
37
Q

Name 3 techniques used for free space management.

A
  1. Bit vectors
  2. Linked lists or chains
    * single list of a set of free block lists
  3. Indexing
    * single level, multiple levels
38
Q

How does bit vectors free space management work?

A

Use 1 bit per fixed size free area (e.g. block) on disk.

The bitmap is stored on disk at a well-known address (e.g. block 0). A ‘1’ bit indicates a free area while a ‘0’ indicates an allocated block.

39
Q

How does chained free space management work?

A

Chain/link pointers are stored in each disk block.

The pointer to the start of the free list is maintained at a well-known location (e.g., block 0). Note that the links are not necessarily ordered by starting block address.

40
Q

How does indexed free space management work?

A

Maintain index pointing to all free blocks.

The index of the free regions is maintained at a well-known location (e.g., block 0).The index would likely be ordered by size of free region to permit easy searching (i.e., it would be a non-unique index).

41
Q

How do we find free space of a specific size using bitmaps?

A

Search bitmap for a sequence of sufficient 1 bits

• Can use hardware instructions on some machines (e.g. find first one –FFO)

42
Q

How do we find free space of a specific size using indexes?

A

Store the number of available blocks in each index entry and order index by size
• e.g., Starting Block | Number of Free Blocks

43
Q

How do we find free space of a specific size using indexes?

A

• First Fit — find the first block on the chain big enough to accommodate the request
• Best Fit — find the region on the chain nearest in size but at least as large as the request
• Worst Fit — allocate from the largest region on the chain
• Next Fit — like first fit but continue searching on the chain from where you last left off
– Maintain chain in circular fashion
– Avoids constant allocation in localized region of memory

44
Q

Name four file system issues. (other than free space mgmt)

A
  1. Disk blocking
  2. Disk quotas
  3. Reliability
  4. Performance
45
Q

What is a Boot Block in Unix file system?

A

The boot block usually contains (bootstrap) code to boot the system.

46
Q

What is a Super Block in Unix file system?

A

The super block contains critical information about the layout of the file system, such as number of I-nodes and the number of disk blocks.

47
Q

What is an I-Node in Unix file system?

A

Each I-node entry contains the file attributes, except the name. The first I-node points to the block containing the root directory of the file system.

48
Q

How many I-nodes are associated to each file, and vice-versa.

A

1

49
Q

Name 3 different indirection to access a file.

A

File Descriptor Table: one per process, keeping track of open files.

Open File Table: one per system, keeping track of all the files currently open.

I-node Table: one per system (disk volume or partition) keeping track all files.

50
Q

What kind of allocation does i-nodes use?

A

Indexed allocation

51
Q

What’s the purpose of single, double, triple indirect blocks on i-nodes?

A

They point to other blocks that contain the address of the needed blocks. This allows us to have larger file sizes.

52
Q

What’s the maximum size of a file in an i-node with 12 blocks with size B using no indirects? single? double? triple?

A

12xB
+ (B/4)B
+ (B/4)^2
B
+ (B/4)^3*B

53
Q

What are the three components of disk access time?

A
  1. Seek time:
    Head movement from current position to desired cylinder.
  2. Rotational latency:
    Disk rotation until the desired sector arrives under the head.
  3. Data transfer time:
    Disk rotation until sector has passed under the head.
54
Q

What’s the purpose of out-of-order rotational disk reading?

A

Reducing average seek time and rotational latency by performing disk accesses out of order.

55
Q

What is the main idea behind Disk Caching?

A

Same idea as processor cache: bridge main-disk speed gap

Read/write an entire track with each disk access:
“Access one sector, get 100s free,” hit rate around 90%

56
Q

How do we make sure to not lose changes in disk cache when power shuts down?

A

Need back-up power so as not to lose changes in disk cache

57
Q

What are three placement options for disk cache? Compare their properties.

A
  1. In the disk controller:
    Suffers from bus and controller latencies even for a cache hit
  2. Closer to the CPU:
    Avoids latencies and allows for better utilization of space.
  3. Intermediate or multilevel solutions
58
Q

What’s the Disk Scheduling problem and the strategy idea?

A

Scheduling problem: maximize the throughput with concurrent I/O requests from

Strategy: minimize the time spent by disk seeking for data –maximizes the time spent reading/writing data

59
Q

What are 4 commonly used strategies for Disk Scheduling that are based on the requestor process? What are their properties?

A
  1. Random
    • select from pool randomly
    • worst performer
    • sometimes useful as a benchmark for analysis and simulation
  2. First Come First Served (FCFS) or FIFO
    • fairest of them all; no starvation; requests are honored in the order they are received
    • works well for few processes (principle of locality)
    • approaches to random as number of processes competing for the given disk increases
  3. Priority
    • access to the disk is not actually controlled by the disk management software
    • based on processes’ execution priority
    • designed to meet job throughput criteria and not to optimize the disk usage
  4. Last In First Out (LIFO)
    • service the most recently arriving request first
    • can be useful for processing sequential files
    • real danger of starvation; once a process falls behind it can be services only if the entire list ahead of it empties
60
Q

What are four algorithms for disk scheduling that use the requested disk address as input?

A

Shortest Service Time First (SSTF)
• select the item requiring the shortest seek time
• no guarantee of improved average seek time in any particular circumstance but
• in general better average seek time than FIFO
• random tie breaker used, if needed, to decide in which direction to move

SCAN—back and forth over disk
• heads move in only one direction until the last track is reached, then the direction is reversed
• if the direction of the heads’ travel is reversed once there are no more requests in that direction this method is called LOOK
• no danger of starvation, but
• biased against the most recently used area on the disk–Doesn’t exploit locality as well as SSTF though or as LIFO
• often similar to SSTF

C-SCAN—circular SCAN or one way SCAN and fast return
• scans in only one direction to the last track and then returns heads quickly to the beginning
• reduces the maximum delay for new arrivals

LOOK—look for a request before moving in that direction
• Heads move in only one direction until there are no more requests in that direction, then the direction is reversed.

C-LOOK—circular LOOK
• Scans in only one direction until there are no more requests in that direction and then returns heads quickly to the beginning

61
Q

Name the 4 elements of storage management, and the interactions between each layer.

A
Users:
-> access control, directory management
1. File structure
-> access methods, file manipulation
2. Records
 Buffering
3. Block Caches
 File allocation, Free space management
4. Controller Caches
 Disk scheduling
Disk