CS153 - Quiz 1

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

1/28

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 2:55 AM on 10/10/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

29 Terms

1
New cards

Why do we need an OS?

Portability and resource sharing

2
New cards

What are the 3 main functions of an OS?

Abstraction, Virtualization, Access Control

3
New cards

What is the Sleeping Beauty Model?

User code runs directly on CPU with limited privileges. OS sleeps until events wake it up.

4
New cards

Which ring does user code run in? Kernel?

User: Ring 3, Kernel: Ring 0

5
New cards

What are privileged operations? (3 examples)

Direct I/O access, manipulating page tables/TLB, manipulating protected control registers

6
New cards

How does CPU prevent user apps from doing privileged operations?

User apps run in Ring 3. Attempting privileged ops raises a fault that traps to kernel.

7
New cards

What are the 3 types of events that wake up the OS?

Faults, System Calls, Interrupts

8
New cards

Is a fault synchronous or asynchronous? Give 2 examples.

Synchronous. Examples: page fault, divide-by-zero, NULL dereference

9
New cards

Is a system call synchronous or asynchronous? Give 2 examples.

Synchronous. Examples: open(), read(), write(), sleep()

10
New cards

Is an interrupt synchronous or asynchronous? Give 2 examples.

Asynchronous. Examples: timer, keystroke, network packet, I/O completion

11
New cards

What are the 7 steps of a system call?

1) Execute syscall instruction with number 2) Mode switch Ring 3→0 3) Save state 4) Lookup syscall table 5) Execute kernel function 6) Restore state 7) Return to Ring 3

12
New cards

How does user program specify which syscall to invoke?

Set register (%eax/%rax) with syscall number before issuing syscall instruction

13
New cards

How are kernel objects referenced in syscalls?

Integer handles/descriptors (e.g., file descriptors)

14
New cards

Can user programs call arbitrary kernel functions?

No. Only specific syscalls via syscall number that OS validates.

15
New cards

Why does OS need to handle timer interrupts?

To reclaim control for context switching and timesharing. Also for sleep().

16
New cards

What is a context switch?

Switching execution from one process to another by saving/restoring state

17
New cards

How does context switching happen?

Timer interrupts force switch from user program to OS scheduler

18
New cards

How to go from Ring 0 to Ring 3?

Directly modify mode register to drop privilege

19
New cards

How to go from Ring 3 to Ring 0?

Only via special instructions (syscall) or events (interrupts/faults)

20
New cards

What happens when protected instruction executes in Ring 3?

Hardware raises fault that traps to kernel

21
New cards

How are recoverable faults handled?

OS fixes condition and returns to faulting context. Example: load missing page for page fault

22
New cards

How are unrecoverable user faults handled?

Kill process: halt, dump state, destroy

23
New cards

What happens when kernel faults?

Fatal crash - panic/BSOD, dump core, lock up

24
New cards

How are interrupts used for I/O?

OS initiates I/O, device works independently, sends interrupt when done

25
New cards

What is the interrupt vector table?

Table of kernel routine addresses indexed by interrupt number

26
New cards

Why do interrupts cause synchronization problems?

Can occur anytime and handler can interfere with interrupted code

27
New cards

Two methods for atomic execution?

1) Disable interrupts 2) Atomic instructions (e.g., XCHG)

28
New cards

How does OS provide memory isolation?

Memory Management Unit (MMU) with virtual memory/segmentation (privileged ops)

29
New cards

Two ways to initiate I/O?

1) Special I/O instructions 2) Memory-mapped I/O