Datorteknik OperatingSystem bild 1 the Operating System (OS)

Slides:



Advertisements
Similar presentations
You have been given a mission and a code. Use the code to complete the mission and you will save the world from obliteration…
Advertisements

Process Description and Control
Advanced Piloting Cruise Plot.
Chapter 1 The Study of Body Function Image PowerPoint
Copyright © 2013 Elsevier Inc. All rights reserved.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 3 CPUs.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
My Alphabet Book abcdefghijklm nopqrstuvwxyz.
Multiplying binomials You will have 20 seconds to answer each of the following multiplication problems. If you get hung up, go to the next problem when.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Addition Facts
Year 6 mental test 10 second questions
So far Binary numbers Logic gates Digital circuits process data using gates – Half and full adder Data storage – Electronic memory – Magnetic memory –
1 Processes and Threads Creation and Termination States Usage Implementations.
ZMQS ZMQS
ABC Technology Project
Project 5: Virtual Memory
Chapter 3 Memory Management
Memory Management.
Inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 10 – Introduction to MIPS Procedures I If cars broadcast their speeds to.
VOORBLAD.
1 Breadth First Search s s Undiscovered Discovered Finished Queue: s Top of queue 2 1 Shortest path from s.
CS Spring 2014 Prelim 2 Review
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Chapter 5 Microsoft Excel 2007 Window
© 2012 National Heart Foundation of Australia. Slide 2.
Lets play bingo!!. Calculate: MEAN Calculate: MEDIAN
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Addition 1’s to 20.
25 seconds left…...
Datorteknik OperatingSystem bild 1 the Operating System (OS)
Datorteknik TopologicalSort bild 1 To verify the structure Easy to hook together combinationals and flip-flops Harder to make it do what you want.
Datorteknik VirtualMemory bild 1 Virtual Memory User memory model so far: Separate Instruction and Data memory In reality they share the same memory space.
Januar MDMDFSSMDMDFSSS
Week 1.
Datorteknik IntegerAddSub bild 1 Integer arithmetic Depends what you mean by "integer" Assume at 3-bit string. –Then we define zero = 000 one = 001 Use.
Execution Cycle. Outline (Brief) Review of MIPS Microarchitecture Execution Cycle Pipelining Big vs. Little Endian-ness CPU Execution Time 1 IF ID EX.
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Intracellular Compartments and Transport
PSSA Preparation.
Essential Cell Biology
Datorteknik TopologicalSort bild 1 To verify the structure Easy to hook together combinationals and flip-flops Harder to make it do what you want.
Immunobiology: The Immune System in Health & Disease Sixth Edition
Datorteknik DelayedBranch bild 1 Delayed Branch All problems solved? NO, what will happen if b loop add $4 $6 $1... loop sub.
Datorteknik MainMemory bild 1 Memory The programmer’s model.text,.data –user program (instruction memory) and data area.ktext,.kdata –kernel program and.
Datorteknik DataHazard bild 1 Data Hazards 0x30 sub $6 $0 $1 0x34 add $7 $6 $
Datorteknik IOControl bild 1 Input/Output Interface Address bus Data bus Control bus fffffffc Addr DE...Mem 1 Keyboard address decoder Mem n address decoder.
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
MicroComputer Engineering OperatingSystem slide 1 the Operating System (OS)
MIPS I/O and Interrupt.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
the Operating System (OS)
Input/Output Interface
Pipelining: Advanced ILP
Interrupts and Exception Handling
MIPS I/O and Interrupt.
Presentation transcript:

Datorteknik OperatingSystem bild 1 the Operating System (OS)

Datorteknik OperatingSystem bild 2 The Operating System (OS) Operating System P1: Editor P2: Compiler P3: Quake Arena MIPS At any one time the processor (MIPS) is only excecuting one program (process).

Datorteknik OperatingSystem bild 3 The Operating System (OS) Operating System P1: Editor P2: Compiler P3: Quake Arena MIPS At any one time the processor (MIPS) is only excecuting one program (process).

Datorteknik OperatingSystem bild 4 The Operating System (OS) Operating System P1: Editor P2: Compiler P3: Quake Arena MIPS At any one time the processor (MIPS) is only excecuting one program (process).

Datorteknik OperatingSystem bild 5 The Operating System (OS) Operating System P1: Editor P2: Compiler P3: Quake Arena MIPS At any one time the processor (MIPS) is only excecuting one program (process).

Datorteknik OperatingSystem bild 6 The Operating System (OS) Operating System P1: Editor P2: Compiler P3: Quake Arena MIPS At any one time the processor (MIPS) is only excecuting one program (process).

Datorteknik OperatingSystem bild 7 Our Assembler.data.kdata.text.ktext User Kernel

Datorteknik OperatingSystem bild 8 The Hardware.data.kdata.text.ktext User Kernel OK ERROR!

Datorteknik OperatingSystem bild 9 How does the User program pass control to the Operating System? Take control on ERROR Pass control explicitly

Datorteknik OperatingSystem bild 10 ERROR Ex, Arithmetical Overflow li $4 0x neg $4 $4 (sub $4 $0 $4) 0x x x Sign differs Same Sign ! ERROR

Datorteknik OperatingSystem bild 11 Signed/Unsigned Arithmetics The only difference is that –Unsigned never causes ERROR –Signed causes ERROR on Overflow etc. Signed ADD SUB ADDI.. Unsigned ADDU SUBU ADDIU..

Datorteknik OperatingSystem bild 12 Memory Error Instruction Memory = Bad PC Data Alignment Error Access Protected Memory from User mode Nonexistent Memory (Page fault Chapter 7)

Datorteknik OperatingSystem bild 13 Do not confuse ! A Memory that tells the pipeline to Wait –relate to “cache miss” A Memory Error or Page Fault –relate to “TLB miss”

Datorteknik OperatingSystem bild 14 The Consequence A Memory that tells the pipeline to Wait –Pipeline Stall A Memory Error or Page Fault –Exception

Datorteknik OperatingSystem bild 15 Pass Control Explicitly The User wants some service from the Operating System –File I/O –Graphics –Sound –Allocate Memory –Terminate Program (no HALT instruction in real MIPS) SYSCALL (causes an exception)

Datorteknik OperatingSystem bild 16 How to choose service: Is there different SYSCALLs? NO! Only one, use a register ($a0) to choose Use other registers ($a1,...) as parameters Use $v0 for result ori $a1 $r0 ‘A’ ; Char ‘A’ ori $a0 $r0 0x00 ; Write Char syscall ori $a0 $r0 0x01 ; Read Char syscall or $a1 $r0 $v0 ; Move result $v0->$a1 ori $a0 $r0 0x00 ; Echo Char syscall

Datorteknik OperatingSystem bild 17 Other ways for the Operating System to take control? External Interrupts, (not caused by User program) –Timers –Harddisk –Graphics –Sound –Keyboard, Mouse, other perhipals

Datorteknik OperatingSystem bild 18 Coprocessor CP0 8 Bad Memory Address 12 Status Register 13 Cause Register 14 Exception Address (EPC)

Datorteknik OperatingSystem bild 19 Status Register CP0 ($12) “Mode Stack” External Interrupt enable/disable

Datorteknik OperatingSystem bild 20 “Mode Stack” OLDPREVIOUSCURRENT KU IE 0 Kernel Mode 1 User Mode 0 External Interrupt Disable 1 External Interrupt Enable KU IE KU IE 5 0

Datorteknik OperatingSystem bild 21 Exception / Interrupt Occurs OLDPREVIOUSCURRENT KU IE 0 0 Kernel Mode 1 User Mode 0 External Interrupt Disable 1 External Interrupt Enable KU IE

Datorteknik OperatingSystem bild 22 RFE Instruction (priviliged) OLDPREVIOUSCURRENT KU IE ? We restore the PREVIOUS (KU,IE) into CURRENT

Datorteknik OperatingSystem bild 23 External Interrupts Bit 0, (Current Interrupt Enable) –All External Interrupts Enable/ Disable Bit , (individual interrupt enable) INT 4INT 3INT 2INT 1INT 0 Current IE INT

Datorteknik OperatingSystem bild 24 Enable External Interrupt 2 Bit 0 = 1, (External Interrupt Enabled) Bit 12 = 1, Interrupt 2 Enabled Current IE = INT 4INT 3INT 2INT 1INT 0INT

Datorteknik OperatingSystem bild 25 Cause Register (CP0 $13) Bit 5..2, Exception Cause Code Bit , Interrupt Pending Bit 31, Exception Occur In Branch Slot 10 INT 5INT 4INT 3INT 2INT 1Ex 3Ex 2Ex 1Ex 0BS INT Exception Cause Code see LSI Logic User’s Manual Pending Interrupts

Datorteknik OperatingSystem bild 26 Check if Interrupt 2 Pending Mask with bit INT 4INT 3INT 2INT 1INT 0INT 5 AND CP0 $ INT 2

Datorteknik OperatingSystem bild 27 Resume User Program CP0 $14 Holds the Exception Address (Addr to instruction in EX stage) mfc0$k0 $14; resume address jr$k0; $k0 kernel reg rfe ; “delayed branch ”

Datorteknik OperatingSystem bild 28 Shared “Stack” Assume that the User program uses the stack: Can the Kernel use the same stack ($sp)? Yes, but remember never to use memory below $sp, it will be destroyed (overwritten)!! $sp User Data Kernel Data