CS Basics 2) Architecture

Similar documents
Computers and Microprocessors. Lecture 34 PHYS3360/AEP3630

TUTORIAL Describe the circumstances that would prompt you to use a microprocessorbased design solution instead of a hard-wired IC logic design.

CREATED BY M BILAL & Arslan Ahmad Shaad Visit:

THE MICROCOMPUTER SYSTEM CHAPTER - 2

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS

Introduction to OS. Introduction MOS Mahmoud El-Gayyar. Mahmoud El-Gayyar / Introduction to OS 1

2011 Francisco Delgadillo

3.1 Description of Microprocessor. 3.2 History of Microprocessor

Computer Architecture 2/26/01 Lecture #

Computer Processors. Part 2. Components of a Processor. Execution Unit The ALU. Execution Unit. The Brains of the Box. Processors. Execution Unit (EU)

Intentionally Blank 0

Computer Overview. A computer item you can physically see or touch. A computer program that tells computer hardware how to operate.

Lecture Objectives. Introduction to Computing Chapter 0. Topics. Numbering Systems 04/09/2017

CS 16: Assembly Language Programming for the IBM PC and Compatibles

Downloaded from various sources on the NET

Memory Overview. Overview - Memory Types 2/17/16. Curtis Nelson Walla Walla University

CS 101, Mock Computer Architecture

What is the typical configuration of a computer sold today? 1-1

Memory classification:- Topics covered:- types,organization and working

Computers Are Your Future

History. 3rd Generation- Integrated Circuits, Transistors (Integrated Circuit form) for Memory ( memory is now volatile), Terminal/Keyboard for I/O

COMPUTER STRUCTURE AND ORGANIZATION

Assembly Language. Lecture 2 - x86 Processor Architecture. Ahmed Sallam

Computer Programming for Engineering

Chapter 9: A Closer Look at System Hardware

Chapter 9: A Closer Look at System Hardware 4

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

Sir Sadiq s computer notes for class IX. Chapter no 4. Storage Devices

Logic and Computer Design Fundamentals. Chapter 8 Memory Basics

Machine Architecture. or what s in the box? Lectures 2 & 3. Prof Leslie Smith. ITNP23 - Autumn 2014 Lectures 2&3, Slide 1

About the Presentations

Parts are adapted from Windows 98 by Mark Twain Media, Inc. A Computer System has Hardware and Software

Internal Memory. Computer Architecture. Outline. Memory Hierarchy. Semiconductor Memory Types. Copyright 2000 N. AYDIN. All rights reserved.

COSC 122 Computer Fluency. Computer Organization. Dr. Ramon Lawrence University of British Columbia Okanagan

Introduction To Computer Hardware

Assembly Language. Lecture 2 x86 Processor Architecture

Segment 1A. Introduction to Microcomputer and Microprocessor

Electricity: Voltage. Gate: A signal enters the gate at a certain voltage. The gate performs operations on it, and sends it out was a new signal.

Chapter One. Introduction to Computer System

Introduction To Computers: Hardware

Assembly Language for x86 Processors 7 th Edition. Chapter 2: x86 Processor Architecture

The x86 Microprocessors. Introduction. The 80x86 Microprocessors. 1.1 Assembly Language

Main Memory (RAM) Organisation

Homeschool Enrichment. The System Unit: Processing & Memory

Elementary Computing CSC M. Cheng, Computer Science 1

Introduction to 8051 microcontrollers

Microcomputer Architecture and Programming

Week 1. Introduction to Microcomputers and Microprocessors, Computer Codes, Programming, and Operating Systems

Random Access Memory (RAM)

SYLLABUS OF ADVANCED CARD LEVEL & CHIP LEVEL TRAINING ( DESKTOP AND LAPTOP )

Lyman Briggs Lecture Series. Group Question. Discussion Questions. Definition of Computer. Definition of Modern Computer. Definition of a Computer

User. Application program. Interfaces. Operating system. Hardware

Instruction Set Architectures

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 2, 2016

EE 308: Microcontrollers

Computer System Overview

Chapter Two. Hardware Basics: Inside the Box

So computers can't think in the same way that people do. But what they do, they do excellently well and very, very fast.

Introduction to the Personal Computer


CSC 101 Questions: Chapter 1: Multiple Choice: 1. When did the World Wide Web become available to users? a. 1960s b. 1970s c. 1980s d.

Computer chip: A very small pieces of silicon or other semi-conducting material onto which integrated circuits are embedded Circuit board: A thin

Unit 2: Technology Systems. Computer and technology systems

INTRODUCTION TO INFORMATION & COMMUNICATION TECHNOLOGY (ICT) LECTURE 2 : WEEK 2 CSC-111-T

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2017 Lecture 13

