An operating system (OS) is software that manages computer hardware and
software resources and provides common services for computer programs. The
operating system is an essential component of the system software in a computer
system.
- Traditional Computing
- Distributed Computing
- Web-based computing
- Embedded computing
- P2P Computing
- Resource-driven History
- General-purpose systems
- Batched
- Multi-programmed
- Multiprogramming needed for efficiency – Improvement over sequential execution
- Single user cannot keep CPU and I/O devices busy at all times
- Multiprogramming organizes jobs (code and data) so CPU always has one to execute
- A subset of total jobs in system is kept in memory – buffering
- One job selected and run via job scheduling
- When it has to wait (for I/O for example), OS switches to another job
- Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing
- Response time should be < 1 second
- Each user has at least one program executing in memory => process
- If several jobs ready to run at the same time => CPU scheduling
- If processes don’t fit in memory, swapping moves them in and out to run
- Virtual memory allows execution of processes not completely in memory
- Memory Layout for Multiprogrammed System
- Multiprogramming needed for efficiency – Improvement over sequential execution
- Single-processor
- Most systems use a single CPU – Not So true nowadays
- Personal computer – computer system dedicated to a single user.
- I/O devices – keyboards, mice, display screens, printers, networks
- Device-specific processors or controllers
- User convenience and responsiveness
- No priority on resource utilization.
- May run several different types of operating systems (Windows, Mac OS, UNIX, Linux)
- Multi-processor
- Multiprocessor systems grow in use and importance
- Also known as parallel systems or tightly coupled systems
- More than one CPU or processor in close communication
- Share the clock, memory, computer bus, and peripheral devices
- Multicore chips – more than one computing core on a single processor
- Pros:
- Increased throughput – Work can be done in parallel
- Economy of scale – cost less than multiple single-processor systems
- Increased reliability – jobs can fail over to the survived processors
- Fault tolerance and graceful degradation is a hot research topic
- Symmetric multiprocessing (SMP)
- Asymmetric multiprocessing
- Multi-Core Design
- Multiprocessor systems grow in use and importance
- Clustered
- Like multiprocessor systems, but multiple systems (nodes) working together
- Usually sharing storage via a storage-area network (SAN)
- Provides a high-availability service which survives failures
- Asymmetric clustering has one machine in hot-standby mode
- Symmetric clustering has multiple nodes running applications, monitoring each other
- Some clusters are for high-performance computing (HPC)
- Applications must be written to use parallelization
- Like multiprocessor systems, but multiple systems (nodes) working together
- Distributed
- Special-purpose systems
- Real-time
- Mobile systems
- System
- Organization
- Startup
- Interrupts
- OSes are interrupt driven (hardware and software)
- OS sits quietly, if nothing happens
- Hardware interrupt generated by one of the hardware devices
- Software interrupt (exception or trap):
- Software error (e.g., division by zero)
- Request for operating system service (int 0x80)
- Other process problems include infinite loop, processes modifying each other or the operating system
- I/O Structure
- Device controller informs CPU (through device driver) that it has finished its operation by causing an interrupt.
- Synchronous I/O: Control returns to user program (or other OS code) only upon I/O completion.
- Wait instruction idles the CPU until the next interrupt.
- Asynchronous I/O: Control returns to user program without waiting for I/O completion.
- Direct Memory Access (DMA) Structure
- Too many interrupts slows down the entire system
- DMA is used for high-speed I/O devices able to transmit information at close to memory speeds
- Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention
- Only one interrupt is generated per block, rather than the one interrupt per byte
- Storage Structure
- Main memory
- only large storage media that the CPU can access directly
- random access, volatile, byte-addressable, fast, small
- Secondary storage
- extension of main memory that provides large storage capacity
- block access, nonvolatile, slow, big
- Hard disks - rigid metal or glass platters covered with magnetic recording material
- Disk surface is logically divided into tracks, which are subdivided into sectors
- The disk controller determines the logical interaction between the device and the computer
- Solid-state disks – faster than hard disks, nonvolatile
- Various technologies
- Becoming more popular
- Main memory
- Storage-deivice hierarchy
- Caching – copying information into faster storage system; main memory can be viewed as a last cache for secondary storage
- Hardware Protection
- Dual-mode Operation
- Dual-mode allows OS to protect itself and other system components
- User mode and kernel mode
- Mode bit provided by hardware
- Enables to distinguish when system is running user or kernel code
- Some instructions are privileged, only executable in kernel mode
- System call changes mode to kernel, return from call resets it to user
- Increasingly CPUs support multi-mode operations
- i.e. virtual machine manager (VMM) mode for guest VMs
- Dual-mode allows OS to protect itself and other system components
- I/O Protection
- Memory Protection
- CPU Protection
- Dual-mode Operation
- Network Structure
- LAN
- WLAN
- One or more CPUs, device controllers connect through common bus providing access to shared memory
- Concurrent execution of CPUs and devices competing for memory cycles
Computer System Organization
Logical organization
A computer motherboard