From High Level to Machine Code. Compilation Overview. Computer Programs

Similar documents
Introduction to Java Programming

Programming 1. Lecture 1 COP 3014 Fall August 28, 2017

Chapter 1: Introduction to Computers and Java

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

Programming 1 - Honors

Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer? A Bit of History

CMSC131. Hardware and Software. Hardware

CMSC131. Hardware and Software

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

Introduction to Computers and Java

Introduction to Computers and Java

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

CHAPTER 1 Introduction to Computers and Java

Outline. Introduction to Java. What Is Java? History. Java 2 Platform. Java 2 Platform Standard Edition. Introduction Java 2 Platform

Tutorial 1 CSC 201. Java Programming Concepts عؾادئماظربجمةمبادؿكدامماجلاصا

Computer Basics 1/6/16. Computer Organization. Computer systems consist of hardware and software.

The Computer System. Hardware = Physical Computer. Software = Computer Programs. People = End Users & Programmers. people

Introduction to JAVA Programming Language

Introduction to Computers and Programming Languages. CS 180 Sunil Prabhakar Department of Computer Science Purdue University

What is Java Platform?

The Programming Process Summer 2010 Margaret Reid-Miller

Chapter 1 Introduction to Computers, Programs, and Java

Getting Started. Chapter 1. Java Programming FROM THE BEGINNING. Chapter 1: Getting Started

Computer Basics 1/24/13. Computer Organization. Computer systems consist of hardware and software.

Chapter 1 Introduction to Computers, Programs, and Java

Software Concepts. It is a translator that converts high level language to machine level language.

9/11/08 (c) 2008 Matthew J. Rutherford Class (c) 2008 Matthew J. Rutherford Class

An Introduction to Software Engineering. David Greenstein Monta Vista High School

Introduction to Java

An Introduc+on to Computers and Java CSC 121 Spring 2017 Howard Rosenthal

Chapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams.

IT151: Introduction to Programming (java)

Operating Systems CS3502 Spring 2018

Computer Programming-1 CSC 111. Chapter 1 : Introduction

Introduction to Java. Nihar Ranjan Roy.

Principles of Programming Languages. Lecture Outline

Introduction to Computers and Java

2 Introduction to Java. Introduction to Programming 1 1

What is a VM? Categories of Virtual Machines. Process Virtual Machine 11/17/2010

History Introduction to Java Characteristics of Java Data types

Problem Solving and Program Design - Chapter 1. Cory L. Strope

Java and Software Design

assembler Machine Code Object Files linker Executable File

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

ECS15, Lecture 10. Goals of this course 2/8/13. Mini-Review & Topic 3.2 Software. Today s agenda

Advanced Object-Oriented Programming Introduction to OOP and Java

Chapter 1: Introduction to Computers, Programs, and Java

Objectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java

Topics. Operating System. What is an Operating System? Let s Get Started! What is an Operating System? Where in the Book are we?

Terminology & Basic Concepts

Chapter 1 Introduction to Computers, Programs, and Java

Introduction to Java Programming CPIT 202. WEWwwbvxnvbxmnhsgfkdjfcn

II. Compiling and launching from Command-Line, IDE A simple JAVA program

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher

Programming Languages FILS Andrei Vasilateanu

Fundamentals of Programming INTRODUCTION

CS321 Languages and Compiler Design I. Winter 2012 Lecture 1

1B1a Programming I Getting Started

Computer Software: Introduction

Topics. Operating System I. What is an Operating System? Let s Get Started! What is an Operating System? OS History.

Chapter 2 Operating-System Structures

Chapter 1. Introduction to Computers and Java Objects. Background information. » important regardless of programming language. Introduction to Java

An Introduction to Computers and Java CSC 121 Spring 2015 Howard Rosenthal

TTh 9.25 AM AM Strain 322

Chapter 1. Preliminaries

COMP1007 Principles of Programming

A+ Guide to Managing and Maintaining your PC, 6e. Chapter 2 Introducing Operating Systems

Full file at

Outline. Programming Languages 1/16/18 PROGRAMMING LANGUAGE FOUNDATIONS AND HISTORY. Current

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming

Chapter 1 Introduction to Computers, Programs, and Java

