Introduction to Operating Systems
Computer System Architecture
Computers have many aspects including:
- IO devices (i.e. mouse, keyboard, display, etc.)
- disk controller
- USB controller
- graphics adapter
However, the main components that we will be focuson on are:
- CPU
- memory (main memory and cache memory)
- memory mapped IO devices
Basic CPU
A CPU is a circuit, with memory, to perform streams of instructions that are sent to it.
Instruction Set
16 instructions, 16 bit each
NOP # no operation (while waiting for something else or if nothing needs to be done)
LOAD
STORE
SET
LT # less than
EQ # equal
BEQ # branch equal
These are the basic instruction need to write a program.
RISC: an architecture that's compact and focuses on LOAD and STORE operations and the arithmetic operations
VLIW: very large instruction register
Context Switch
Instruction increment after instruction fetch. Moves onto next instruction.
To run multiple programs simultaneously:
- set processor in 'special mode'
- store current state
- restore other program state
- resume normal operation
Each program is only aware of itself. The purpose of the switch is to control which program runs and to allocate the resources for it.
System Memory and IO Devices
Cache Levels
- L1 cache is the fastest with each level following being slower
- when retrieving data, the cache gets searched first and then the main memory
Buses allow the transfer and 'flow' of data. Bridges are used to extend its functionality and allow inter-bus communication.
Single Processor
- from PDAs to mainframes
- almost all have special-purpose processors for graphics and I/O
Multiple Processor
- increase throughput
- scale
- reliability
- asymmetric multiprocessing
Shares memory and IO through a bus.
Distributed Systems (Clusters)
- computer sub-systems interconnected via IO components
Storage Structure
Primary Storage
- main memory directly accessible by the CPU
- program must be in main memory in order to be executed
- not large enough to store all programs
Secondary Storage
- holds large amounts of data permanently
IO Structure
IO Controller
The controller lies between the IO device and the bridge connecting it to a bus. It handles any intermediate processing that may need to be done when communicating with the IO device.
Drivers
An example of this are device drivers that interpret IO input and acts as an API to the OS to interact with it.
A driver knows when the IO completes by reading a status register (polling). This is called direct IO. Low overhead if IO is fast but there is lots of wasted waiting if IO is slow.
To deal with slow IO, do something else until there is a signal from the device (raising and interrupting). This is called interrupt-driven IO. There is more overhead but there is no busy waiting.
Direct Memory Access (DMA)
Moving memory from address to address (i.e. from device to memory). The device will have a pool of DMA instructions and will determine size
The Role of the Operating System - User View
There are many levels of layers/complexities. Users interact with compilers, assemblers, text editors, etc. They are programs/applications which handle the lower-level operation of it with the operating system.
KERNEL MORE LIKE KERNEL BYE!!