Operating Systems (Midterm) Flashcards
What are a computer’s two modes of operation?
- User mode (application)
- Kernel mode (OS kernel)
What are the transitions between user/kernel mode?
- Hardware interrupt: HW device requests OS services (asynchronous, event-triggered)
- System call (aka trap): User program requests OS services (synchronous, program-triggered)
- Exception: Error handling (Invalid memory access, invalid permission, etc.)
Describe a monolithic kernel
Monolithic kernel: A large process running entirely in a single address space (single binary file)
- All kernel services execute in kernel address space
What are the pros and cons of a monolithic kernel?
Pros:
- Fast
Cons:
- Huge kernel, harder to maintain
- No protection between kernel components
- Complex dependencies, not easily extensible
Describe a microkernel
Microkernel: Kernel broken down to separate processes (aka servers)
- Servers kept separate and run in different address spaces
- Communication is done via message passing (servers communicate through IPC)
What are the pros and cons of a microkernel?
Pros:
- Modular design, easily extensible
- Easy to maintain
- More reliable + secure
Cons:
- Performance loss
- Complicated process management
On a magnetic disk, read/write data is a 3-stage process. What are the three steps and which is the longest?
- Seek time: Position the arm over the proper track (longest time)
- Rotational latency: Wait for the desired sector to rotate under the read/write head
- Transfer time: Transfer a block of bits (sector) under the read/write head
How do you make information generated by HW device events available to running applications?
- Polling
- (HW) Interrupt
- DMA
Explain polling
Polling (busy waiting):
- I/O device puts information in a status register.
- OS periodically checks the status register
(SIMPLE, WASTES CPU CYCLES, LATENCY)
Explain HW interrupt
Interrupt:
- Whenever an I/O device needs attention form the processor, it interrupts the processor from what its currently doing
- Types on interrupts: I/O, Timer
(MORE RESPONSIVE, COMPLEX, BETTER PROCESSING EFFICIENCY)
Briefly explain DMA
Direct memory access, delegate I/O responsibility from CPU
What is a process?
An instance of a program running on a computer.
An abstraction that supports running programs.
What is the difference between a program and a process?
- Program is static code + data
- Process is a dynamic instantiation of code + data + files
- No 1:1 mapping
- A program can run invoke many processes (Running a program twice, or a program contains fork())
What does the fork() function do?
The Fork system call creates an exact copy of the calling process.
- After fork, caller is parent, newly creates process is child
- Returns new PID to parent, and 0 to child
- Same memory image, environment settings, and opened files
- Child program calls execve to change its memory image + run a new program
What makes output deterministic?
Deterministic: Output stays the same no matter no matter how many times it’s run