1/107
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
What does IVT stand for?
Interrupt Vector Table
What is the motivation of IVT?
Create global functions that can be called from any segment
Where is IVT located in memory?
0×0000:0×0000 to 0×0000:0×03FF (first 1024 bytes of memory)
How many IVT entries are there?
256 entries (0×00 to 0xFF)
How many bytes per IVT entry?
4 bytes per entry
What does each 4-byte IVT entry contain?
Bytes 0-1: Offset (IP - instruction pointer)
Bytes 2-3: Segment (CS - code segment)
Formula to calculate IVT entry address for interrupt N?
Address = interrupt number x 4
is IVT used in modern protected mode systems?
No, only used in 16-bit real mode
What replaced IVT in protected mode?
IDT (Interrupt Descriptor Table)
Is IVT still used anywhere today?
Yes, during boot process in real mode before switching to protected mode
Why is CLI necessary before modifying IVT?
Disables interrupts
Why is SIT necessary after modifying IVT?
Re-enables interrupts
What are the critical steps to register an IVT handler?
CLI (disable interrupts)
Set ES to 0×0000
Write offset to IVT entry
Write segment to IVT entry
STI (enable interrupts)
What instruction must end an interrupt handler?
IRET
Why can’t you use RET in an interrupt handler
RET only pops IP (and CS for far return)
IRET pops IP, CS, and FLAGS
What does IRET restore that RET doesn’t
FLAGS register
What are the 3 values IRET pops from stack?
IP
CS
FLAGS
What is the major secutiry flaw of real-mode IVT
No protection, any program can override any interrupt
How does protected mode (IDT) fix IVT security problem
IDT uses Ring levels (0-3). Only Ring 0 (kernel) can modify IDT. User programs (Ring 3) can’t access or modify interrupt handlers
What are Ring levels in protected mode?
Ring 0 = Kernel (highest privilege)
Ring 1-2 = Device drivers
Ring 3 = User applications (lowest privilege)
Which Ring level can modify the IDT
Ring 0 (kernel mode) only
What is First-Fit allocation
Scan from beginning, allocate first hole large enough.
Fast but creates small holes at start of memory
What is Best-Fit allocation
Scan entire list, choose smallest hole that fits.
Minimizes wasted space but creates tiny unusable holes
What is Worst-Fit allocation
Choose largest available hole.
Leftover hole more likely usable but wastes large holes
External Fragmentation
Allocated block larger than needed, waste inside allocation
Ex: Need 1000 bytes, allocate 1024-byte block, 24 bytes wasted inside
Can FAT12 have external fragementation?
No, FAT12 uses chained allocation (not contiguous)
Files can be scattered across non-contiguous clusters
What is the identical concept: Sector (disk) vs ? (memory)
Page
Why does FAT use chained allocation instead of indexed
Index section must be contiguous - same fragmentation problem as data
Space constraints in FAT12
Why does memory use indexed (page tables) instead of chained
Time issue, memory needs fast random access
What are 2 problems of page allocation?
Internal fragmentation
Grouped data (arrays) get scattered
Whats the advantage of segment over page
Only 2 numbers to describe: START address + LIMIT (size)
Segment is contiguous which is better for grouped data structures
Search Complexity: Linear search in page table
O(n)
Search Complexity: Binary search in page table
O(log n) but requires O(n log n) sort first
Search Complexity: Hash table in page table
O(1)
Which search method is typically used for page tables
Hash Table (O(1) lookup)
Can FAT12 have 525 files in root directory? Why?
No, root directory fixed at 224 entries maximum
Can FAT12 have 525 files total? Why?
Yes, by using subdirectories which have unlimited space
Can FAT12 have 525 subdirectories? Why?
Yes, subdirectories unlimited
How does FAT12 handle more than 224 files?
By using subdirectories
Is FAT12 purely chained allocation?
No, chained + indexed
Does FAT use best-fit allocation
No, uses chained allocation
Does FAT12 suffer from external fragmentation
No, doesn’t use contiguous allocation.
Files can be scattered
Was FAT created by Microsoft
No, purchased
Why are there 2 copies of FAT
Reliability
How many bits per FAT12 entry
12 bits
What’s the first valid FAT entry number
Entry 2 (entries 0 and 1 are reserved)
Can FAT entry values be negative
No, all FAT values are unsigned
What does FAT entry value 0×000 mean
Free cluster
What does FAT entry value 0xFFF mean
End of file marker
What’s the most influential OS overall
Unix
What OS is most influential for education
Minix
Is iOS Linux based
No (based on BSD/Darwin)
Is Android Linux based
Yes
3 main OS objectives
Convenience
Efficiency
Ability to Evolve
Standard 1.44 MB floppy: Total sectors?
2880 sectors
Standard 1.44 MB floppy: Boot sector count?
1 sector
Standard 1.44 MB floppy: FAT sectors total
18 sectors (9 per FAT x 2 copies)
Standard 1.44 MB floppy: Root directory sectors
14 sectors
Standard 1.44 MB floppy: First data sector
33 (1 boot + 18 FAT + 14 root)
Standard 1.44 MB floppy: First valid cluster number
2 (clusters 0 and 1 reserved)
Boot sector bytes 11-12 contain what
Bytes per sector
Boot sector byte 13 contains what
Sectors per cluster
Boot sector bytes 14-15 contain what
Reserved sectors
Boot sector byte 16 contains what
Number of FAT copies
Boot sector bytes 17-18 contain what
Root directory entries
Boot sector bytes 19-20 contain what
Total sectors
Boot sector byte 21 contains what
Media descriptor
Boot sector bytes 22-23 contain what
Sectors per FAT
Formula to calculate byte offset for FAT entry N
byte offset = entry x 1.5
Formula to find which FAT sector contains entry N
FAT sector = byte offset / 512 (round up)
Formula to find position within FAT sector
position = byte offset mod 512
Formula to calculate row number in hex dump
row = position / 16
Formula to calculate column number in hex dump
col = position mod 16
Formula to convert cluster number to logical sector
logical sector = cluster + 31
Formula to calculate how many sectors a file occupies
sectors = file size / 512 (round up)
Formula to claculate first root directory logical sector
first root = 1 + (2 × sectors per FAT)
For standard floppy: 1 + (2 × 9) = 19
Formula to calculate first data sector (cluster 2)
First data = 1 + (2 x sectors per FAT) + root sectors
For standard floppy: 1 + 18 + 14 = 33
Formula to calculate root directory sectors needed
root sectors = (entries x 32) / 512
For 224 entries: (224 × 32) / 512 = 14
Formula to calculate IVT entry address for interrupt N
address = interrupt number x $
Result format: 0×0000:0×00XX
IVT total size formula
IVT size = 256 entries x 4 bytes = 1024 bytes = 1 KB
Formula to convert manufacturer GB to Windows GB
Windows GB = (Advertised x 1000³) / 1024³
Formula to convert Windows GB to manufacturer GB
Advertised GB = (Windows x 1024³) / 1000³
Formula for external fragmentation calculation
external fragmentation = sum of all remaining holes
Ex: [20,150,30,400] = 20+150+30+400 = 600 KB
What does VFAT stand for
Virtual FAT (extension for long filenames)
Maximum filename length in VFAT
255 characters
How to identify VFAT entry in hexdump
Byte 11 = 0×0F
In what order does VFAT store long filename parts
Reverse order (last part first, then middle, then start)
How many characters per VFAT pseudo-entry
13 Unicode characters per entry
Can DOS read VFAT long filenames
No, only sees 8.3 shortname
If filename is “My Document.docx” (16 chars), how many VFAT entries needed
[16 / 13] = 2 VFAT entries
What comes after VFAT pseudo-entries
Actual 8.3 directory entry with file data (cluster, size, date, time)
Why does VFAT maintain 8.3 shortname
Backward compatibility with DOS/older systems
What’s stored in VFAT pseudo-entry checksum
Checksum of 8.3 shortname to verify entries belong together
How many bits per FAT16 entry
16 bits (2 bytes)
How many bits per FAT32 entry
32 bits (4 bytes), but only 28 bits actually used
Maximum clusters in FAT12
4096 clusters (2^12)
Maximum clusters in FAT16
65536 clusters (2^16)