Computing Science 114 Solutions to Midterm Examination Tuesday October 19, In Questions 1 20, Circle EXACTLY ONE choice as the best answer

Class List. Java Must Have. Class Goals. Class Goals. Schedule

Information Systems Software

Programming 1. Lecture 1 COP 3014 Fall August 28, 2018

CS Computer Architecture

CSCE150A. Administrivia. Overview. Hardware. Software. Example. Program. Pseudocode. Flowchart. Control Structures. Hello World Program CSCE150A

Computer Science & Engineering 150A Problem Solving Using Computers

Computers in Engineering COMP 208. Computer Structure. Computer Architecture. Computer Structure Michael A. Hawker

Lecture 1: Introduction to Java

Special Topics: Programming Languages

2 rd class Department of Programming. OOP with Java Programming

Outline. Introduction to Programming (in C++) Introduction. First program in C++ Programming examples

Systems software. Definition. Categories of software. Examples Of Systems Software 11/23/2018

Chapter 1 Introduction to Computers, Programs, and Java

CSC 453 Operating Systems

Seminar report Java Submitted in partial fulfillment of the requirement for the award of degree Of CSE

CPSC 341 OS & Networks. Introduction. Dr. Yingwu Zhu

Downloaded from various sources on the NET

Chapter 11 Program Development and Programming Languages

IB Computer Science Topic.2-

Introduction to Programming

BITG 1113: Introduction To Computers And Programming Language LECTURE 1 LECTURE 1 1

Chapter 1. Preliminaries

Introduction. A. Bellaachia Page: 1

Low-Level Languages. Computer Programs and Programming Languages

What we saw. Desarrollo de Aplicaciones en Red. 1. OS Design. 2. Service description. 1.1 Operating System Service (1)

CSc 453 Interpreters & Interpretation

Transcription:

From High Level to Algorithm/Model Java, C++, VB Compilation Execution Cycle Hardware 27 October 2007 Ariel Shamir 1 Compilation Overview Algorithm vs. Programs From Algorithm to Compilers vs. Interpreters Java Virtual Machine Operating Systems 27 October 2007 Ariel Shamir 2 Computer Programs An algorithm is described to the computer as a computer program. A computer program is simply a list of unambiguous instructions meant to be followed by a computer. The operations sequence has to be correct or the program will fail. 27 October 2007 Ariel Shamir 3 1

Programming Languages There are several families of the programming languages: Procedural (Pascal, C++, Java) Logical (Prolog) Visual (Visual Basic) Document (HTML, LATEX) 27 October 2007 Ariel Shamir 4 Languages Hierarchy Procedural languages can be divided into: Machine languages Low-level (Assembler ) Intermediate-level (C, Fortran) High-Level (C++, Java) 27 October 2007 Ariel Shamir 5 High Level Vs. Low Level The computer can only execute programs expressed in the computer machine language Writing programs in machine language is possible but very difficult and time consuming. Using a more human readable language (high-level language) is better. 27 October 2007 Ariel Shamir 6 2

Program Compilation A program written in any high level computer language (java, C++, basic) must be translated into the machine language in order to be executed. The translation process is called Compilation (or Assembly) 27 October 2007 Ariel Shamir 7 Algorithm Vs. Program Find a minimum in a group of elements A: set the min as the value of first element for each element in A if it is smaller than min then assign min the value of the element the minimum of A is min 27 October 2007 Ariel Shamir 8 Pseudo-code Computer algorithms are usually written in pseudo-code. Pseudo-code is code that is easy to understand and yet is easily transformed into programming language. 27 October 2007 Ariel Shamir 9 3

Pseudo-code Vs. Code Pseudo-code realizing the above algorithm: temporary_min A[1] for i 1 to i length(a) if A[i] < temporary_min temporary_min A[i] return temporary_min 27 October 2007 Ariel Shamir 10 Java Code The pseudo-code converted to Java code: int min(int A[]) { int temporary_min = A[0]; for(int i=1; i<a.length; i++) if (A[i] < temporary_min) temporary_min =A[i]; return temporary_min; } 27 October 2007 Ariel Shamir 11 From Algorithm to Machine Execution Algorithm Pseudo-Code Design and Programming Input High Level Code Compilation Execution Output 27 October 2007 Ariel Shamir 12 4

