Midterm Exam Flashcards
What is an OS?
- SIts right on top of hardware
- User interface to computers hardware
What are three main differences between the OS and your program?
- Complex
- In the background
- It controls EVERYTHING: HW, your program, all the SW and HW devices connected to your computer, etc.
What is a kernel?
Commonly referred to as another name for the OS. It is an essential part of the OS that is always running. It is always in main memory, and is loaded when the computer is switched on and stays running until shut down.
What is a CPU?
- Core of computer
- Runs all instructions
- Very fast (Usually multiple GHz: GHz = 10^9 instructions per second)
What is the bottleneck of a typical computer system?
Bottleneck: The slowest part of a system, a process runs only as fast as the bottleneck will allow.
Answer: Main memory, not nearly as fast as the other components in the system.
What are the four main responsibilities of the OS?
1) Process Management: How the CPU executes your code
2) Memory Management: Mapping from logical to physical addresses; how your code is stored in MM.
3) File Systems: How your files are stored on hard disk.
4) Storage Management: Disk scheduling policies
Describe the storage hierarchy. Include the effect of speed, cost, and space.
Registers Caches MM Disk Cloud
As you move up:
Cost increases, speed increases.
As you move down:
Space increases
List the following items from highest speed to lowest speed:
CPU, MM, Registers, Hard Disk, Cloud
CPU ? Registers ? MM ? Hard Disk > Cloud
Match the level of speed between the following items:
- CPU
- Disk
- User
a. Milliseconds
b. Seconds
c. Nanoseconds
1c, 2a, 3b
What is caching?
Part of the OS that decides what data to load higher up the storage hierarchy and what data to eject lower down the storage hierarchy.
What are the three main tasks in the fetch execute cycle?
- Check interrupt register.
- If set, call OS and set PC to handle interrupt. If not set, check PC.
- Fetch next instruction
- Execute instruction
Why is I/O an issue in regards to CPU processing time?
CPU cannot sit idle when I/O function is reached for two reasons.
1) I/O is very slow
2) Your program has no control outside its memory area.
What happens when an I/O call is REACHED?
Program stops (loses control of CPU). OS takes over and checks permissions. After, the CPU tells I/O device to perform job and then switches to another program.
Describe in detail how a CPU “talks” to a mechanical device.
CPU issues commands through driver to talk to the controller which controls a mechanical device.
Driver: Piece of software that allows CPU to communicate with controller (every controller has its own commands, or ‘language’).
Controller: Piece of hardware that communicates directly with the device.
Multiprogrammed Computer
Multiple jobs executing at the same time.
Multiprocessor System
Multiple CPUs
What happens when an I/O call is COMPLETED?
Device sets an interrupt in the interrupt register.
True/False: Some bits in the interrupt register are more important than others.
True, every bit has its own respective priority.
What is a trap?
A software interrupt.
True/False: Some controllers do not have a bit in the interrupt register.
False, every controller MUST have a bit in the interrupt register.
Why would any system want to use program controlled I/O?
While it does waste the utilization of the CPU, it has an important practicality when realtime systems are involved. This is because the response time for these types of systems is critical.
Does the CPU have a higher priority than the DMA controller? Why or why not?
No because the DMA runs much more infrequently compared to the CPU. The DMA would starve if it did not have more priority.
How does the CPU prevent infinite loops from destroying resources?
Has a timeout for running programs (interrupt is set on expiration).
How does the OS ensure that your program does not read/write another programs memory over?
Two registers:
MBR- Memory base register
MLR- Memory limit register
Every address the program generates is checked against these registers.
How does the CPU know that it is executing the OS vs. your program?
The mode bit:
1 when OS runs(kernel mode, OS mode, supervisor mode)
0 when your code runs
What are the steps taken when a computer is turned on?
1) HW/ROM(read-only memory) initialization
2) Loads OS into MM and sets mode bit to 1
3) OS runs, SW initialization occurs
4) Login Prompt
5) When user logs in, OS checks authentication of user
6) OS (normally) sets mode bit to 0 and gives control to user
When does the mode bit change to 1?
The CPU checks interrupt register. If an interrupt has been set, then the CPU sets the mode bit to 1 and gives control to the OS.
What five things make up a process?
Its text, variables, stack, heap, and set of resources used by the program.
What is a PCB?
Program Control Block, Data structure used to keep track of processes. It also keeps track of: Process id # Where the program is loaded in MM Files opened by the program Owner of the Process CPU scheduling information I/O status Accounting Register Values- Context of a process Pid of Parent State of process
Process Life Cycle
[Look up in notes]