Process Flashcards
What is an OS’s task?
1) Abstraction: hide hardware details from applications/programmers/users
2) Resource Management: resources must be multiplexed in a fair way between applications/users
3) Protection: Different applications shouldn’t be able to disturb/manipulate each other
4) PROVIDING AN EXECUTION ENVIRONMENT FOR APPLICATIONS
Why is abstraction a central task of an OS
- to hide implementation details of the hardware from the applications
- make it easier to develop applications
- increase application compatibility
- improve reliability by taking away complexity
Why is protection still as important although most devices run an OS used by a single user only?
- protective measures such as the separation into user and kernel modes increases the reliability of the system
- a buggy application might crash the whole system, leading to data loss
- to protect user’s data from untrusted sources in today’s interconnectivity of the computers
What is the advantage of fixed-size integer types like uint32_t?
The normal int types have different sizes depending on the OS. The fixed-size types help writing portable code; code that works on multiple different systems without modification
Explain all functions of * and & operators
- *: in front of a variable name declares that variable to be a pointer: *pointer1
- *: in front of a pointer variable dereferences the pointer: return *pointer1
-&: in front of a variable returns the address of that variable, which is a pointer: pointer2 = ¬apointer
User mode
-only non-privileged processor instructions can be executed
kernel mode
- allow the execution of all instructions
- some activities that control & manage the system as a whole may only be performed in kernel mode
- it is needed to avoid other applications to use the system according to their own needs while negatively affecting other applications; by occupying the system resources as long as they need
What are privileged instructions and give examples
Instructions that
- manipulate control registers for memory translation
- disable or enable interrupts
- access platform devices
+Load and store control registers
+Halt processor
+Write model-specific registers
+Read time-stamp counter
Basic data types in C
-char: 1B
-short: 2B
-int: 4B
-long long: 8B
-float: 4B
-double: 8B
Global variables
- live while the program runs
- placed in the data segment
Local variables
- accessible and valid only in the scope of the block/function in which they are declared
- placed on the stack or in CPU registers
What is a process?
A process is a program in execution - an instance of a program
Each process is associated with a OS data structure called process control block (PCB) that holds all state information
Concurrency vs parallelism
Concurrency: Multiple processes on the same CPU
Parallelism: Processes truly running at the same time with multiple CPUs
What is direct execution and its problems?
Direct execution: Allow user process to run directly on hardware, OS creates process and transfers control to starting point
Problems:
- Process can harm each other
- Could read/write other process data
- Process could run forever
- Process could do something small
80:20 rule
Programs can see more memory than available:
80% of process memory idle, 20% active working set