Implementing Designing & writing the algorithms Writing code (programming) Compiling Testing/Debugging Maintaining 27 October 2007 Ariel Shamir 13 Language Syntax & Semantics The process of programming requires: Programming language. A translator of the programming language into machine language. The programming language has to be well defined syntactically and semantically. The meaning of what you write has to be precisely defined and understood (mathematically) by the computer. 27 October 2007 Ariel Shamir 14 Translators Compiler A compiler is a program that translates a source program (usually high level language) into target program (usually machine language program) The resulting program can be executed many times Interpreter An interpreter is a program that reads, translates and executes the source program statement by statement Translation must be done each time the program runs 27 October 2007 Ariel Shamir 15 5

Java In this course we will use Java programming language. Java is an object oriented, high-level, third generation programming language, like C, Fortran, Smalltalk. Java Shares much of C's syntax. Originally designed by a group at Sun MicroSystems (then called Oak). 27 October 2007 Ariel Shamir 16 Java As a High Level Language Java defers from most high level languages in its compilation. Java uses half-precompiled elements called bytecode. An additional layer above the physical machine interprets the byte-code. This layer is called the Virtual Machine. 27 October 2007 Ariel Shamir 17 Byte Code The java compiler translates java program into the byte code. Byte code is in fact a machine code for the Java virtual machine (VM). VM interprets the byte code and translates it to commands for each certain processor and OS. 27 October 2007 Ariel Shamir 18 6

Java VM The use of the byte code makes java platform independent: Java Program Byte Code Java Virtual Machine Intel PC Mac Macintosh Sun Sparc 27 October 2007 Ariel Shamir 19 Java Advantages Platform independent: write once, run anywhere. Improve robustness, remove unsafe language loopholes. According to Sun: Java is simple, object-oriented, distributed, interpreted, robust, secure, architecture-neutral, portable, high-performance, multithread, and dynamic language. 27 October 2007 Ariel Shamir 20 Java Disadvantages The main Java disadvantage are efficiency concerns since it is more interpreted. Looking to the future: VM performance will improve. 27 October 2007 Ariel Shamir 21 7

Java Interpreter Environments The two main environments: Operating system (Applications) Web browser (Applets) 27 October 2007 Ariel Shamir 22 Operating System In the operating system environment the Java program is called application. Applications have a more rigid structure. Applications can be textual or graphical. Applications are less secure but also less restrictive. 27 October 2007 Ariel Shamir 23 Web Browser The browser acts as an intermediate between the program and the OS. The JVM can resides inside the browser. The program has to work in graphical mode. The program is called Applet (a small application). 27 October 2007 Ariel Shamir 24 8

Java Code Java Source Code Java Compiler Java Byte Code Across the Internet using HTML Operating System Java Interpreter Bytecode Compiler Machine Code Web browser Java Interpreter 27 October 2007 Ariel Shamir 25 How Do Computers Keep Performing Tasks? How can we interact with a computer continuously? What does the computer do when we don t execute programs? Who is in charge of the User Interface (today GUI)? 27 October 2007 Ariel Shamir 26 Bridging the Gap? Hardware: CPU, Memory, Execution cycle User and Software: Computer Application programs 27 October 2007 Ariel Shamir 27 9

The Operating System The operating system is a program that runs all the time and manages the resources of the computer. Among other things, it allows us to load and execute other programs. The operating system itself is loaded to the memory as part of the boot process which takes place when the computer is started. 27 October 2007 Ariel Shamir 28 Operating System Issues Handling resources (disks, printers ) Task management (single, multi, preemptive ) Graphical user interface (icons, menus, dialogs ) 27 October 2007 Ariel Shamir 29 Operating Systems Examples DOS: single-tasking, non-graphical Mac OS (<10): non-preemptive multitasking, graphical Unix, Linux: preemptive multitasking, non-graphical Windows: preemptive multi-tasking, graphical 27 October 2007 Ariel Shamir 30 10

Boot-strapping The process of loading the operating system from disk into memory, when the computer is first turned on. A ROM-based part of the memory stores those first execution instructions (for example, the BIOS for basic input/output system) 27 October 2007 Ariel Shamir 31 Summary Algorithm/Model Program Code Compilers etc. Operating System Execution Cycle Hardware 27 October 2007 Ariel Shamir 32 11