Computer Architectures

Computer Architectures

Computer Architectures Multi-level computer organization, virtual machines Czech Technical University in Prague, Faculty of Electrical Engineering A0M36APO Computer Architectures Ver.1.10 1 Multi-level computer organization Machine code (language) - executed directly by CPU, instruction set – level L1 – alphabet {0,1} , hard for humans, architecture specific Higher-level languages – more user/programmer friendly, L2 + more L2 program execution on machine supporting L1 language Compilation - L2 instructions are replaced by sequences of L1 instructions Interpretation – program codded in L1 performs according L2 accessed as data (slower) Virtual machine Virtual machine M3 L3 PRG. is interpreted by program running on M2 or M1 concept Language/code L3 system or compiled to L2 or L1 We declare virtual computer Mi for level i Virtual machine M2 L2 PRG. is interpreted by which executes Language/code L2 program running on M1 system language L . or compiled to L1 language i Program written in L1 PROGRAM is directly Virtual machine M1 language Li is Language/code L1 executed by computer hardware interpreted or translated for Mi-1 computer, etc. A0M36APO Computer Architectures 2 Todays multi level machine architecture Machine levels evolution user Level 5 symbolic • the first computers – programs Problem oriented languages language L5 – higher level machine code only – 1 language compilation (compiler) level in the stack Level 4 • 50-ties - Wilkes – Symbolic machine code L4 – assembler ABI level, assembler microcode – 2 levels (symbolic addresses) • compilation (compiler) 60- ties – OS – 3 levels Level 3 • compilers, prog. Operating system level L3 – machine code languages – 4 levels with system-calls + virtual instructions • user oriented (operating system) partial interpret applications - 5 levels Level 2 Bare metal (CPU) • HW and SW are logically machine code L2 – CPU instruction set equivalent (can be interpretation (microcode) mutually substituted) Microcode level Level 1 • competition and OS (not used on RISCs) L1 – micro- low level convergence of RISC support inststructions machine and CISC CPU and direct execution code architectures and libraries by hardware implementations A0M36APO Computer Architectures 3 Processes and their states PROCESS – executed program (program – passive as data, process - active) PROCESS STATE - information enough to continue previously frozen process 1. program 3. variables values, data, registers 2. instruction pointer 4. state and position for all I/O ASUMPTION: process P does not modify its own program! STATE VECTOR – variable components of process state – modified by HW or program PROCESS = PROGRAM + STATE VECTOR STATE VECTOR UPDATE – st. vector P2 is changes by P1 -> P1 is interpreter of P2 program reads and executes P1 reads and executes P2 reads and executes P3 instruction and modifies and modifies SV2 and modifies SV3 state vector 1 prog 1 state prog 2 state prog 3 state code vec. 1 code vec. 2 code vec. 3 M1 M2 M3 computer μ prog. level instruction set operation system hardware architecture level level A0M36APO Computer Architectures 4 Machine Code – Instruction Set Architecture (M2) Defined by instruction set (usually referred as processor architecture) ISA – Instruction Set Architecture Microarchitekture (implementation) HW - structure of computer, CPU, I/O, buses, memory organization, hardware latches, buffers, registers, clocks SW - instruction set, data formats, addressing methods, CPU registers instruction without OPCODE address/operand or Instruction format with implicit one single operand/address - one or more fields, (one or more OPCODE ADDRESS instruction continuous words) double operand/address OPCODE ADDR1 ADDR2 - addr. fields contains address instruction or specify register(s) (indirect) triple operand/address OPCODE AD1 AD2 AD3 (src1) (src2) (dst) instruction Most commonly used CISC SOURCE OPERAND DESTINATION OPERAND formats have two operands, SOURCE SOURCE DEST DEST OPCODE P RISC usually provide three MODE REG MODE REG operands but only register Extension word 1 – address or immediate data P+1 ones Extension word 2 – address or immediate data P+2 A0M36APO Computer Architectures 5 Intel Core 2 Architecture (Mikr architecture) (M1) 128 Entry 32 KB Instruction Cache ITLB (8 way) Shared 128 Bit Bus Interface 32 Byte Pre-Decode, Unit Fetch Buffer Instruction 6 Instructions Fetch Unit 18 Entry Instruction Queue Micro- Complex Simple Simple Simple code Decoder Decoder Decoder Decoder 4 µops 1 µop 1 µop 1 µop 7+ Entry µop Buffer Shared 4 µops L2 Cache Register Alias Table (16 way) and Allocator 4 µops 4 µops Retirement Register File 256 Entry 96 Entry Reorder Buffer (ROB) (Program Visible State) L2 DTLB 4 µops 32 Entry Reservation Station Port 0 Port 1 Port 5 Port 3 Port 4 Port 2 SSE SSE ALU Shuffle Shuffle SSE Store Store Load ALU ALU Branch ALU MUL ALU Address Data Address 128 Bit 128 Bit FMUL Memory Ordering Buffer FADD FDIV (MOB) Store128 Bit Load Internal Results Bus 256 Bit 128 Bit 32 KB Dual Ported Data Cache 16 Entry (8 way) DTLB A0M36APO Computer Architectures 6 Requirements for Good Programmer Every programmer should be able to write a code that meets the following criteria: ● Efficient CPU utilization, ie. Fast code ● Efficient use of memory, ie. Use only such data types/structures that suffice for programmer purpose while consuming minimum/reasonable amount of memory space ● Follow laid down rules and convention, ie. Format source code for better reading and understanding (spaces, indentation, comments …) ● Made future modifications and improvement of code easy (using functions or OOP according to the environment and programmer skills) ● Solid and well-testable code, ie. Detect and correct possible errors (most critical and common are errors, which we do not expect that can occur) ● Documentation (instructions for using the program and future extension) Loosely paraphrased/based on Randall Hyde book Write Great Code - Volume 2: Thinking Low-Level, Writing High-Level A0M36APO Computer Architectures 7 ⇒ my suggestions for x86 and other CPU architectures ● for x86 – read and understand Agner Fog's CPU reviews and optimization manuals http://www.agner.org/optimize/ ● The microarchitecture of Intel, AMD and VIA CPUs ● An optimization guide for x86 platforms ● the great overview of CPU evolution and methods to speed up instructions execution ● John Bayko: Great Microprocessors of the Past and Present ● understand how higher level languages and runtime environments translate language contsructs to underlaying data types, memory allocations and access pattern and use that as base to decide which data types select for given case ● study compiler properties and options and write benchmarks/tests and develop your “sense” for approximation about efficiency, price and memory demands of possible program constructs ● at the end you often find that many attempts to optimize code without additional knowledge and long term experience your clumsy optimization attempts can lead to slower code that code generated by compiler unconstrained ⇒ but if the performance is really a priority, application is demanding the there is only way to study and learn where initial knowledge is not sufficient, where to trust compiler, where it is necessary to help it (inline assembly, vektorization SSE etc.) or extend it ● all above effort is useless and waste of time if original algorithm or concept is wrongly selected ● see the example what are the ways to concatenate two bytes to form 16-bit word A0M36APO Computer Architectures 8 Virtualization ● Virtualization hides the implementation/properties of lower layers (reality) and provides an environment with desired properties ● Virtualization can be divided to following techniques in computer technology ● Purely application / language level and compiled code (byte-code) - virtual machines, for example. JVM, dotNET ● Emulation and simulation typically different computer architecture (also called cross-virtualization) ● Native virtualization - an isolated environment that provides the same type of architecture for the unmodified OS ● Virtualization with full support in the HW ● Partial virtualization - typically only address spaces ● Paravirtualization - the operating system has to modified/extended to run in provided environment ● OS-level virtualization - only separated user environments (Jails, containers, etc.) A0M36APO Computer Architectures 9 OS Level Virtualization Mechanism Operating system License Available File system Copy on Disk quotas isolation Write varies by most UNIX-like chroot operating 1982 Partial[5] No operating systems system Apache License Docker Linux [6] 2013 Yes Yes Not directly 2.0 Linux-VServer Linux GNU GPLv2 2001 Yes Yes (security context) Apache License lmctfy Linux 2013 Yes Yes 2.0 Partial. Yes with Partial. Yes LXC Linux GNU GPLv2 2008 Yes[10] LVM with Btrfs. OpenVZ Linux GNU GPLv2 2005 Yes No Virtuozzo Linux, Windows Proprietary July 2000[14] Yes Yes Solaris, Solaris Containers OpenSolaris, CDDL February 2004 Yes Yes (ZFS) (Zones) Illumos FreeBSD jail FreeBSD BSD License 2000[20] Yes Yes (ZFS) Last March 3, sysjail OpenBSD, NetBSD BSD License Yes No 2009 WPARs AIX Proprietary 2007 Yes No HP-UX Containers Partial. Yes with HPUX Proprietary 2007 Yes No (SRP) logical volumes iCore Virtual Proprietary/Free Windows XP 2008 Yes No Accounts ware Source: http://en.wikipedia.org/wiki/Operating-system-level_virtualization A0M36APO Computer Architectures 10 Full Computer System Virtualization ● Host system (often called domain DOM 0)

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    21 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us