Exam 1 Flashcards
What is a Virtual Machine?
A piece of software that runs as an application on your OS. It can be configured to run its own OS internally and allows multiple OS’s to run on the same computer.
It is run in the user space. Also called a “Guest Operating System”.
What are the three layers of the computer?
- Bottom Layer: hardware the computer runs on
- Operating System: the Os that runs on your computer
- User Space: where we run different applications
Host OS
The original operating system that comes on your machine. It’s also known as the OS that runs on “bare metal”.
Why do we use VM’s?
- They allow multiple OS’s to run on the same machine.
- They allow developers to sandbox and test code on a specific operating operating system version.
- They allow for the cloud computing revolution.
What are the primary differences between Code Repositories and DropBox-like file sharing systems?
DROPBOX:
- Files are automatically synchronized.
- Resolves conflicts by creating two copies.
- Some support for versioning but no branches.
CODE REPOSITORIES:
- Requires programmer explicit push and pull.
- Automatic merging of source code.
- Excellent support for branches and versioning.
Programmers use code repo’s over dropbox-like systems because:
- DropBox systems automatically sync changes meaning you don’t have control over reconciling version differences.
- Dropbox systems are for code editing so you end up with many file copies instead of merged files with updates from multiple places.
- Code repos have great support for branching and versioning.
What do the following vagrant commands do?
- vagrant up
- vagrant ssh
- vagrant suspend
- vagrant destroy
- vagrant halt
- logout
- vagrant up: Starts VM and provision according to vagrant file.
- vagrant ssh: Accesses your VM such that all future commands occur on VM.
- vagrant suspend: Saves the VM state and stops the VM.
- vagrant destroy: Removes all traces of the VM on your computer.
- vagrant halt: Gracefully shuts down the VM OS and powers down the VM.
- logout: Stops ssh connection and returns to your terminal.
What are the three primary sections of a vagrant file?
- Define: provide the host name for the VM and specify the guest OS we desire.
- Provisioning: install the tools (And correct versions of tools) that we’d like. Some examples are valgrind, gdb, etc.
- Machine: specify the # of CPUs and RAM that we want to allocate.
Operating System (OS)
A system that provides the interface between a user’s application and the hardware. It is the process scheduler for the computer.
- Software that usually comes pre-installed on a computer. It includes a graphical user interface for you to interact with.
- The OS allows you to run multiple applications at the same time and switch seamlessly between those apps.
- It stores data on persistent storage devices.
- It allows apps to interact with external devices like the monitor, mouse, etc.
- OS does memory management which allows multiple apps stored at the same time in memory to be executed.
The Kernel
Forms the core of the operating system and provides all the key functionalities for managing interactions between user-level programs.
The Shell
A command interpreter for the operating system.
Data Storage in the OS
All data is stored in the form of files, and the OS maintains file names, sizes, locations, directory structure, and file access rights.
What are the two main functions of the OS?
- Abstract away the messy details of the hardware so that user programs can be written without needing to understand hardware interaction.
- Resource management.
User Mode
In this mode, each application can only run instructions that affect its own applications. User mode executes the functions in the application mode.
Kernel Mode
Handles operating system functions that exist in the code. When these functions are run, the computer flips to OS mode. Only happens for select system calls and carries a lot of overhead. The division between this an the user mode helps us keep the operating system safe from errors and attacks.
What is a Process?
A program in execution. When a program runs, the OS needs to keep the program’s contents in memory and on disk. Processes run sequentially. Multiple processes can be running in the same application or at the same time. For example, running an application twice is treated as two separate process contexts.
Process Context
When a process stops, we get a snapshot of it. This includes the process’ data, memory utilization and execution context. This is savable so that the OS can save its place and then leave and come back.
Why does the OS run apps with the process abstraction?
At any point in time, the OS has to manage many applications at the same time. The abstraction allows it to package processes up into one bundle of information to make transitioning between them easier.
The OS also has its own processes for things like memory management.
How big is the address space of a process?
Each process has an address space that goes from 0 to 2^64 - 1 bytes.
What part of memory are applications run in?
The CODE section. Also sometimes called the “text” section because it’s read only.
Program Counter
Holds the address of the next instruction to execute. It is part of the code segment.
Where is temporary data from a program stored?
The STACK.
Temporary data gets put onto the stack. It grows from the top down. New values get pushed onto it, and when the function call ends, the stack stops tracking the data. We track the bottom of the stack to ensure we don’t hit the heap and overwrite data there.
What are Data Segments?
These are the global variables. They are defined using the static keyword and are determined at compile time.
The Heap
Stores Dynamically Allocated Memory and it grows at run time as data is added to it. It can grow and shrink as data is added/freed.
What is the order of memory segments from top to bottom?
Stack (grows downward)
Heap (grows upward but can have items randomly placed)
Static Data
Code