Technology in Action

Computer Systems Architecture

Computer Organization

Components of a personal computer

COMP3221: Microprocessors and. and Embedded Systems. Overview. Lecture 23: Memory Systems (I)

Instruction Register. Instruction Decoder. Control Unit (Combinational Circuit) Control Signals (These signals go to register) The bus and the ALU

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 3, 2015

Chapter 4 Main Memory

7/28/ Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc Prentice-Hall, Inc.

UNIT V MICRO CONTROLLER PROGRAMMING & APPLICATIONS TWO MARKS. 3.Give any two differences between microprocessor and micro controller.

(Refer Slide Time 00:01:09)

Lecture-7 Characteristics of Memory: In the broad sense, a microcomputer memory system can be logically divided into three groups: 1) Processor

OS And Hardware. Computer Hardware Review PROCESSORS. CPU Registers. CPU Registers 02/04/2013

Computer Architecture Review. ICS332 - Spring 2016 Operating Systems

Computer Systems. Binary Representation. Binary Representation. Logical Computation: Boolean Algebra

x86 Architectures; Assembly Language Basics of Assembly language for the x86 and x86_64 architectures

2/15/2008. Announcements. Programming. Instruction Execution Engines. Following Instructions. Instruction Execution Engines. Anatomy of a Computer

Knowledge Organiser. Computing. Year 10 Term 1 Hardware

CC411: Introduction To Microprocessors

Moodle WILLINGDON COLLEGE SANGLI (B. SC.-II) Digital Electronics

RAM (RANDOM ACCESS MEMORY)

A+ Guide to Managing and Maintaining Your PC. How Hardware and Software Work Together

Computer Architecture

Machine Architecture and Number Systems CMSC104. Von Neumann Machine. Major Computer Components. Schematic Diagram of a Computer. First Computer?

5 Computer Organization

A+ Guide to Hardware: Managing, Maintaining, and Troubleshooting, 5e. Chapter 1 Introducing Hardware

Machine Architecture and Number Systems

Computers Are Your Future

CS429: Computer Organization and Architecture

Show how to connect three Full Adders to implement a 3-bit ripple-carry adder

211: Computer Architecture Summer 2016

CS429: Computer Organization and Architecture

Dec Hex Bin ORG ; ZERO. Introduction To Computing

Processing Unit CS206T

Unit - II. Computer Concepts and C Programming 06CCP13. Unit II

Transcription:

CS Basics 2) Architecture Emmanuel Benoist Fall Term 2016-17 Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 1

Architecture What is a computer? Memory Random Access Memory Central Processing Unit - CPU Machine instructions Operating System Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 2

What is a computer? Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 3

Question What is a computer made of? Mainly transistors Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 4

Memory Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 5

Switches, Transitors and Memory If you switch light By entering the room you switch the light on By leaving the room you do not switch it off When you come back: light is still on It is Memory: it can be On or Off The switch remembers the last command Until you change it, it remains Change = overwrite the value Light switch are mechanical Babage computer was also mechanical Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 6

Memory Definition container for alterable patterns that retain an entered pattern until someone or something alters the pattern In computers The patterns are electrical: there is a voltage or there is no voltage In history Memeory was physical (made out of cams for babbage) Could have been hydraulic (high / low position),... Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 7

Memory out of electricity Problems with light switches They require fingers to set them Computer memory should be operated by the same force it controls So memory can be passed to other memory storage locations Such a switch is called a relay How do relays work You can flip a relay by feeding it a pulse of electricity Computers have been made out of relays It was a long time ago They were not powerfull : relay is about the size of an ice cube Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 8

Memory out of electronics Memory is made out of transistor switches Early in history, they were made out of vacuum tube switches Transistors Use properties of silicon to act as switches Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 9

een pins 2 and 3. When the voltage is removed from pin 1, current ceases ow between pins 2 and 3. Transistor 2 1 3 Common Transistor Switch Field effect transistor Input When Electric voltage is applied to pin 1 Current Select flows between pin 2 and 3 When voltage is removed from pinoutput 1 current ceases to flow between pins 2 and 3 Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 10

Memory Cell Common Transistor Switch Input Select Output Memory Cell Figure 3-1: Transistor switches and memory cells In real life other components needed (diodes, capacitors,... ), In realvoltage life, a tiny handful of other components (typically diodes capacitors) areifnecessary you put a tiny to make voltage things on select, worka smoothly voltage willin appear a computer and mem context. Theseremain are not on itsnecessarily ouput pin little gizmos connected by wires to outside of theif you transistor select and (although change thein input, early it changes transistorized the output computers t voltage were), but are now cut from the same silicon crystal the transistor itself is from, Berner Fachhochschule and occupy Haute almost cole spcialise no bernoise space Berneat University all. of Taken Applied Sciences together, the transistor11sw

