-
What is static linking?
- Dependencies become part of the executable
- - have the ".a" extension
-
What is dynamic linking?
- Not linked to your code — not in executable
- - Before code execution, library is found and linked
-
What is an undefined behaviour?
Incorrect operations that lead to an unknown aftermath
-
What is the difference between static and dynamic checkers? Give an example of both.
- Static checkers are performed before runtime.
- - e.g. linters
- Dynamic checkers are during runtime.
- - e.g. sanitizers
-
What are fuzzers?
Generates a variety of inputs for a program in order to find error-causing ones.
-
What is the difference between preconditions and postconditions?
Preconditions are conditions met before executing a piece of code while postconditions are met after running a piece of code.
-
What is meant by byte-addressable memory?
Each memory address is a single byte.
-
List the memory segments in order.
- Memory Segments (from 2n - 1 address to 0):
- 1. Kernel
- 2. Stack
- 3. Memory Mapping
- 4. Heap
- 5. BSS
- 6. Data
- 7. Text
-
What is meant by padding (in memory)?
- Adding unused bytes (padding bytes) to a struct to satisfy alignment requirements
- - Automatically done by compiler
-
What is meant by packing (in memory)?
Process of minimizing padding within a struct to reduce its size in memory
-
Describe the kernel memory segment.
Reserved for core kernel components such as file system, network stack, etc.
- Properties:
- - Resource management (hardware access by programs)
- - Program control
- - Event-driven
- - Can be hardware interrupt, program syscalls and signals
- - OS terminates with segmentation fault if accessed by user
-
Describe the stack memory segment.
Stores local variables and arguments.
- Properties:
- - Grows downwards
- - Each function has a stack frame — saving each pointer to previous frame
- - Each stack frame saves the return address — line to continue executing in previous frame
-
Describe the memory mapping memory segment.
Stores shared libraries
-
Describe the heap memory segment.
Segment for dynamic allocation.
- Properties:
- - Grows upwards
- - Memory allocator keeps track of which heap space is in use or free
- - Allocating memory — memory allocation marks a portion of memory as in use and returns the lowest address
- - Freeing memory — memory allocator marks portion of memory as free
- - Need a pointer variable to access the heap
-
Describe the BSS memory segment.
Required so we can initialize uninitialized variables.
-
Describe the data memory segment.
Stores global and static variables.
-
Describe the text memory segment.
Stores the machine code of the compiled program.
-
What does Moore's Law observer?
The number of cores cores doubles about every two years.
-
What is NUMA?
Non-Uniform Memory Access
- Properties:
- - One motherboard that has multiple CPUs
- - Memory access time is non-uniform to CPU and memory
- - Farther away -> takes more time
-
What is the difference between containerization and virtualization?
Containerization creates a container, not a virtual machine.
Containers don't run another kernel unlike VMs.
-
List the memory/storage types from fastestto slowest.
- From largest to smallest:
- 1. Registers
- 2. SSDs
- 3. HDDs
- 4. mem
- 5. cache
- 6. tapes
-
What is the difference between x86 and ARM?
Two different instruction set architectures and use two different set of instructions.
-
What is the difference between CISC and RISC?
CISC (Complex Instruction Set Computer) instruction set architectures are mainly for assembly programmers and provide convenient instructions to reduce code effort.
RISC (Reduced Instruction Set Computer) instruction set architectures are mainly for compilers and provide a set of instructions that a CPU can run efficiently.
-
What is the difference between 32-bit and 64-bit architectures?
Determines the size of registers.
- Effects:
- - Large size computations (e.g. 64-bit integer additions) must be broken down to multiple operations
- - Pointer size
-
What is the difference between user mode and kernel mode?
Kernel mode allows full privilege and full access to the hardware.
User mode is for applications such that it can't run certain instructions and also access certain regions of memory.
-
What is meant by the Virtual File System?
It is an interface that defines data structures and operations that a file system should support.
If a file system implements this interface, then it can be plugged in easily.
-
What are the two ways to run a program? Describe the trade-offs.
Compilation (C/C++) and interpretation (Python, Bash).
The main trade-off is performance vs. portability. Performance is better for compilation since it directly generates machine code while interpretation has to translate the code at runtime.
Compilation is not portable because you compile for a specific ISA. While interpretation can run on any machine with the proper interpreter.
-
What is POSIX?
Portable Operation System Interface
It is the standard for software portability across operating systems.
Includes programming interfaces and shell utilities.
-
What is ABI?
Application Binary Interface
An interface for an executable that an OS defines.
To run an executable on a certain OS, the compiler needs to generate an executable that follows the ABI for the OS
-
What are Coreutils?
Shell utilities that all POSIX-compliant system should have.
e.g. ls, cp, etc.
-
Describe fork, exec, wait, and errno.
fork creates a child process that is identical to the calling process.
exec executes a new program and replaces the calling process with the new program.
wait waits on a child process's termination and obtains its status.
errno is a value set by system calls when there is an error.
-
What is meant by zombie and orphan processes?
A zombie process is created when the child process terminates but the parent process hasn't called wait yet. Does not get cleaned up and occupies memory.
An orphan process is created when the child process is running but the parent process has terminated.
|
|