DOC PREVIEW
CMU CS 15410 - Lecture 4 Hardware

This preview shows page 1-2-17-18-19-35-36 out of 36 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 36 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 3615-410, S’04- 1 -Hardware OverviewJan. 19, 2004Dave EckhardtDave EckhardtBruce MaggsBruce MaggsL04_Hardware15-410“Computers make very fast, very accurate mistakes.”--Brandon Long15-410, S’04- 1 -SynchronizationToday's classToday's classNot exactly Chapter 2 or 13Project 0Project 0Due tonight at midnightConsider not using a late dayCould be a valuable commodity laterRemember, this is a warm-upReliance on these skills will increase rapidlyUpcomingUpcomingProject 1Lecture on “The Process”15-410, S’04- 1 -SynchronizationPersonal Simics licensesPersonal Simics licensesSimics machine-simulator software is licensedWe have enough “seats” for the classShould work on most CMU-network machinesWill not work on most non-CMU-network machinesOptionsCMU “Address extension” service (non-encrypted VPN)“Personal academic license” for a personal Linux box»locked to your personal machine (MAC address)»apply at www.simics.net (top right of page)15-410, S’04- 1 -SynchronizationSimics on Windows?Simics on Windows?Simics simulator itself is available for Windows15-410 build/debug infrastructure is notOptionsOptionsDual-boot, VMwareUsability via X depends on network latencyPort to cygwin (may be non-trivial)There are those Andrew cluster machines...15-410, S’04- 1 -OutlineComputer hardwareComputer hardwareCPU StateCPU StateFairy tales about system callsFairy tales about system callsCPU context switch (intro)CPU context switch (intro)Interrupt handlersInterrupt handlersInterrupt maskingInterrupt maskingSample hardware device – countdown timerSample hardware device – countdown timer15-410, S’04- 1 -Inside The Box - Historical/LogicalCPUMemoryGraphicsEthernetIDEFloppyUSB15-410, S’04- 1 -Inside The Box - ReallyCPUMemoryAGP GraphicsIDEFloppyUSBNorth BridgeSouth BridgePCIEthernetSCSI15-410, S’04- 1 -CPU StateUser registers (on Planet Intel)User registers (on Planet Intel)General purpose - %eax, %ebx, %ecx, %edxStack Pointer - %espFrame Pointer - %ebpMysterious String Registers - %esi, %edi15-410, S’04- 1 -CPU StateNon-userNon-user registers, a.k.a.... registers, a.k.a....Processor status register(s)Processor status register(s)Currently running: user code / kernel code?Interrupts on / ofVirtual memory on / ofMemory modelsmall, medium, large, purple, dinosaur15-410, S’04- 1 -CPU StateFloating Point Number registersFloating Point Number registersLogically part of “User registers”Sometimes another “special” set of registersSome machines don't have floating pointSome processes don't use floating point15-410, S’04- 1 -Story time!Time for some fairy talesTime for some fairy talesThe getpid() story (shortest legal fairy tale)The read() story (toddler version)The read() story (grade-school version)15-410, S’04- 1 -The Story of getpid()User process is computingUser process is computingUser process calls getpid() library routineLibrary routine executes TRAP(314159)The world changesThe world changesSome registers dumped into memory somewhereSome registers loaded from memory somewhereThe processor has The processor has entered kernel modeentered kernel mode15-410, S’04- 1 -User ModeOperatingSystemProcess 1Process 2CPU15-410, S’04- 1 -Entering Kernel ModeOperatingSystemProcess 1Process 2CPUsave15-410, S’04- 1 -Entering Kernel ModeOperatingSystemProcess 1Process 2CPUEthernetIDEFloppyUSB15-410, S’04- 1 -The Kernel Runtime EnvironmentLanguage runtimes diferLanguage runtimes diferML: no stack, “nothing but heap”C: stack-basedProcessor is more-or-less agnosticProcessor is more-or-less agnosticSome assume/mandate a stackTrap handler builds kernel runtime environmentTrap handler builds kernel runtime environmentDepending on processorDepending on processorSwitches to correct stackSaves registersTurns on virtual memoryFlushes caches15-410, S’04- 1 -The Story of getpid()Process in kernel modeProcess in kernel moderunning->u_reg[R_EAX] = running->u_pid;Return from interruptReturn from interruptProcessor state restored to user mode(modulo %eax)User process returns to computingUser process returns to computingLibrary routine returns %eax as value of getpid()15-410, S’04- 1 -Returning to User ModeOperatingSystemProcess 1Process 2CPUrestore15-410, S’04- 1 -The Story of getpid()What's the getpid() system call?What's the getpid() system call?C function you call to get your process ID“Single instruction” which modifies %eaxPrivileged code which can access OS internal state15-410, S’04- 1 -A Story About read()User process is computingUser process is computingcount = read(7, buf, sizeof (buf));User process “goes to sleep”User process “goes to sleep”Operating system issues disk readOperating system issues disk readTime passesTime passesOperating system copies dataOperating system copies dataUser process “wakes up”User process “wakes up”15-410, S’04- 1 -Another Story About read()P1: read()P1: read()Trap to kernel modeKernel: tell disk: “read sector 2781828”Kernel: tell disk: “read sector 2781828”Kernel: switch to running P2Kernel: switch to running P2Return to user mode - but to P2, not P1!P1 is “blocked in system call”Part-way through driver codeMarked “unable to execute more instructions”P2: compute 1/3 of Mandelbrot setP2: compute 1/3 of Mandelbrot set15-410, S’04- 1 -Another Story About read()Disk: done!Disk: done!Asserts “interrupt request” signalInterrupt to kernel modeRun “disk interrupt handler” codeKernel: switch to P1Kernel: switch to P1Return from interrupt - but to P1, not P2!15-410, S’04- 1 -Interrupt Vector TableHow should CPU handle How should CPU handle this particularthis particular interrupt? interrupt?Disk interrupt  invoke disk driverMouse interrupt  invoke mouse driverNeed to knowNeed to knowWhere to dump registersoften: property of current process, not of interruptNew register values to load into CPUkey: new program counter, new status register»These define the new execution environment15-410, S’04- 1


View Full Document

CMU CS 15410 - Lecture 4 Hardware

Download Lecture 4 Hardware
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 4 Hardware and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 4 Hardware 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?