Store more than One bit One Chip contained one transistor Together with other components: one bit of memory Ingenieurs crisscrossed the chip into four transtors (+ components) Four bits in one chip Shrinking process begins 8 bits, 16 bits, 256 bits, 1kbits (1024 bits)... 4 GB (Bytes not bits) Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 12

Random Access Memory Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 13

Random Access Randomness of memory? Access any memory cell independently Give an address : get the value No need to read all memory Opposite Serial access memory Tapes Hard disk Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 14

Random Access Memory In memory, each bit is stored in its own memory cell Analog to the one seen previously Each cell has one unique number: Its Address Addresses start by 0, 1, 2, 3,...... n 1 ( where n is the number of memory cells) The chip has pins called address pins Used to input the address of the desired cell It has two other pins One read / write pin One data pin Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 15

Berner Fachhochschule That s Haute all done cole spcialise internally bernoise to the Berne chip. University As farof asapplied you, Sciences on the outside, are 16 RAM Read/Write Pin Data Pin 0FFFFF 0FFFFE Address Pins Address Decoder Circuitry 3 2 1 0 Figure 3-2: ARAMchip

Access 1 bit of RAM Address pins You put voltage on some pins (5V for instance) and not on some other It represents a number in binary (where 0V is 0 and 5V represents 1) The cell with the given address is activated Depending on status of Data pin Voltage / no voltage The system is read or write You can read or write from the read/write pin Read the voltage (0 or 5V) (in read mode) Set the voltage to overwrite the value (in write mode) Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 17

Memory is more than 1bit Other units A bit is a single binary digit 0 or 1 A byte is 8 bits side by side A word is 2 bytes side by side A double word is 2 words side by side A quadword is 2 double words side by side Most computers process information in quadwords (64 bits) Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 18

Access 8 bits We have 8 memory chips The address bits are related The same address is sent to 8 chips Each chip delivers one bit The bit can be read or write One bit at a time 8 chips: 8 bits Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 19

RAM 8 Data Lines 20 Address Lines Figure 3-3: A 1-megabyte memory system Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 20

RAM is somehow more complex So simple architecture no longer exists There are many different ways of distributing chips Chips storing 1,2,3,4,8 bits per address are relatively common Desing of memory is a subdiscipline in electrical engineering Today memory is provided in Dual Inline Memory Modules (DIMMs) Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 21

Accessing memory Number of bits accessed In 8 bits computers: memory returns a byte In 16 bits computers : memory returns a word In 32 bits computers: memory returns a double word In 64 bits computers: memory returns a quad word Convention Regardless on the size of the return value Every byte has its own address Example If you access the memory at address 123 on a 32 bits architecture, you receive the bytes having the addresses 123, 124, 125, and 126, If you access memory at address 126 You receive bytes with the addresses 126, 127, 128, 129 Any byte in memory can be addressed! Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 22

Central Processing Unit - CPU Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 23

CPU Central Processing Unit does the work Arithmetic computation, reading writing in memory, Peripherals also work Network or USB ports Video display board (using Graphical Processing Unit - GPU and memory) Intel is the market leader AMD is a big competitor CPU s are standardized Commands to CPU are the same for all manufacturers Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 24

Talking to Memory CPU has to communicate with memory Address pins CPU has pins for memory addresses They are connected to pins of memory chips Data lines Are connected to Data output of the memory Are used to read (or write) the memory The CPU writes an address on the bus, the Memory answers the value on data lines (Reality is a little bit more complicated, but the principle remains true) Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 25

The CPU and Memory CPU Chip Data Lines Address Lines Figure 3-4: The CPU and memory Figure 3-4 is, of course, purely conceptual. Modern memory systems are great deal more complex than what is shown, but in essence they all work th same way: the CPU passes an address to the memory system, and the memor system either accepts data from the CPU for storage at that address or plac Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 26

Data Bus Used to communicate with Peripherals Video display boards Disk drives USB ports Network ports source and/or destination for information Peripherals talk to the CPU Done using electrical connections linking all address pins and data pins It links all the peripherals and the CPU together It is called data bus Communication using data bus An address is placed on the bus, followed by some data Special signals go out on the bus to indicate if target is memory or one peripheral Address of peripheral = I/O address (unlike memory address) Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 27

A computer Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 28

CPU and Memory Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 29

Registers Every CPU contains data storage: Registers Very few storage Very fast compared to memory access Workbench Where the CPU places elements to work on Example: addition You place one opperand in one register The other operand in another register The sum replaces one of the register Sum can be placed in another register for being used in another operation or stored in memory for a later use Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 30

