Kernel Implementations I. 27 June 2013 OSU CSE 1

Similar documents
Kernel Implementations III. 6 May 2013 OSU CSE 1

Java Interfaces. 6 April 2016 OSU CSE 1

More About Heaps. 14 June 2017 OSU CSE 1

Array. 9 January 2015 OSU CSE 1

Set4. 8 February 2019 OSU CSE 1

CS201 - Assignment 7 Due: Wednesday April 16, at the beginning of class

CSE 373: Data Structures and Algorithms

cs Java: lecture #6

Computer Science 62. Midterm Examination

Repeated Arguments. 26 April 2013 OSU CSE 1

Types and Static Type Checking (Introducing Micro-Haskell)

Types and Static Type Checking (Introducing Micro-Haskell)

Stacks and Queues

CSE 331 Midterm Exam 2/13/12

Abstraction Functions Lecture 9 Fall 2005

Recursion is a fundamental programming technique that can provide an elegant solution certain kinds of problems. COMP Week 8 & 9 1

CMPS 240 Data Structures and Algorithms Test #2 Fall 2017 November 15

CSE 230 Computer Science II (Data Structure) Introduction

CSE143 Exam with answers Problem numbering may differ from the test as given. Midterm #2 February 16, 2001

Understanding an ADT implementation: Abstraction functions

This exam is open book. Each question is worth 3 points.

CSE373 Fall 2013, Second Midterm Examination November 15, 2013

CS24 Week 4 Lecture 2

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs.

Problem 1: Building and testing your own linked indexed list

Java Collections Framework. 24 April 2013 OSU CSE 1

Stacks and Queues. Gregory D. Weber. CSCI C243 Data Structures

Interfaces & Generics

Lecture 3: Queues, Testing, and Working with Code

Queue Implemented with a CircularArray. Queue Implemented with a CircularArray. Queue Implemented with a CircularArray. Thursday, April 25, 13

INSTITUTE OF AERONAUTICAL ENGINEERING

Object Oriented Programming

Basic Data Structures

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

Examination Questions Midterm 1

Where does the insert method place the new entry in the array? Assume array indexing starts from 0(zero).

Lecture 2: Implementing ADTs

Basic Data Structures 1 / 24

PA3 Design Specification

AS COMPUTERS AND THEIR USER INTERFACES have become easier to use,

CS161: Introduction to Computer Science Homework Assignment 10 Due: Monday 11/28 by 11:59pm

Linked Structures. See Section 3.2 of the text.

Computer Science 62. Bruce/Mawhorter Fall 16. Midterm Examination. October 5, Question Points Score TOTAL 52 SOLUTIONS. Your name (Please print)

if (x == 0); System.out.println( x=0 ); if (x = 0) System.out.println( x=0 );

XMLTree Model. 5 May 2016 OSU CSE 1

CSE 331 Midterm Exam Sample Solution 2/13/12

CSE 373: Homework 1. Queues and Testing Due: April 5th, 11:59 PM to Canvas

CISC-124. This week we continued to look at some aspects of Java and how they relate to building reliable software.

TypeScript. Types. CS144: Web Applications

8.1 Model building, verification, and validation

09/08/2017 CS2530 INTERMEDIATE COMPUTING 9/8/2017 FALL 2017 MICHAEL J. HOLMES UNIVERSITY OF NORTHERN IOWA TODAY S TOPIC: Exceptions and enumerations.

Conditions, logical expressions, and selection. Introduction to control structures

double d0, d1, d2, d3; double * dp = new double[4]; double da[4];

ARIZONA CTE CAREER PREPARATION STANDARDS & MEASUREMENT CRITERIA SOFTWARE DEVELOPMENT,

Stacks and Queues. David Greenstein Monta Vista

Papers we love - Utrecht

Objects and Classes -- Introduction

Objects and Iterators

CPSC 221: Algorithms and Data Structures Lecture #1: Stacks and Queues

Programming in Haskell Aug-Nov 2015

Dynamic Data Structures

Outline. 1 Hashing. 2 Separate-Chaining Symbol Table 2 / 13

CS18000: Programming I

Motivation was to facilitate development of systems software, especially OS development.

EINDHOVEN UNIVERSITY OF TECHNOLOGY

Ruby: Introduction, Basics

Lecture 2: Stacks and Queues

FINAL EXAMINATION. COMP-250: Introduction to Computer Science - Fall 2010

Data Structure. Recitation VII

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures

Object Oriented Programming and Design in Java. Session 19 Instructor: Bert Huang

CSCI 200 Lab 4 Evaluating infix arithmetic expressions

CORK INSTITUTE OF TECHNOLOGY INSTITIÚID TEICNEOLAÍOCHTA CHORCAÍ. Electrical and Electronic Engineering

Activity 6: Loops. Content Learning Objectives. Process Skill Goals

Linked Lists

! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive)

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #23 Loops: Precedence of Operators

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

Computer Science First Exams Pseudocode Standard Data Structures Examples of Pseudocode

CS 206 Introduction to Computer Science II

CISC 323 Intro to Software Engineering

Inheritance and Polymorphism

Motivation was to facilitate development of systems software, especially OS development.

Topic 2. Collections

Queues. CITS2200 Data Structures and Algorithms. Topic 5

Data Abstraction and Specification of ADTs

CSE 143: Computer Programming II Spring 2015 HW7: 20 Questions (due Thursday, May 28, :30pm)

How can we improve this? Queues 6. Topological ordering: given a sequence of. should occur prior to b, provide a schedule. Queues 5.

COS 226 Algorithms and Data Structures Fall Midterm

Universal Game Controller

Compsci 290/Mobile, Java

l Determine if a number is odd or even l Determine if a number/character is in a range - 1 to 10 (inclusive) - between a and z (inclusive)

Java Classes - Using your classes. How the classes you write are being used

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide

Activity 6: Loops. Content Learning Objectives. Process Skill Goals

Pieter van den Hombergh Thijs Dorssers Richard van den Ham. May 17, 2018

CSE332 Summer 2012 Final Exam, August 15, 2012

Enums. In this article from my free Java 8 course, I will talk about the enum. Enums are constant values that can never be changed.

Semantics of programming languages

Mobile Game Programming

Transcription:

Kernel Implementations I 27 June 2013 OSU CSE 1

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? 27 June 2013 OSU CSE 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? Of course not! What s really inside the computer, then, that makes bowling-like behavior? 27 June 2013 OSU CSE 3

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

A Useful Metaphor 27 June 2013 OSU CSE 5

A Tower of Abstractions Bowling pins? Vectors? Numbers? Bits? Voltages? Electrons???? 27 June 2013 OSU CSE 6

A Tower of Abstractions Bowling pins? Vectors? Numbers? Bits? Voltages? Electrons???? These are all just mathematical models, i.e., abstractions used to explain and predict behavior. 27 June 2013 OSU CSE 7

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

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

A Tower of Abstractions Bowling pins Vectors Numbers Bits Voltages Electrons??? 27 June 2013 OSU CSE 10

A Tower of Abstractions Bowling pins Vectors Numbers Bits Voltages Electrons??? Numbers may be built on top of bits 27 June 2013 OSU CSE 11

A Tower of Abstractions Bowling pins Vectors Numbers Bits Voltages Electrons??? Bits may be built on top of voltages 27 June 2013 OSU CSE 12

A Tower of Abstractions Bowling pins Vectors Numbers Bits Voltages Electrons??? Voltages may be built on top of (?) electrons 27 June 2013 OSU CSE 13

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 higherlevel value 27 June 2013 OSU CSE 14

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

A Tower of Abstractions Bowling pins Vectors Numbers Bits Voltages Electrons??? (Configurations of) voltages may be interpreted as bits 27 June 2013 OSU CSE 16

A Tower of Abstractions Bowling pins Vectors Numbers Bits Voltages Electrons??? (Configurations of) electrons may be interpreted as voltages 27 June 2013 OSU CSE 17

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 27 June 2013 OSU CSE 18

Detailed Example: Queue1L What existing components (including builtin 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? 27 June 2013 OSU CSE 19

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

Context of Queue1L newinstance clear transferfrom constructor enqueue dequeue length iterator Standard extends QueueKernel extends Queue extends Iterable Object implements QueueSecondary extends Queue1L extends 27 June 2013 OSU CSE 21

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) 27 June 2013 OSU CSE 22

Instance Variables 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. 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) 27 June 2013 OSU CSE 23

Let s Look at Queue1L.java 27 June 2013 OSU CSE 24

Other Representations? Is there any other way to use a java.util.list to represent an object value of type Queue? 27 June 2013 OSU CSE 25

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? 27 June 2013 OSU CSE 26

Resources OSU CSE Components API: Queue http://cse.osu.edu/software/common/doc/ 27 June 2013 OSU CSE 27