COS318 Lec 21 Operating System Structures Vivek Pai Princeton University.

Slides:



Advertisements
Similar presentations
Chapter 2 (cont.) An Introduction to the 80x86 Microprocessor Family Objectives: The different addressing modes and instruction types available The usefulness.
Advertisements

MICROPROCESSORS TWO TYPES OF MODELS ARE USED :  PROGRAMMER’S MODEL :- THIS MODEL SHOWS FEATURES, SUCH AS INTERNAL REGISTERS, ADDRESS,DATA & CONTROL BUSES.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#3) By Dr. Syed Noman.
COS318 Lec 21 Operating System Structures Vivek Pai Princeton University.
Intel MP.
Lect 3: Instruction Set and Addressing Modes. 386 Instruction Set (3.4) –Basic Instruction Set : 8086/8088 instruction set –Extended Instruction Set :
Operating Systems: Segments 1 Segmentation Hardware Support single user program system: – wish somehow to relocate address 0 to after operating system.
1 Operating Systems and Protection CS Goals of Today’s Lecture How multiple programs can run at once  Processes  Context switching  Process.
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
PC hardware and x86 3/3/08 Frans Kaashoek MIT
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Assembly Language Advantages 1. It reveals the secret of your computer’s hardware and software. 2. Speed. 3. Some special applications and occasions. Disadvantages.
OS Spring’03 Introduction Operating Systems Spring 2003.
ICS312 Set 3 Pentium Registers. Intel 8086 Family of Microprocessors All of the Intel chips from the 8086 to the latest pentium, have similar architectures.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 2: 80386DX Internal Architecture & Data Organization.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
Administrative Overview 6 Projects Design Review: Monday before 6:30pm Lab Friend Center 010 (“Fishbowl”)
Lect 4: Instruction Set and Addressing Modes. 386 Instruction Set (3.4)  Basic Instruction Set : 8086/8088 instruction set  Extended Instruction Set.
1 Input/Output. 2 Principles of I/O Hardware Some typical device, network, and data base rates.
1 CS503: Operating Systems Part 1: OS Interface Dongyan Xu Department of Computer Science Purdue University.
Host and Application Security Lesson 4: The Win32 Boot Process.
By the end of this lesson you will be able to explain: 1. What is the BOOT process 2. A Cold Boot 3. A Warm Boot.
6.828: PC hardware and x86 Frans Kaashoek
CS Fall 2011 CS 423 – Operating Systems Design Lecture 2 – Concepts Review Klara Nahrstedt Fall 2011.
1 CS503: Operating Systems Spring 2014 Dongyan Xu Department of Computer Science Purdue University.
1 Operating System Overview. 2 Today’s Objectives Explain the main purpose of operating systems and describe milestones of OS evolution Explain fundamental.
1 Fundamental of Computer Suthida Chaichomchuen : SCC
Fall 2012 Chapter 2: x86 Processor Architecture. Irvine, Kip R. Assembly Language for x86 Processors 6/e, Chapter Overview General Concepts IA-32.
Chapter 2 Instruction Addressing and Execution. Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
SAPC Hardware Pentium CPU (or 486) 4M usable memory no hard disk; boot from floppy no keyboard or monitor or mouse COM2 serial port: used for console i/o.
CET 3510 Microcomputer Systems Tech. Lecture 2 Professor: Dr. José M. Reyes Álamo.
1 ICS 51 Introductory Computer Organization Fall 2009.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
Copyright ©: University of Illinois CS 241 Staff1 Operating Systems Orientation.
ECE291 Lecture 1 All about computers. ECE 291 Lecture 1Page 2 of 41 Lecture outline Top-down view of computers Processor architecture RegistersMemoryPeripherals.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
Copyright ©: Nahrstedt, Angrave, Abdelzaher1 Operating System Overview Tarek Abdelzaher Lawrence Angrave Vikram Adve.
X86 Assembly Language We will be using the nasm assembler (other assemblers: MASM, as, gas)
10. Epilogue ENGI 3655 Lab Sessions.  We took control of the computer as early as possible, right after the end of the BIOS  Our multi-stage bootloader.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
1 x86 Programming Model Microprocessor Computer Architectures Lab Components of any Computer System Control – logic that controls fetching/execution of.
Week 6 Dr. Muhammad Ayaz Intro. to Assembly Language.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
BITS Pilani Pilani Campus Pawan Sharma Lecture / ES C263 INSTR/CS/EEE F241 Microprocessor Programming and Interfacing.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Chapter 2 Instruction Addressing and Execution. Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts.
Precept 7: Introduction to IA-32 Assembly Language Programming
Introduction to Operating Systems Concepts
Chapter Overview General Concepts IA-32 Processor Architecture
Operating System Overview
Homework Reading Lab with your assigned section starts next week
Assembly language.
Programming the I/O Hardware
Computer Organization & Assembly Language Chapter 3
Overview of today’s lecture
Basic Microprocessor Architecture
Homework Reading Continue work on mp1
BIC 10503: COMPUTER ARCHITECTURE
Programming the I/O Hardware
8086 Registers Module M14.2 Sections 9.2, 10.1.
SAPC Hardware Pentium CPU (or 486) 4M usable memory
CS 301 Fall 2002 Computer Organization
The Microprocessor & Its Architecture
Assembly Language (CSW 353)
Computer Architecture CST 250
Introduction and Overview
Presentation transcript:

