Architectural
(hardware) Support for
Operating Systems
• Review of introduction
• Hardware overview
• A peek at Unix
• Hardware (architecture) support
• Summary
Review
• What are the two main responsibilities of OS?
• Manage hardware resources
• Provide a clean set of interface to programs
• Managing resources:
• Allocation
• Protection
• Reclamation
• Virtualization
• Questions?
Why Start With Hardware?
• Operating system functionality fundamentally depends
upon hardware
• Key goal of an OS is to manage hardware
• If done well, applications can be oblivious to HW details
• Hardware support can greatly simplify – or complicate –
OS tasks
• Early PC operating systems (DOS, MacOS) lacked virtual
memory in part because the hardware did not support it
So what is inside a computer
Why hardware has to support
User/Kernel mode?
17 CS317 Operating System
• Give the CPU to the user application
• Why: Performance and efficiency
• OS will not be executing
• Without hardware’s help, OS loses control of the machine!
• Analogy: give the car key to someone, how do you know if he will
return the car?
• This is the one of the most fundamental reasons why OS will
need hardware support --- not only for user/kernel mode
Hardware Features for OS
• Features that directly support the OS include
• Protection (kernel/user mode)
• Protected instructions
• Memory protection
• System calls
• Interrupts and exceptions
• Timer (clock)
• I/O control and operation
• Synchronization
Types of Hardware Support
• Manipulating privileged machine state
• Protected instructions
• Manipulate device registers, TLB entries, etc.
• Generating and handling “events”
• Interrupts, exceptions, system calls, etc.
• Respond to external events
• CPU requires software intervention to handle fault or trap
• Mechanisms to handle concurrency
• Interrupts, atomic instructions
Protected Instructions
• A subset of instructions of every CPU is restricted to use
only by the OS
• Known as protected (privileged) instructions
• Only the operating system can
• Directly access I/O devices (disks, printers, etc.)
• Security, fairness (why?)
• Manipulate memory management state
• Page table pointers, page protection, TLB management, etc.
• Manipulate protected control registers
• Kernel mode, interrupt level
• Halt instruction (why?)