Operating System Structures - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Operating System Structures

Description:

Stop booting if fatal errors, and report ... Is it okay to boot at first sector on the floppy or disk? Ways to Develop An Operating System ... – PowerPoint PPT presentation

Number of Views:13
Avg rating:3.0/5.0
Slides: 23
Provided by: Kai45
Category:

less

Transcript and Presenter's Notes

Title: Operating System Structures


1
Operating System Structures
  • Vivek Pai (orig Kai Li)
  • Princeton University

2
Are You In This Class?
  • Did you send me e-mail?
  • Did you include which precept?

3
Precept Sizes Unbalanced
4
A Typical Computer from a Hardware Point of View
CPU
CPU
. . .
Chipset
Memory
I/O bus
Network
5
A Typical Computer System

Memory
CPU
Programs and data
. . .
Operating System Software
CPU
OS
Network
Apps
Data
6
Typical Unix OS Structure
Application
Bootstrap System initialization Interrupt and
exception I/O device driver Memory
management Kernel/user mode switching Processor
management
Standard library
Portable OS Layer
Machine-dependent layer
7
Another Look Unix Onion
Applications
User and Kernel boundary
OS Service
Device Driver
Hardware
8
OS Service Examples
  • Examples that are not provided at user level
  • System calls file open, close, read and write
  • Control the CPU so that users wont stuck by
    running
  • while ( 1 )
  • Protection
  • Keep user programs from crashing OS
  • Keep user programs from crashing each other
  • Examples that can be provided at user level
  • Read time of the day
  • Protected user level stuff

9
Processor Management
  • Goals
  • Overlap between I/O and computation
  • Time sharing
  • Multiple CPU allocations
  • Issues
  • Do not waste CPU resources
  • Synchronization and mutual exclusion
  • Fairness and deadlock free

CPU
I/O
CPU
CPU
CPU
I/O
CPU
I/O
CPU
CPU
CPU
10
Memory Management
  • Goals
  • Support programs to run
  • Allocation and management
  • Transfers from and to secondary storage
  • Issues
  • Efficiency convenience
  • Fairness
  • Protection

Register
L2 10x
Memory 200x
Disk 10Mx
Tape 100Mx
11
x86 Architecture Registers
16-bit 32-bit
15
31
0
8 7
15
0
EAX EBX ECX EDX EBP ESI EDI ESP
CS DS SS ES FS GS
AX BX CX DX
AL
AH
BL
BH
CL
CH
DL
DH
BP
SI
Segment registers
DI
SP
General-purpose registers
EFLAGS register
EIP (Instruction Pointer register)
12
I Feel Your Pain
13
x86 Memory
232-1
31
8 7
16 15
24 23
0
. . .
Byte 4
Byte 5
Byte 6
Byte 7
Byte 0
Byte 1
Byte 2
Byte 3
Byte order is little endian
0
14
I/O Device Management
User 1
User n
  • Goals
  • Interactions between devices and applications
  • Ability to plug in new devices
  • Issues
  • Efficiency
  • Fairness
  • Protection and sharing

. . .
Library support
Driver
Driver
I/O device
I/O device
. . .
15
Window Systems
  • All in the kernel (Windows)
  • Pros efficient?
  • Cons difficult to develop new services
  • All at user level
  • Pros easy to develop new apps
  • Cons protection
  • Split between user and kernel (Unix)
  • Kernel display driver and mouse driver
  • User the rest

16
File System
User 1
User n
  • A typical file system
  • Open a file with authentication
  • Read/write data in files
  • Close a file
  • Can the services be moved to user level?

. . .
File system services
File
File
. . .
17
Bootstrapping
  • Power up a computer
  • Processor reset
  • Set to known state
  • Jump to ROM code
  • Load in the boot loader from stable storage
  • Jump to the boot loader
  • Load the rest of the operating system
  • Initialize and run

Boot loader
Boot loader
OS sector 1
OS sector 2
. . .
OS sector n
18
System Boot
  • Power on (processor waits until Power Good
    Signal)
  • Processor jumps on a PC (Intel Inside) to
    address FFFF0h
  • 1M 1,048,576 220 FFFFFh1
  • FFFFFhFFFF0h16 is the end of the (first 1MB of)
    system memory
  • The original PC using Intel 8088 had 20 address
    lines -)
  • (FFFFFFF0h) is a JMP instruction to the ROM BIOS
    startup program

19
ROM BIOS startup program (1)
  • POST (Power-On Self-Test)
  • If pass then AX0 DH5 (586 Pentium)
  • Stop booting if fatal errors, and report
  • Look for video card and execute built-in ROM BIOS
    code (normally at C000h)
  • Look for other devices ROM BIOS code
  • IDE/ATA disk ROM BIOS at C8000h (819,200d)
  • Display startup screen
  • BIOS information
  • Execute more tests
  • memory
  • system inventory

20
ROM BIOS startup program (2)
  • Look for logical devices
  • Label them
  • Serial ports
  • COM 1, 2, 3, 4
  • Parallel ports
  • LPT 1, 2, 3
  • Assign each an I/O address and IRQ
  • Detect and configure PnP devices
  • Display configuration information on screen

21
ROM BIOS startup program (3)
  • Search for a drive to BOOT from
  • Floppy or Hard disk
  • Boot at cylinder 0, head 0, sector 1
  • Load code in boot sector
  • Execute boot loader
  • Boot loader loads program to be booted
  • If no OS "Non-system disk or disk error -
    Replace and press any key when ready"
  • Transfer control to loaded program
  • Is it okay to boot at first sector on the floppy
    or disk?

22
Ways to Develop An Operating System
  • A hardware simulator
  • A virtual machine
  • A good kernel debugger
  • When OS crashes, always goes to the debugger
  • Debugging over the network
Write a Comment
User Comments (0)
About PowerShow.com