- An operating system is a computer program that multiplexes hardware resources and implements useful abstractions.
- As a computer scientist or engineer you should know how computers really work.
- Programming operating systems will make you a better programmer and improve all of your subsequent work.
- While many operating systems concepts are elegantly simple, implementing them is not.
- Find a way to iterate quickly and limit the number of untested lines.
- Break your code into small, easily tested functions.
- Abstractions simplify application design by hiding undesirable properties, adding new capabilities, and organizing information.
- Threads abstract the CPU.
- Address space abstract memory.
- Files abstract the disk.
- Processes are the most fundamental operating system abstraction.
- The OS is responsible for isolating processes from each other.
- Sharing data requires synchronization mechanisms to ensure consistency.
- Pipes create a producer-consumer buffer between two processes.
- Signals are a limited form of asynchronous communication between processes.
- Processes contain threads; threads belong to processes.
- Process life cycle:
- Birth: fork()
- Change: exec()
- Death: exit()
- The Afterlife: wait()
- File handles store the current file offset, or the position in the file that the next read will come from or the next write will go to.
- fork() is the Unix system call that creates a new process.
- The OS creates the illusion of concurrency by quickly switching the processor(s) between multiple threads.
- A race condition is "when the output of a process is unexpectedly dependent on timing or other events".
- Concurrency: the illusion that multiple things are happening all at once.
- Atomicity: the illusion that a set of separate actions occurred all at once.
- A critical section contains a series of instructions that only one thread can be executing at any given time.
- Busy waiting prevents the thread in the critical section from making progress.
- Locks protect access to shared resources.
- Deadlock occurs when a thread or set of threads are waiting for each other to finish and thus nobody ever does.
- Processes that have exited but not had their exit code collected are called zombies.
- When the CPU is in kernel mode there are special instructions that can be executed.
- Hardware interrupts are used to signal that a particular device needs attention.
- The instructions that the processor executes when an interrupt fires are called the interrupt service routine.
- Interrupts are voluntary. Exceptions are non-voluntary.
- Multiple cores have emerged as a solution to thermal- and energy- management issues caused by transistor density.
- Timer interrupts generated by a timer device ensure that the operating system regains control of the system at regular intervals.
- Timer interrupts are the basis of preemptive scheduling: the operating system doesn't wait for the thread to stop running, instead it preempts it.
- A transition between two threads is called a context switch.
- Nobody wants to work with a jerk--no matter how talented you are.
- Scheduling is the process of choosing the next thread to run on the CPU.
- How the CPU is scheduled impacts every other part of the system.
- Humans are sensitive to responsiveness and continuity.
- Normally we cannot predict the future. Instead, use the past to predict the future.
- Time multiplexing: sharing a resource by dividing up access to it over time.
- Space multiplexing: sharing a resource by dividing it into smaller pieces.
- Process layout is specified by the Executable and Linker Format (ELF) file.
- Address spaces are meant to provide a private view of memory to each process.
- Introducing another level of indirection is a classic systems technique.
- A physical address points to memory. A virtual address points to something that acts like memory.
- Dynamic memory allocation is performed by the sbrk() system call.
- Common systems trick: when something is too slow, throw a cache at it.
- Virtual address translation gives the kernel the ability to remove memory from a process behind its back.
- We call the process of moving data back and forth from memory to disk to improve memory usage swapping.
- Flash is the future. But HDDs are still around.
- Hierarchical file systems are dead. Long live search!
- File systems are really maintaining a large and complex data structure using disk blocks as storage.
- Most files are small, but some can be very large.
- Almost every file system operation involves modifying multiple disk blocks.
- File system operations that modify multiple blocks may leave the file system in an inconsistent state if partially completed.
- Most systems papers have one or two big ideas and a lot of implementation.
- Several cheap things can be better than one expensive thing.
- Operating systems leak a lot of information between processes through the file system and other channels.
20181029
OPS Class Lecture Notes
Labels:
compsci
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment