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

kernel implementations i
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Kernel Implementations I

15 January 2019 OSU CSE 1

slide-2
SLIDE 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

slide-3
SLIDE 3
  • 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

So, What’s Inside the Computer?

slide-4
SLIDE 4
  • Consider any popular video game, e.g.,

Nintendo Wii bowling

  • Are there bowling balls and bowling pins

inside the game console computer?

– Of course not!

  • What’s really inside the computer, then,

that makes bowling-like behavior?

15 January 2019 OSU CSE 4

A thought experiment: What dynamic behavior would you see if you had a magical magnifying glass and could see inside the computer at any level of detail while it’s running?

So, What’s Inside the Computer?

slide-5
SLIDE 5

A Useful Metaphor

15 January 2019 OSU CSE 5

slide-6
SLIDE 6

A Tower of Abstractions

  • Bowling pins?
  • Vectors?
  • Numbers?
  • Bits?
  • Voltages?
  • Electrons?
  • ???

15 January 2019 OSU CSE 6

slide-7
SLIDE 7

A Tower of Abstractions

  • Bowling pins?
  • Vectors?
  • Numbers?
  • Bits?
  • Voltages?
  • Electrons?
  • ???

15 January 2019 OSU CSE 7

These are all “just” mathematical models, i.e., abstractions used to explain and predict behavior.

slide-8
SLIDE 8

A Tower of Abstractions

  • Bowling pins?
  • Vectors?
  • Numbers?
  • Bits?
  • Voltages?
  • Electrons?
  • ???

15 January 2019 OSU CSE 8

Domain: Physics These models are supposed to match physical reality, and are discarded if they do not; limited by the physical world.

slide-9
SLIDE 9

A Tower of Abstractions

  • Bowling pins?
  • Vectors?
  • Numbers?
  • Bits?
  • Voltages?
  • Electrons?
  • ???

15 January 2019 OSU CSE 9

Domain: Computing These models are entirely artificial (need not match physical reality); limited only by the creativity of the software engineer.

slide-10
SLIDE 10

A Tower of Abstractions

  • Bowling pins
  • Vectors
  • Numbers
  • Bits
  • Voltages
  • Electrons
  • ???

15 January 2019 OSU CSE 10

slide-11
SLIDE 11

A Tower of Abstractions

  • Bowling pins
  • Vectors
  • Numbers
  • Bits
  • Voltages
  • Electrons
  • ???

15 January 2019 OSU CSE 11

Numbers may be built on top of bits…

slide-12
SLIDE 12

A Tower of Abstractions

  • Bowling pins
  • Vectors
  • Numbers
  • Bits
  • Voltages
  • Electrons
  • ???

15 January 2019 OSU CSE 12

Bits may be built on top

  • f voltages…
slide-13
SLIDE 13

A Tower of Abstractions

  • Bowling pins
  • Vectors
  • Numbers
  • Bits
  • Voltages
  • Electrons
  • ???

15 January 2019 OSU CSE 13

Voltages may be built on top of (?) electrons…

slide-14
SLIDE 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

slide-15
SLIDE 15

A Tower of Abstractions

  • Bowling pins
  • Vectors
  • Numbers
  • Bits
  • Voltages
  • Electrons
  • ???

15 January 2019 OSU CSE 15

(Configurations of) bits may be interpreted as numbers...

slide-16
SLIDE 16

A Tower of Abstractions

  • Bowling pins
  • Vectors
  • Numbers
  • Bits
  • Voltages
  • Electrons
  • ???

15 January 2019 OSU CSE 16

(Configurations of) voltages may be interpreted as bits…

slide-17
SLIDE 17

A Tower of Abstractions

  • Bowling pins
  • Vectors
  • Numbers
  • Bits
  • Voltages
  • Electrons
  • ???

15 January 2019 OSU CSE 17

(Configurations of) electrons may be interpreted as voltages…

slide-18
SLIDE 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

slide-19
SLIDE 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

slide-20
SLIDE 20

Context of Queue1L

15 January 2019 OSU CSE 20

Queue Queue1L implements QueueKernel extends QueueSecondary extends Object extends Standard extends

Has bodies for the constructor, plus the 7 methods from Standard and QueueKernel.

Iterable extends

slide-21
SLIDE 21

Context of Queue1L

15 January 2019 OSU CSE 21

Queue Queue1L implements QueueKernel extends QueueSecondary extends Object extends Standard extends Iterable extends newInstance clear transferFrom constructor enqueue dequeue length iterator

slide-22
SLIDE 22

Instance Variables

  • Each separate Queue1L object has its
  • wn 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

  • ne Queue1L object (namely, this)

15 January 2019 OSU CSE 22

slide-23
SLIDE 23

Instance Variables

  • Each separate Queue1L object has its
  • wn 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

  • ne Queue1L object (namely, this)

15 January 2019 OSU CSE 23

The adjective instance means there is a distinct variable (with the same name) for each instance (i.e., each distinct object) of the class in which it is declared.

slide-24
SLIDE 24

Let’s Look at Queue1L.java

15 January 2019 OSU CSE 24

slide-25
SLIDE 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

slide-26
SLIDE 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

slide-27
SLIDE 27

Resources

  • OSU CSE Components API: Queue

– http://cse.osu.edu/software/common/doc/

15 January 2019 OSU CSE 27