ECE344H1 Lecture Notes - Lecture 3: Cpu Modes, Protection Ring, Memory Management

104 views4 pages
OS-Related Hardware
-------------------
Reading: Book chapter 1.1-1.4
0) Overview
- Recall that OS manages h/w resources
- It is just a program, so when other applications are running, it is not
running, so how does it manage resources?
- OS needs help from hardware
- Hardware support for operating systems
- CPU modes
- Memory management
- Trap
1) CPU modes
- CPU has two modes that define what instructions can be executed
- Supervisor/kernel mode - can execute every instruction
- User mode: can only execute a subset of instructions
- Mode bit is maintained in PSW (mode bit set is supervisor mode)
- Instructions that execute only in supervisor mode are called privileged
instructions
- In general, these instructions affect entire machine
- Access devices (e.g., set time), configure interrupts, configure memory
protection, set the mode bit
- OS operates in supervisor mode
- Has all privileges, access to all memory, devices, etc.
- Any code that operates in supervisor mode is called OS code
- OS configures hardware so that applications operate in user mode
- Have limited privileges, limited memory access, no access to devices
- So an OS is a program, but it is more than just a program!
- When applications need to run privileged instructions, they MUST call OS
- Assumption: OS is trusted, applications are not, or correct system operation
depends on correct OS, but not on correct operation of user programs
- Analogy with client-server software
2) Memory management
- Address range in each application starts at 0
- How does the CPU run multiple programs simultaneously?
- CPU has Memory Management Unit (MMU)
- CPU produces virtual addresses
- MMU maps virtual address to physical memory address
- Different programs have different physical addresses
- A simple MMU has a base and a limit register, performs two operations
- Relocation
- A Base Register converts virtual address to physical address
Unlock document

This preview shows page 1 of the document.
Unlock all 4 pages and 3 million more documents.

Already have an account? Log in

Document Summary

Cpu has two modes that define what instructions can be executed. Supervisor/kernel mode - can execute every instruction. User mode: can only execute a subset of instructions. Mode bit is maintained in psw (mode bit set is supervisor mode) Instructions that execute only in supervisor mode are called privileged instructions. In general, these instructions affect entire machine. Access devices (e. g. , set time), configure interrupts, configure memory protection, set the mode bit. Has all privileges, access to all memory, devices, etc. Any code that operates in supervisor mode is called os code. Os configures hardware so that applications operate in user mode. Have limited privileges, limited memory access, no access to devices. So an os is a program, but it is more than just a program! When applications need to run privileged instructions, they must call os. Assumption: os is trusted, applications are not, or correct system operation depends on correct os, but not on correct operation of user programs.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents