OS Exam 2

0.0(0)
Studied by 2 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/95

flashcard set

Earn XP

Description and Tags

Prof. Dude

96 Terms

1
New cards

Static relocation

Before hardware support, a loader would rewrite a program’s addresses to the desired offset as it loaded the program into memory.

No protection + difficult to move address space later

2
New cards

Base & Bounds/Limit registers

Also called dynamic relocation.

CPU uses a base and a bound register.

Base register is set to wherever the OS decides to place the program in memory

physical address = virtual address + base value

Bound register helps provide protection: memory reference must be within bounds

Assisted by MMU (memory mgmt unit) part of CPU

3
New cards

Swapping

Moving some memory pages to disk

4
New cards

Memory compaction

Rearrange unused memory into contiguous blocks

5
New cards

Pages

A fixed-size unit of virtual memory. Stored in page frames

6
New cards

Paging

Chopping virtual memory into fixed-size pieces

Provides flexibility and simplicity

7
New cards

Page table

per-process structure that stores address translations

8
New cards

Virtual address

the address the program sees (and is translated to the physical address by hardware)

9
New cards

address space

abstraction for physical memory that contains the state of a running program

10
New cards

MMU

part of CPU that helps with address translation

11
New cards

Page frames

Viewing physical memory as an array of fixed-size slots called ___ ______

12
New cards

Page table

Per-process data structure that stores virtual-to-physical address translations

13
New cards

Page table entry and its typical pieces

  • Valid bit - unused space marked invalid

  • Protection bits (Read/Write/Execute)

  • Present bit- indicates if in physical memory or disk

  • Dirty bit- flags if modified

  • Referenced/Accessed bit- track if been accessed


14
New cards

How virtual addresses are converted to physical addresses

Virtual address is comprised of virtual page number + offset.

Virtual page number is used to index page table and find the physical frame number, and then the offset is applied to that.

15
New cards

Translation Lookaside Buffer

Part of the MMU; it’s a hardware cache of popular virtual-to-physical translations.

Fast because doesn’t use the page table.

16
New cards

Page faults

Attempting to access a page that’s not loaded into physical memory (present bit would be 0)

17
New cards

Page fault handler

Process is blocked, page fault handler locates page on disk, OS updates page table w/ correct number, TLB is updated, and desired data can be retrieved

18
New cards

Linear page table

Just an array

19
New cards

Multilevel page table

Tree-like structure- top level is page directory

Requires more loads during a TLB miss + extra complexity

20
New cards

inverted page tables

One system-wide page table with an entry for every physical page frame.

Used by most 64-bit OSs

21
New cards

Optimal

Ideal replacement policy- fewest misses overall. Requires future knowledge by removing the page that will be accessed furthest in the future

22
New cards

FIFO

First In, First Out. Removes the page on the tail of the queue. Simple to implement.

23
New cards

Clock

Approximates least-recently-used (but not as expensive). Kicks out page that hasn’t been used in a certain amount of time.

24
New cards

LRU

Removes least-recently-used.

25
New cards

LFU

Kicks out least frequently used page

26
New cards

Belady’s Anomaly

Situation where adding page frames doesn’t actually decrease the number of faults (may increase them).

27
New cards

Working Set

Pages currently in use

28
New cards

Thrashing

Memory demand exceeds available physical memory = constantly paging.

29
New cards

demand paging

loading pages into memory only when accessed

30
New cards

Spatial locality

For addresses close together, only the first access of the page results in a TLB miss.

31
New cards

temporal locality

quick re-referencing of memory in time

32
New cards

How many bits to represent the offset for a 4KB page

12; (because 2^12)

33
New cards

Canonical device

Has an interface (interacts with the computer) and an internal structure

34
New cards

Device controllers

Like a tiny computer; often has hundreds of thousands of lines of firmware

35
New cards

Interrupts

Improves I/O efficiency; instead of pulling, put calling process to sleep; then context switch. Wait until hardware interrupt to finish the request and wake waiting process.

36
New cards

Programmed I/O

CPU involved in data movement

37
New cards

Interrupt-driven I/O

Less taxing on CPU, uses interrupts instead of polling

38
New cards

Precise interrupt

Leaves machine in a well-defined state

39
New cards

Imprecise interrupt

Does not leave machine in a well-defined state- slow recovery

40
New cards

DMA I/O

Uses a Direct Memory Access device that can orchestrate transfers between devices and main memory without much CPU intervention; slower than CPU

41
New cards

Memory-mapped I/O

Hardware makes device registers available as if they were memory locations. OS routes to the device.

42
New cards

Device driver

Tells OS how the device works. Most of an OS kernel is device driver code.

43
New cards

Device driver role

^

<p>^</p>
44
New cards

I/O Software Layers


<p></p>
45
New cards

Interrupt handlers