Registers Registers do not have addresses Like memory (address 00558D2H) Registers have names EAX, EDI, R9 Names are the results of a long history From 8 bits CPU to 64 bits CPU s Some registers have special powers Registers can be used for storing information some registers are used for a special function Registers are presented in detail next week Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 31

Data Bus Information enters through a network port Assemble the signal into bytes of data Information is placed on the data bus CPU reads the information Processes it in other ways place it back on the data bus Display board retrieves bytes from the data bus writes into the video memory one can see the information on screen Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 32

Machine instructions Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 33

What is a Program A program is just data Stored in memory Not different to other data Machine instructions are just bytes CPU reads from memory CPU asks the memory for a given address (it knows it is an instruction) An instruction is placed on the bus CPU reads it: 0B6H 073H for instance Means load the value 73H into register DH Each instruction tells the CPU to perform one generally small and limited task Writing the sequence of instruction is Assembly language programming The CPU has a special counter (register) pointing to the next instruction The loading is automatic Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 34

Machine instruction Machine instruction is binary code It is not numbers (numbers are used to represent them) The binary instructions triger the transistors: switches in the CPU Instruction 01000000B (40H) Directs CPU to add 1 to the value stored in register AX The sum is placed back in AX The 8 bits are loaded in the CPU They push 8 switches which push dozens of switches and finally push thousands of switches In the end, the value contained in register AX is incremented Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 35

Changing course CPU normally picks up the next comming instruction the address of the current instruction is automatically incremented Some instructions change the order of the instructions The CPU can jump to another instruction Anywhere in the program Jump the next instruction after a test Go back to the start of a program or a sub-program Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 36

Operating System Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 37

Operating System Responsible for basic functions Storage of data on disk Pick input from keyboard Display information on screen Nowadays, much more complicated Memory management Multi-user Multi-task... Just another program Written also in memory Contains CPU instructions Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 38

Very old OS: CP/M For desktop microcomputers in 1979 State of the art in 1979 OS is loaded at startup If you type the name of a program CP/M loads the program from a disk file into memory Hands over all power over the machine to the program The program overwrites the OS in memory (because memory was VERY expensive) Only one program could be executed at a time Program runs When program finishes CP/M was reloaded from the floppy disk into memory wait for another command to be typed Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 39

DOS and BIOS PC DOS replaced CP/M on IBM PC DOS did not go away remained in place while application was loaded IBM took some code on a memory chip Program for handling Keyboard, display and disk drives Took away from disk drive Program written on a Read Only Memory (ROM) soldered to the motherboard Program was called BIOS Basic Input/Output System It is nicknamed firmware because it is not volatile All modern computers have BIOS Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 40

Multitasking DOS was not realy an OS Just file manager and program launcher Windows 95 was multitask Operated in 32-bits protected mode But needed to support DOS More than one task Memory was cheaper Possibility to have several programs at the same time in memory Example One program starts After few milliseconds, windows preempt Windows starts the next program And so on, each program receive a small slice of CPU time Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 41

all the programs were running simultaneously. Figure 3-5 may make this clearer. Imagine a rotary switch, in which a rotor turns continuously and touches each of several contacts in sequence, once per revolution. Each time it touches the contact for one of the programs, that program is allowed to run. When the rotor moves to the next contact, the previous program stops in its tracks, and the next program gets a little time to run. Multitasking CPU Program 1 Program 2 Program 3 Program 4 Program 5 Figure 3-5: The idea of multitasking The operating system can define a priority for each program on the list, so that some get more time to run than others. High-priority tasks get more clock cycles to execute, whereas low-priority tasks get fewer. Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 42

Linux Linus Torvals wrote Linux in 1991 Unix like operating system Multitask More powerfull structure than Win 95 Core of Linux : The Kernel Took full advantage of IA-32 protected mode Kernel: entirely separated from user interface System memory entirely tagged: kernel space or user space Programs in user space do not have access to kernel space Communication throw System calls Direct access to hardware limited to kernel Memory, video, peripherals This design is still in use in successors of Linux and Win NT Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 43

Protected Mode Memory CPU Your Program User-Interface Shell The graphical shell, plus all ordinary applications (Web browsers, editors, etc., and programs that you write) run in user space. Display Driver Periodically, the CPU gives each of the many programs running in memory a small slice of execution time. Hard Disk Driver Kernel Everything below the dotted line runs in kernel space and has special privileges and protections. Figure 3-6: Amature,protected-modeoperatingsystem Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 44

Conclusion A program is just data Instructions are data They are bits, and are represented as numbers (in hex for instance) Memory and CPU are linked throw a Bus It links also all periferals CPU writes on it and periferals read what is for them Multitasking requires an OS that can protect programs and memory To protect features To avoid security risks Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 45

Bibliography This course corresponds to chapter 3 of the book: Assembly Language Step by Step (3rd Edition) Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 46