Operating Systems Flashcards
Interface
Describes what a computer program does and how it interacts with the rest of programs
There is nothing more fundamental in computer science than Interfaces.
Abstraction
An interface to application programmers that separates policy—what the interface commits to accomplishing—from mechanism—how the interface is implemented.
Who is responsible for intra-process communication?
The software developer (You)
Who is responsible for inter-process communication?
The Operating System
Are Thread stacks tipically private (can only be seen by the owner Thread) or public (can be seen by all Threads in a process?
Private
Mechanisms of Thread intra-process communication
Shared memory
Share open file handles
Static and dynamically-allocated global variables
Mechanisms of Thread inter-process communication
Shared files Sockets Exit codes Signals Pipes Shared memory
Can a Thread from one Process contact a Thread from another Process to request/send resources?
Only with mutual consent from both Processes, meaning a mechanism for the communication to happen (i.e. sockets, shared files…) was previously set .
The only thing that can ‘run’ on a system
Thread
When is a Process considered running?
When at least one of its Threads is running
Who are the primary users of the kernel?
Processes
What do processes contain?
One or more threads
An address space
Zero or more open file handles representing files.
Who populates /proc entries?
The kernel. It uses /proc to export infomation
Pseudo filesystem similar to /proc that can modify system behaviour while running
/sys
Who protects Processes from each other??
The OS
File Descriptor
An int index returned by open() that points to a position in the File Table array
File Handle
Contains FIle Mode and offset (position in File where the next read or write is going to be done).
File Object
Hold file state, other than the state held by File Handle.
How is a new process created?
By calling fork() (or clone() a more flexible primitive)
Used to abstract and multiplex the CPU
Threads
The fastest part of your computer system
The CPU (cache memory is a lot faster than main memory)
Why is a ‘race condition’ bad for program behaviour?
Races can be won by any of its competitors. In this case is Threads. We don’t want the outcome of a program to change depending on which Thread, or instructions within the Thread, ‘wins the race’
Atomicity
An atomic transaction is an indivisible and irreducible series of database operations such that either all occurs, or nothing occurs.
2 most important things about concurrency programming
- Coordination
- Correctness