Midterm 1 Flashcards
Explain the Von Neumann Architecture
Computer that fetches instructions from RAM to execute
Those instructions can further modify other RAM locations which can contain data or even code
Known as “stored program” concept
What is an Operating System
Piece of software that manages resources, abstracts details
The “adult” in the room
Event-driven
Program that runs first on the computer –> allows the code to set up the initial addresses of the interrupt handlers in the interrupt vector
When OS is terminated, computer is done
Overhead: any resources taken by the OS cannot be used what we really want system to run
Explain the Abstraction of Details in the Operating System
We want to give the illusion that each program (process) has exclusive access to the CPU’s time
Also includes exclusive access to I/O devices and transparent security
However, we are worried about sharing the resources of the system
Exclusive Access
Abstraction technique called virtualization
What is partitioning?
Dividing the memory region into pieces and giving a piece to each program
Describe the drawbacks of remembering the extents of each partition
It’s very expensive as we would check the limit and base frequently and does not give the illusion of exclusive access
Explain virtual addressing
It solves protection problems as an address is already yours, and you can’t write to another address of a different program
It also solves relocation problem since address is already yours and to your program the address doesn’t move
What are system calls used for? Explain what a syscall is
They are used for asking the Operating System for something
They are software interrupts (stops what we are doing with the intention to go back)
This makes the OS event-driven, as it isn’t constantly running. It responds to events
Explain privileged/Kernel and Protected/User mode instructions
They are different instruction sets.
In kernel mode, it has full unrestricted access to the system’s resources. Due to this, only well trusted code can run in this mode.
In user mode, the executing code has restricted access, as in it can’t handle privileged instructions. If applications in user mode try to execute privileged instructions, the OS kills the program (SIGILL)
Explain what happens in the OS when a syscall is called
The CPU goes into kernel mode. It looks the type of software interrupt in the interrupt vector.
The interrupt vector should contain the address to set the PC( Program Counter) to
Then, we look at v0 to determine the index and determine which syscall it is and what behaviors to perform
Go more in depth about the interrupt vector
It is stored in the CPU
It is essentially a data structure that provides the address of the routine to be executed when a specific interrupt occurs
Explain Context Switching
The instructions of the OS share the same resources as the instructions of the user program that is being interrupted
We have to put things back the way they were when we return from the OS
These values are stored in memory, which means context switching is very costly
We want to do it the least possible
Monolithic Kernel
Everything that is OS lives in kernel mode
All kernel-level code and data structures share an address space. This means functions are shared and can be called anywhere
More efficient as there is less context switching.
Microkernel
Smaller in order to make OS do less
Needs a scheduling algorithm
Scheduling doesn’t need to access to kernel instructions. We move it out into user mode called process server. Once that decision is made, we enter kernel mode.
Slower as there is more context switching
What is a process?
A running program and its associated data. The program is the code and (static) data stored in an executable file on disk. The von Neumann architecture prevents us from running it until it has been copied into RAM
Explain Multiprogramming
It is the ability to run multiple processes at the same time, or in other words, concurrency.