kernel implementations i
play

Kernel Implementations I 15 January 2019 OSU CSE 1 So, Whats - PowerPoint PPT Presentation

Kernel Implementations I 15 January 2019 OSU CSE 1 So, Whats Inside the Computer? Consider any popular video game, e.g., Nintendo Wii bowling Are there bowling balls and bowling pins inside the game consoles computer? 15


  1. Kernel Implementations I 15 January 2019 OSU CSE 1

  2. So, What’s Inside the Computer? • Consider any popular video game, e.g., Nintendo Wii bowling • Are there bowling balls and bowling pins inside the game console’s computer? 15 January 2019 OSU CSE 2

  3. So, What’s Inside the Computer? • Consider any popular video game, e.g., Nintendo Wii bowling • Are there bowling balls and bowling pins inside the game console’s computer? – Of course not! • What’s really inside the computer, then, that makes bowling-like behavior? 15 January 2019 OSU CSE 3

  4. So, What’s Inside the Computer? A thought experiment: • Consider any popular video game, e.g., What dynamic behavior would you see if you had a Nintendo Wii bowling magical magnifying glass • Are there bowling balls and bowling pins and could see inside the inside the game console computer? computer at any level of detail while it’s running? – Of course not! • What’s really inside the computer, then, that makes bowling-like behavior? 15 January 2019 OSU CSE 4

  5. A Useful Metaphor 15 January 2019 OSU CSE 5

  6. A Tower of Abstractions • Bowling pins? • Vectors? • Numbers? • Bits? • Voltages? • Electrons? • ??? 15 January 2019 OSU CSE 6

  7. A Tower of Abstractions • Bowling pins? • Vectors? These are all “just” • Numbers? mathematical models , i.e., abstractions used to explain • Bits? and predict behavior. • Voltages? • Electrons? • ??? 15 January 2019 OSU CSE 7

  8. A Tower of Abstractions • Bowling pins? • Vectors? • Numbers? • Bits? • Voltages? Domain: Physics • Electrons? These models are supposed to match physical reality, and • ??? are discarded if they do not; limited by the physical world. 15 January 2019 OSU CSE 8

  9. A Tower of Abstractions Domain: Computing • Bowling pins? These models are entirely artificial (need not match • Vectors? physical reality); limited only • Numbers? by the creativity of the software engineer. • Bits? • Voltages? • Electrons? • ??? 15 January 2019 OSU CSE 9

  10. A Tower of Abstractions • Bowling pins • Vectors • Numbers • Bits • Voltages • Electrons • ??? 15 January 2019 OSU CSE 10

  11. A Tower of Abstractions • Bowling pins • Vectors Numbers may be built on • Numbers top of bits… • Bits • Voltages • Electrons • ??? 15 January 2019 OSU CSE 11

  12. A Tower of Abstractions • Bowling pins • Vectors • Numbers Bits may be built on top • Bits of voltages… • Voltages • Electrons • ??? 15 January 2019 OSU CSE 12

  13. A Tower of Abstractions • Bowling pins • Vectors • Numbers • Bits Voltages may be built on • Voltages top of (?) electrons… • Electrons • ??? 15 January 2019 OSU CSE 13

  14. Interpretation of Representation • Let’s not take the tower-building metaphor too far! • A better approach is to think about interpreting a lower-level configuration (a.k.a. a representation ) to get a higher- level value 15 January 2019 OSU CSE 14

  15. A Tower of Abstractions • Bowling pins • Vectors (Configurations of) bits may be interpreted • Numbers as numbers... • Bits • Voltages • Electrons • ??? 15 January 2019 OSU CSE 15

  16. A Tower of Abstractions • Bowling pins • Vectors • Numbers (Configurations of) voltages may be • Bits interpreted as bits… • Voltages • Electrons • ??? 15 January 2019 OSU CSE 16

  17. A Tower of Abstractions • Bowling pins • Vectors • Numbers • Bits (Configurations of) electrons may be • Voltages interpreted as voltages… • Electrons • ??? 15 January 2019 OSU CSE 17

  18. First Example: QueueKernel • For QueueKernel , one idea is to represent a Queue variable’s value by using a java.util.List variable • By convention (of the OSU CSE components), a kernel class that directly represents the new type using a component from the Java libraries that is very similar, has a name ending in “ L ” – In this case, it is called Queue1L 15 January 2019 OSU CSE 18

  19. Detailed Example: Queue1L • What existing components (including built- in types of Java, and the Java libraries) could you build it on top of? – In other words, what could you use as a data representation that could be interpreted as a Queue value? 15 January 2019 OSU CSE 19

  20. Context of Queue1L Standard Iterable extends extends Has bodies for the QueueKernel constructor, plus the 7 extends methods from Standard and QueueKernel . Queue Object implements extends QueueSecondary extends Queue1L 15 January 2019 OSU CSE 20

  21. Context of Queue1L newInstance clear Standard Iterable transferFrom extends extends constructor QueueKernel enqueue dequeue extends length iterator Queue Object implements extends QueueSecondary extends Queue1L 15 January 2019 OSU CSE 21

  22. Instance Variables • Each separate Queue1L object has its own distinct java.util.List variable that represents its object value • Note: In the code we will examine for Queue1L , there is a declaration of a private instance variable whose value is the java.util.List that represents one Queue1L object (namely, this ) 15 January 2019 OSU CSE 22

  23. Instance Variables The adjective instance means • Each separate Queue1L object has its there is a distinct variable (with the own distinct java.util.List variable same name) for each instance (i.e., each distinct object) of the class in that represents its object value which it is declared. • Note: In the code we will examine for Queue1L , there is a declaration of a private instance variable whose value is the java.util.List that represents one Queue1L object (namely, this ) 15 January 2019 OSU CSE 23

  24. Let’s Look at Queue1L.java 15 January 2019 OSU CSE 24

  25. Other Representations? • Is there any other way to use a java.util.List to represent an object value of type Queue ? 15 January 2019 OSU CSE 25

  26. Other Representations? • Is there any other way to use a java.util.List to represent an object value of type Queue ? • Yes! – What if you simply thought of the front of the Queue as being at the right end of the java.util.List rather than the left? – How would the code change with this “reversed” interpretation? 15 January 2019 OSU CSE 26

  27. Resources • OSU CSE Components API: Queue – http://cse.osu.edu/software/common/doc/ 15 January 2019 OSU CSE 27

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend