P1L2. Introduction to Operating Systems Flashcards
- key components - design principals
What is an operating system?
A special piece of software that abstracts and arbitrates the underlying hardware system.
- hides hardware complexity
- resource management
- provide isolation protection (e.g., multiple running applications can’t hurt each other)
A layer of systems software that resides between applications and hardware.
It has privileged access to the underlying hardware and manipulate its state.
It’s role is to hide hardware complexity and manage hardware on behalf of one or more applications according to some predefined policies.
It also ensures that applications are isolated and protected from one another.
What role does an operating system play in computer systems?
- Directs operational resources (e.g., control use of CPU, memory, peripheral devices)
- Enforces working policies (e.g., fair resource access, limits to resource usage)
- Mitigates difficulty of complex tasks (e.g., abstract hardware details with system calls)
What are the key elements of an operating system?
- abstractions
- mechanisms
- policies
What are the key design considerations of an operating system?
> Separation of mechanism & policy
- implement flexible mechanisms that can support many policies (e.g., LRU, LFU, random)
> Optimize for the common case
- based on the common case we can pick a policy that makes sense and can be supported by the underlying mechanisms and abstractions
What are some examples of OS abstractions?
- process
- thread
- file
- socket
- memory page
What are some examples of OS mechanisms?
- create
- schedule
- open
- write
- allocate
What are some examples of OS policies?
- least-recently used (LRU)
- earliest deadline first (EDF)
Computer platforms distinguish between at least two modes of privilege. What are they?
- user-level (unprivileged)
- kernel-level (privileged)
What is a privilege bit?
In kernel-level privileged mode a privileged bit is set in the CPU to indicate that we’re in this mode. In user-level unprivileged mode this bit is not set. Attempts to perform privileged operations will be forbidden and will cause a trap.
What happens when a trap is triggered by a user-level process attempting to access hardware?
- The application will be interrupted
- Hardware will switch the control to the operating system
- The operating system will check what caused what caused the trap to occur and then will verify if it should grant that application access or terminate the process.
What are examples of things that cross the user/kernel protection boundary?
- trap instructions
- system calls
- signals
How do user/kernel transitions affect application performance?
- they involve many instructions (e.g., ~50-100ns on a 2 GH machine running Linux)
- the operating system brings some of what it needs into the hardware cache, likely displacing stuff the application needs, which will have some impact on performance b/c the application will then need to go to memory for the data it needs
What are some pros and cons of a monolithic OS?
Pros:
- everything included
- inlining, compile-time optimizations
Cons:
- customization, portability, manageability
- memory footprint
- performance
What are some pros and cons of a monolithic OS?
(every type of service that any application could require of that any type of hardware will demand is already part of the operating system)
e.g., some times of specialized file systems
Pros:
- everything included
- inlining, compile-time optimizations
Cons:
- customization, portability, manageability
- memory footprint
- performance
What are some pros and cons of a modular OS (e.g., Linux)
(some types of basic services and apis are already part of the operating system but everything can be customized. this is possible because the os specifies certain interfaces that every module must implement in order to be part of the os)
Pros:
- maintainability / upgradability
- smaller footprint
- less resource needs
Cons:
- indirection can impact performance
- maintenance can be an issue as modules come from different codebases and can introduce bugs