When I/O request finished, CPU jumps into the OS at a predetermined interrput handler/interrupt service routine

46
New cards

Platter

Circular hard surface of an HDD on which data is stored (on 2 surfaces)

47
New cards

Track

One of many concentric circles on a platter.

48
New cards

Sector

512-byte block of data

49
New cards

Head

Reads/changes magentic patterns on the disk

50
New cards

Arm

Moves across disk to position the head over the desired track

51
New cards

Logical block addressing

Each block is numbered 0 to n-1 on an n-sector drive

52
New cards

RAID 0

Striping (no redundancy)

53
New cards

RAID 1

Mirroring

54
New cards

RAID 4

Saving space with parity (single disk with parity data)

55
New cards

RAID 5

Rotating Parity

56
New cards

RAID 6

Double rotating parity (can lose any 2 disks)

57
New cards

Disk formatting

Before a disk can be used, must receive a low-level format.

Creates disk partition


Then high-level format creates boot block, root dir, and empty files system

58
New cards

FCFS

First come first served disk scheduling

59
New cards

SSF

Shortest seek time first; picks nearest track first. Can lead to starvation

60
New cards

Elevator

Also called SCAN; Arm moves back and forth and services requests as it goes

61
New cards

C-SCAN

Elevator/scan but only in one direction to not favor the middle tracks

62
New cards

Error handing – bad sectors

Try rereading. If repeatedly fail, controller can either:

  1. Remap bad sector to a spare

  2. Shift all sectors (keep contiguous)


63
New cards

Three essential requirements of long-term information storage

  1. Must store a large amount of information

  2. Info must survive the termination of the process using it.

  3. Multiple processes must be able to access the info at once.


64
New cards

File

An abstraction for an array of bytes. Has a low-level name, usually an inode number

65
New cards

file naming

File has a name as well as an inode number

66
New cards

file structure

OS doesn’t care about structure of any particular file.

However, the overall file system structure is maintained through directories.

67
New cards

file extension/type

a convention that indicates how the file is used

68
New cards

file access

Processes receive a file descriptor (points to an entry in the open file table)

69
New cards

attributes

Metadata (stored in inodes)

70
New cards

Root directory

The very base of the file system / start of file hierarchy. / on Unix.

71
New cards

Absolute path name

full file path starting at root directory /

72
New cards

relative path name

In reference to the working directory

73
New cards

working/current directory

.

74
New cards

Master Boot Record

Sector 0 of a disk. Contains boot code and partition table

75
New cards

boot block

First sector of a partition

76
New cards

Superblock

First block of the filesystem. Contains key info about said filesystem, number of inodes and data blocks, start of inode table, etc.

77
New cards

Contiguous allocation

Blocks

78
New cards

linked-list allocation

First word in each block points to the next block

79
New cards

linked-list with in-memory table (FAT),

Entire file block usable for data; all file link info is in memory; easy random access

80
New cards

Inodes

Short for index node; points to location of the file on disk; also stores file metadata.

81
New cards

Directory implementation

A directory is just a file.
Contains list of name-inode number pairs as well as “.” (itself) and “..” (the parent directory)

82
New cards

Soft link

Actually a file itself; holds pathname of linked-to file. (can become a dangling reference)

83
New cards

Hard link

Creates another way to refer to a file (not copied, just a reference)

84
New cards

Journaling file systems

Logging intended actions before doing them; can be used to correct actions that weren’t completed due to crash.

85
New cards

Virtual File Systems (VFS)

Abstracts application programmer interactions away from the specifics of any file system.

86
New cards

Management of Disk-Space

Allocation structures needed to track free and allocated blocks

Free lists or bitmaps can be used to manage the blocks

87
New cards

Block size

Usually 512 or a multiple of it

88
New cards

Free blocks

Unused block, usually listed somewhere

89
New cards

Backups

Handle 2 potential problems:

  1. Recover from disaster

  2. Recover from stupidity


90
New cards

Consistency

File system data must persist beyond power loss or system crash; must not be left in an inconsistent state.

Old systems used a file system checker (verify correct info). Newer ones use journaling.

91
New cards

2 Types of backups

  1. Physical dumps- raw data copy, easier

  2. Logical dumps- copy of structure, slower


92
New cards

MS-DOS

Fixed-size 32 byte directory entries

64K entry FAT

Time only accurate ±2 secs

93
New cards

UNIX file system

14-char filenames, 64K file limit

Single, double, triple indirect blocks for addressing

94
New cards

CD-ROM file system

  • One contiguous spiral of data

  • sectors of 2352 bytes- payload 2048

  • Position in minutes and seconds (1 sec = 75 blocks)

  • Variable-number of variable-length directory entries


95
New cards

Fragmented

Files stored non-contiguously = slower access

96
New cards

Headcrash

747 with 100000 people @ 60mph 1/100 of an inch