COS318 Lec 21 Operating System Structures Vivek Pai Princeton University

COS318 Lec 22 Gedankenexperiment What does this program do? static void Loop(void) { static char *startAddr; char local; printf(“diff is %d\n”, startAddr – (&local)); startAddr = &local; Loop( ); } int main(int argc, char *argv[ ]) { Loop( ); }

COS318 Lec 23 Mechanics Have you: Subscribed to pu.cs.318? Sent me mail with your details? –Hey, it was an assignment after all… Sent me a picture of yourself?

COS318 Lec 24 More Mechanics Syllabus is now “complete”, along with goals for each lecture Preparatory readings are listed –External readings are not yet included Projects are being finalized –Regular lab not yet operational How do we want to handle quizzes? –Scheduled or random?

COS318 Lec 25 Reading Assignment Sections inclusive Keep up with what’s on home page I’ll try to remember to remind you

COS318 Lec 26 A Typical Computer from a Hardware Point of View CPU ChipsetMemory I/O bus CPU... Network

COS318 Lec 27 A Typical Computer System Operating System Software Programs and data Memory CPU OS Apps Data Network

COS318 Lec 28 Typical Unix OS Structure Application Portable OS Layer Libraries Machine-dependent layer User space/level Kernel space/level

COS318 Lec 29 Typical Unix OS Structure Application Portable OS Layer Libraries Machine-dependent layer Written by programmer Compiled by programmer Uses function calls

COS318 Lec 210 Typical Unix OS Structure Application Portable OS Layer Libraries Machine-dependent layer Written by elves Provided pre-compiled Defined in headers Input to linker (compiler) Invoked like functions May be “resolved” when program is loaded

COS318 Lec 211 Typical Unix OS Structure Application Portable OS Layer Libraries Machine-dependent layer “Guts” of system calls All “high-level” code

COS318 Lec 212 Typical Unix OS Structure Application Portable OS Layer Libraries Machine-dependent layer Bootstrap System initialization Interrupt and exception I/O device driver Memory management Kernel/user mode switching Processor management

COS318 Lec 213 Another Look: Unix “Onion” Applications OS Service Device Driver Hardware User and Kernel boundary

COS318 Lec 214 What’s An Application? Four parts (“segments”) Code/Text – instructions Data – initialized global variables Stack Heap What’s a stack and heap?

COS318 Lec 215 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 won’t 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

COS318 Lec 216 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 CPUI/OCPU I/O CPU I/O CPU

COS318 Lec 217 Memory Management Goals –Support programs to run –Allocation and management –Transfers from and to secondary storage Issues –Efficiency & convenience –Fairness –Protection Tape 100Mx Disk 10Mx Memory 200x L2 10x Register

COS318 Lec 218 x86 Architecture Registers General-purpose registers Segment registers EFLAGS registerEIP (Instruction Pointer register) EAX EBX ECX EDX EBP ESI EDI ESP CS DS SS ES FS GS AX BX CX DX 16-bit 32-bit DI SI BP SP AL AH BL CL DL BH CH DH 8 715

COS318 Lec 219 x86 Memory Byte order is little endian Byte 4 Byte 0 Byte 5 Byte 1Byte 2 Byte 6 Byte 3 Byte 7

COS318 Lec 220 I/O Device Management Goals –Interactions between devices and applications –Ability to plug in new devices Issues –Efficiency –Fairness –Protection and sharing User 1User n... Library support I/O device I/O device... Driver

COS318 Lec 221 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

COS318 Lec 222 File System 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? User 1User n... File system services File...

COS318 Lec 223 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 OS sector 1 OS sector 2 OS sector n Boot loader

COS318 Lec 224 System Boot Power on (processor waits until Power Good Signal) Processor jumps on a PC (“Intel Inside”) to address FFFF0h 1M= 1,048,576= 2 20 =FFFFFh+1 FFFFFh=FFFF0h+16 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 Maps to FFFFFFF0h=

COS318 Lec 225 ROM BIOS startup program (1) POST (Power-On Self-Test) If pass then AX:=0; DH:=5 (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 SCSI disks: must often provide their own BIOS

COS318 Lec 226 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

COS318 Lec 227 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?

COS318 Lec 228 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