Introduction and Overview Winter 2013 COMP 2130 Introduction

  • Slides: 22
Download presentation
Introduction and Overview Winter 2013 COMP 2130 Introduction to Computer Systems Computing Science Thompson

Introduction and Overview Winter 2013 COMP 2130 Introduction to Computer Systems Computing Science Thompson Rivers University

n n Instructor: Office hour: Dr. Mahnhoon Lee @ HL 424 11: 30 -12:

n n Instructor: Office hour: Dr. Mahnhoon Lee @ HL 424 11: 30 -12: 20 @ Mon, Tue, Wed, Fri and by appointment mlee@tru. ca http: //cs. tru. ca/~mlee/comp 2130/ n E-mail: Course web page: n Prerequisites for this course: n n COMP 1230 with minimum ‘C’, and COMP 1380 with minimum ‘C’ This course is a prerequisite for n n COMP 3270 Computer Networks COMP 3410 Operating Systems TRU-COMP 2130 Introduction 2

Rise of Questions n n What is a computer system? What is an operating

Rise of Questions n n What is a computer system? What is an operating system? Which [programming] language is most powerful? What are the benefits to take this course “Introduction to Computer Systems”? n n n Most universities teach assembly languages, computer architecture and hardware components. You are in a computing science program, and computing science is not much about the development of hardware components. Then what? TRU-COMP 2130 Introduction 3

Objectives n n n Understand the fundamentals of computer architecture Experience programming through the

Objectives n n n Understand the fundamentals of computer architecture Experience programming through the powerful C programming language (using GCC - GNU compiler), probably a new programming language to you Experience programming through IA 32 assembly language, another new programming language to you Experience reliable programming through the understanding of critical relationship between programming and computer architecture Experience efficient programming through code optimization Why is one programming language, e. g. , Java, not enough in computing science? TRU-COMP 2130 Introduction 4

Course Contents n C programming language n n n n Assembly language Introduction to

Course Contents n C programming language n n n n Assembly language Introduction to computer systems n n n Bit and Boolean operations Use of pointers Use of struct data structure Dynamic memory management. . . The fundamentals of computer architecture How does a computer system work? How is computer architecture related to programming? Code optimization. . . Use of Linux TRU-COMP 2130 Introduction 5

Lecture n n n n n Introduction to computer systems Introduction to C programming

Lecture n n n n n Introduction to computer systems Introduction to C programming language Data representations C: advanced topics Introduction to assembly language – IA 32 (Intel Architecture 32) Compiling, linking, loading, and executing Dynamic memory management Code optimization Memory hierarchy, locality, caching Virtual memory (if time permits) TRU-COMP 2130 Introduction 6

n The better knowledge of computer systems, the better programing. Computer System C Programming

n The better knowledge of computer systems, the better programing. Computer System C Programming Language Computer architecture CPU (Central Processing Unit) IA 32 assembly language Introduction to C language Physical main memory MMU (Memory Management Unit) Virtual memory space Memory hierarchy Cache Dynamic memory management Compiling, linking, loading, executing Better coding – locality Reliable programming; Efficient programming (code optimization) TRU-COMP 2130 Introduction 7

Seminar n n Use of Linux C programming exercises Exercise questions about computer architecture

Seminar n n Use of Linux C programming exercises Exercise questions about computer architecture and programming Explanation of assignments TRU-COMP 2130 Introduction 8

Textbooks n n Bryant and O’Hallaron, Computer Systems: A Programmer’s Perspective, 2/E, Prentice Hall,

Textbooks n n Bryant and O’Hallaron, Computer Systems: A Programmer’s Perspective, 2/E, Prentice Hall, 2011 ISBN 10: 0 -13 -610804 -0 Kernighan and Ritchie, The C Programming Language, Prentice Hall, 1988, ISBN 10: 0 -13 -110362 -8 TRU-COMP 2130 Introduction 9

Evaluation n Quizzes Programming Assignments Programming Exam Final test n In order to pass

Evaluation n Quizzes Programming Assignments Programming Exam Final test n In order to pass the course, students must achieve n n n n 25% 10% 25% 40% minimum of 50% on overall quizzes, minimum of 50% on the programming exam, minimum of 50% on overall programming assignments, and minimum of 50% on the final written exam TRU-COMP 2130 Introduction 10

