Skip to content

Instantly share code, notes, and snippets.

@onyb
Created March 19, 2015 12:14
Show Gist options
  • Save onyb/f755b5d8f33c2ed73098 to your computer and use it in GitHub Desktop.
Save onyb/f755b5d8f33c2ed73098 to your computer and use it in GitHub Desktop.
Operating Systems (Third Edition): Chapter 2
Operating Systems (Third Edition)
Harvey M. Deitel, Paul J. Deitel, David R. Choffnes
-------------------------------------------------------------------------------
CHAPTER 2: Hardware and Software Concepts
-------------------------------------------------------------------------------
# Clocks
- Computer time is measured in cycles.
- Front Side BUS (FSB) connects processor to memory modules, operating at a
particular frequency.
- Devices generate derived speeds by multiplying or dividing the speed of
FSB.
- If one component on a BUS has extremely high multiplier and another
component on the same BUS has extremely high divider, then bottlenecks
might arise due to difference in speeds.
# Memory Hierarchy
* Fastest and most expensive at the top, slowest and least expensive at the
bottom.
- Registers
- L1 Cache
- L2 Cache
- Main memory
- Secondary storage
# Direct Memory Access (DMA)
- Improves data transfer between memory and I/O devices.
- Devices and controllers transfer blocks of data to and from main memory
directly.
- Processor is free to execute software instructions.
- Processor is notified when I/O operation completes through an interrupt.
- Improves performance in systems that perform large number of I/O
operations.
# Processor
* OS protection mechanism
- OS prevents processes from accessing privileged instructions or
memory by implementing execution modes.
- User mode (user state or problem state)
- Kernel mode (supervisor state)
- Principle of Least Privilege: Any particular user should be granted
the least amount of privilege and access required to accomplish its
designated tasks.
* Memory protection and management
- Prevents processes from accessing memory that has not been assigned
to them.
- Use of bounds registers to specify the address of the beginning and
end of process's allocated memory.
- Protection is enforced by determining whether a given address is
within the allocated block.
* Interrupts and Exceptions
- Devices send a signal called an interrupt to the processor when an
event occurs.
- Exceptions are interrupts generated in response to errors, such as
hardware failures, logic errors, and protection violations.
# Timers and Clocks
- Operating systems use interval timers to prevent processes from
monopolizing the processor.
- The time-of-day clock enables OS to determine the current time and date.
# Caching
- Cache maintains copies of data that will be accessed soon.
- Cache entries (or cache lines) must be managed appropriately to minimize
the number of times referenced information is not present in cache, an
event called cache miss.
- When a cache miss occurs, the system must retrieve information from
slower storage.
- Use heuristics to determine which files are likely to be used in the near
future, and place them in cache for a possible cache hit.
# Linking
- Combine object modules to form a single executable unit.
- Integrate precompiled modules called libraries referenced by a program.
- Each object module has three sections: code, data, and symbol table.
- During linking, the code and data segments are combined simply to form a
single object module. The new symbol table is created by the process of
symbol resolution.
- A symbol table has two columns - external names, and external references.
If a program makes functions or data available to other programs, each of
these is represented as an external name. If a program references
functions or data from another module, the compiler translates them to
external references.
- Objective of linker is to resolve external references in the final load
module, by checking the external names.
- Object files typically specify the locations of data and instructions
using relative addresses. Linker is also responsible for modifying these
addresses so that they do not reference invalid data after linking.
- Usually the final load module has no external references. However many
programs rely on shared libraries to function, in which case the load
module can have external references to the shared library.
- Linking at runtime is called dynamic linking.
# Loading
- Place instructions and data in main memory
- Convert relative address in the load module to physical addresses.
- Absolute loading: place program at address specified by compiler.
- Relocatable loading: Relocate the program's address to correspond to an
available location in main memory.
- Dynamic loading: Load program modules upon first use.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment