3/31/21
ESE150 Spring 2021
OBSERVATION
Ò We want our phones (and computers) to do many things at once. Ò If we dedicate a processor to MP3 decoding
É It will sit idle most of the time Ò MP3 decoding (and many other things) do not consume a modern processor
Lecture #18 – Operating Systems (OS) Ò Idea: Maybe we can share the processor among ESE 150 – tasks? DIGITAL AUDIO BASICS ESE150 Spring 2021 Based on slides © 2009--2021 DeHon 1 2
ESE150 Spring 2021 ESE150 Spring 2021
BIG IDEA OUTLINE
Ò Provide the illusion of (virtually) unlimited Ò Review processors by sharing single processor in time Ò Worksheet: Virtualization In Action Ò Strategy
É Time-share processor Ð Store all process (virtual processors) state in memory Ð Iterate through processes
× Restore process state × Run for a number of cycles × Save process state
3 4
ESE150 Spring 2021 ESE150 Spring 2021
COURSE MAP – WEEK 10 ROLE OF OPERATING SYSTEM MIC
Ò Higher-level, shared support for all programs A/D É Could put it in program, but most programs need it! É Needs to be abstracted from program Music 1 domain conversion 5,6 compress Ò Resource sharing Numbers É Processor, memory, “devices” (net, printer, audio) correspond to pyscho- course weeks sample freq Ò acoustics 3 Polite sharing 2 4 É Isolation and protection
EULA É Fences make Good Neighbors – R. Frost ------D/A 10101001101 ------Ò Idea: Expensive/limited resources can be shared in click time – OS manages this sharing OK speaker MP3 Player / iPhone / Droid 5 6
1 3/31/21
ESE150 Spring 2021 ESE150 Spring 2021
IDEA
Ò Virtualize the processor É Make it look like we have multiple processors É With each program running on its own processor VIRTUALIZATION Ò “Own” processor É Can put data in memory where it wants É Doesn’t have to worry about another program scribbling over its memory É Its state is preserved and isolated É Looks like it runs all the time on the processor
Ð Doesn’t need to be programmed to allow other programs to run
7 8
ESE150 Spring 2021 ESE150 Spring 2021
KEY IDEA MMEMORYEMORYSSAVEAVE/R/RESTOREESTORE
Ò Can capture state of a processor É All the information that defines the current point in the computation É i.e. program counter, data and instruction memory Ò Can save that in memory É A different memory from what the process sees É (could be different range of addresses) Ò Fully represents the running program Ò Can restore that from memory to the processor Ò Can save/restore without affecting the functional behavior of the program
9 10
ESE150 Spring 2021 ESE150 Spring 2021
MMEMORYEMORYSSAVEAVE/R/RESTOREESTORE MEMORY SAVE/RESTORE
Save
11 12
2 3/31/21
ESE150 Spring 2021 ESE150 Spring 2021
MEMORY SAVE/RESTORE MEMORY SAVE/RESTORE Restore Restore
13 14
ESE150 Spring 2021 ESE150 Spring 2021
SHARING PROCESSOR
Ò Now that we can save/restore the state Ò Can share processor among processes Worksheet Exercise É (Restore state; run for time; save state) Ò Isolation: none of the processes need to know DEMONSTRATION about each other
É Each thinks it has the a whole machine É Just need to restore/save state around epochs where the process gets to run on the processor
15 16
ESE150 Spring 2021 ESE150 Spring 2021
WORKSHEET: EXECUTION EXERCISE EXECUTION EXERCISE
Ò We’re going to simulate the computer and Ò Google Doc – simulate A for 12 cycles watch the processor state
17 19
3 3/31/21
ESE150 Spring 2021 ESE150 Spring 2021
SIMULATE SWAPPING SIMULATE SWAPPING
Ò Imagine we ran A for 6 cycles (and saved state) Ò Simulate B for 6 cycles Ò Swap and Run B for 6 cycles É Individually Ò Swap and Run A for next 6 cycles Ò What get?
É What should we get? Ò Swap and Run B for next 6 cycles
20 21
ESE150 Spring 2021 ESE150 Spring 2021
SIMULATE SWAPPING SIMULATE SWAPPING
Ò Swap in A+6 and Simulate for 6 cycles (to 12) Ò Swap in B+6 and Simulate for 6 cycles (to 12) É individually É individually Ò What get? Ò What get?
22 23
ESE150 Spring 2021 ESE150 Spring 2021
SIMULATE SWAPPING REVIEW: KEY IDEA
Ò Can capture state of a processor Ò Imagine we ran A for 6 cycles (and saved state) É All the information that defines the current point in the Ò Swap and Run B for 6 cycles computation (PC, data and instruction mem) Ò Swap and Run A for next 6 cycles Ò Can save that in memory É A different memory from what the process sees É What should we get? É (could be different range of addresses) Ò Swap and Run B for next 6 cycles Ò Fully represents the running program Ò Can restore that from memory to the processor Ò Can save/restore without affecting the functional behavior of the program Ò Time-share processor à pretend have unlimited number 24 25
4 3/31/21
ESE150 Spring 2021 ESE150 Spring 2021 IPOD PROCESSOR
Ò Early based on PortalPlayer series MEDIA PROCESSORS É Two ARM7TDMI cores É 80MHz each Ò Guesses are ARM7 or ARM8
26 27
Penn ESE532 Fall 2020-- DeHon ESE150 Spring 2021
APPLE A13 BIONIC BIG IDEAS
2 Ò 98mm , 7nm Ò 8.5 Billion Tr. Ò Virtualize hardware Ò iPhone 11 + É Identify state; save/restore from memory Ò 6 ARM cores Ò Program view: owns complete machine É 2 fast (2.6GHz) Ò Allows programs to share limited physical É 4 low energy hardware (e.g. processor) Ò 4 custom GPUs É Provide illusion of unlimited hardware Ò Neural Engine Ò Operating System is the program that É 5 Trillion ops/s? manages this sharing
28 29
ESE150 Spring 2021 ESE150 Spring 2021
LEARN MORE REMINDERS
Ò CIS380 – Operating Systems Ò Feedback Ò Lab9 due on Friday
30 31
5