Questions? n n n Anything that you want to know more? Any comment? Any

Questions? n n n Anything that you want to know more? Any comment? Any question? TRU-COMP 2130 Introduction 11

Something Additional n Research opportunity n Web data mining n n Computational intelligence n

Something Additional n Research opportunity n Web data mining n n Computational intelligence n n n Examples: Summly on i. Phones, Site. Seer How to handle categorical data? Participation opportunity is open. ACM International Collegiate Programming Contest (ICPC) ? n n Regional contest in Pacific Northwest Registration: September Competition date: early November this year at SFU I am currently recruiting students who are good at Java programming and completed COMP 2230. TRU-COMP 2130 Introduction 12

Loosing Habits and Winning Habits n Loosing habits? Winning habits? n What kind of

Loosing Habits and Winning Habits n Loosing habits? Winning habits? n What kind of habits do you have? n TRU-COMP 2130 Overview 13

Overview – Why C? n n n n Pros and cons n n n

Overview – Why C? n n n n Pros and cons n n n Most system programs are written in C, not even C++, for fast execution. The kernels of most operating systems are written in C. A lot of projects use C. Fast execution - Easy memory management - > Good for system programming Bit operation -/ But a bit complex concepts of pointer, type conversion and memory allocation How is C different from Java? TRU-COMP 2130 Overview 14

n General purpose programming language popularity index n n From lang-index. sourceforge. net Published

n General purpose programming language popularity index n n From lang-index. sourceforge. net Published at March 2012 Java C Objective-C Basic C++ C# Delphi D Pascal Ada Fortran Go Haskell Erlang Smalltalk ML Forth Scala Eiffel Caml/F# 0, 00% TRU-COMP 2130 5, 00% 10, 00% 15, 00% Overview 20, 00% 25, 00% 30, 00% 15

n Programming language populatiry n n From langpop. com Published at April 13, 2011

n Programming language populatiry n n From langpop. com Published at April 13, 2011 TRU-COMP 2130 Overview 16

n How is C different from Java? C Java Procedural No class Common data:

n How is C different from Java? C Java Procedural No class Common data: global variables Abstract data type: struct, union Object oriented Class Common data: instance variables Abstract data type: class Micro approach Individual utility libraries Macro approach Utilities include language itself Reference type variable No reference, but objects include the concept Call by value; call by reference for objects Compiling One file at a time, and linking Compiling Cross-reference TRU-COMP 2130 Overview 17

Overview – How a Computer Works n How does a computer system look like?

Overview – How a Computer Works n How does a computer system look like? n Model from the view of functions: von Neumann architecture Similar to n n n What happens when you turn on a computer system? Can a computer system understand a program written in C or Java? How does a program run in a computer system? TRU-COMP 2130 Overview 18

Overview – How a Computer Works n What happens when you turn on a

Overview – How a Computer Works n What happens when you turn on a computer? n n n Power on, then? -> Electric signal -> CPU will start executing instructions from a particularly fixed address. n n BIOS MBR OS CPU reads one instruction from memory at a time and executes the instruction. This cycle, called instruction cycle, repeats forever. n n Fetch and Execution TRU-COMP 2130 Overview 19

Overview – How a Computer Works n n Can a computer understand a program

Overview – How a Computer Works n n Can a computer understand a program written in C or Java? How does a program run in a computer? n n A program is a collection of data and codes. Compile and link Load and execute Multi-programming? TRU-COMP 2130 Overview 20

Overview – How a Computer Works n What hardware components do we need to

Overview – How a Computer Works n What hardware components do we need to run programs in a computer system? n Four major components: n n n CPU Main memory I/O devices n n n TRU-COMP 2130 Keyboard Mouse Monitor Hard disk System buses Overview 21

Overview – How a Computer Works n n User programs write data into the

Overview – How a Computer Works n n User programs write data into the main memory and read data from the main memory. It is very important to protect OS codes and data stored in the main memory from user programs. What does this mean? Why is this very important for Operating Systems? How to protect? n n n By using hardware supports and interrupts The architectures of computer systems have very close relations with OSes and programs. We will study n CPU, main memory, interrupts, instructions, and. . . TRU-COMP 2130 Overview 22