Computing Fundamentals Lecture No 2 Layers of a Computing System 2 4 Hardware Layer Computers and Electricity How do we describe the behavior of gates and circuits? Boolean expressions Uses Boolean algebra, a mathematical notation for expressing two-valued logic Logic diagrams A graphical representation of a circuit; each gate has its own symbol Truth tables A table showing all possible input values and the associated output values 4 Gates Six types of gates • • • • • • NOT AND OR XOR NAND NOR Typically, logic diagrams are black and white with gates distinguished only by their shape We use color for clarity (and fun) 5 NOT Gate A NOT gate accepts one input signal (0 or 1) and returns the complementary (opposite) signal as output 6 AND Gate An AND gate accepts two input signals If both are 1, the output is 1; otherwise, the output is 0 7 OR Gate An OR gate accepts two input signals If both are 0, the output is 0; otherwise, the output is 1 8 XOR Gate An XOR gate accepts two input signals If both are the same, the output is 0; otherwise, the output is 1 9 XOR Gate Note the difference between the XOR gate and the OR gate; they differ only in one input situation When both input signals are 1, the OR gate produces a 1 and the XOR produces a 0 XOR is called the exclusive OR because its output is 1 if (and only if): • either one input or the other is 1, • excluding the case that they both are 10 NAND Gate The NAND (“NOT of AND”) gate accepts two input signals If both are 1, the output is 0; otherwise, the output is 1 NOR Gate The NOR (“NOT of OR”) gate accepts two inputs If both are 0, the output is 1; otherwise, the output is 0 12 Gates with More Inputs Some gates can be generalized to accept three or more input values A three-input AND gate, for example, produces an output of 1 only if all input values are 1 13 Review of Gate Processing 14 Gate Behavior NOT Inverts its single input AND Produces 1 if all input values are 1 OR Produces 0 if all input values are 0 XOR Produces 0 if both input values are the same NAND Produces 0 if all input values are 1 NOR Produces 1 if all input values are 0 Constructing Gates Transistor A device that acts either as a wire that conducts electricity or as a resistor that blocks the flow of electricity, depending on the voltage level of an input signal A transistor has no moving parts, yet acts like a switch It is made of a semiconductor material, which is neither a particularly good conductor of electricity nor a particularly good insulator 15 Constructing Gates Note: If an electrical signal is grounded, it is “pulled low” to zero volts A transistor has three terminals • A collector (or source) • A base • An emitter What’s the Output in Figure 4.8? • If the Base signal is low, the transistor acts like an open switch, so the Output is the same as the Source • If the Base signal is high, the transistor acts like a closed switch, so the Output is pulled low What gate did we just describe? 16 Constructing Gates The easiest gates to create are the NOT, NAND, and NOR gates 17 Circuits Combinational circuit The input values explicitly determine the output Sequential circuit The output is a function of the input values and the existing state of the circuit We describe the circuit operations using Boolean expressions Logic diagrams Truth tables 18 Are you surprised? Combinational Circuits Gates are combined into circuits by using the output of one gate as the input for another This same circuit using a Boolean expression is AB + AC 19 Combinational Circuits Three inputs require eight rows to describe all possible input combinations 20 Combinational Circuits Consider the following Boolean expression A(B + C) Does this truth table look familiar? Compare it with previous table 21 Combinational Circuits Circuit equivalence Two circuits that produce the same output for identical input Boolean algebra Allows us to apply provable mathematical principles to help design circuits A(B + C) = AB + BC (distributive law) so circuits must be equivalent 22 Properties of Boolean Algebra 23 Adders At the digital logic level, addition is performed in binary Addition operations are carried out by special circuits called, appropriately, adders 24 Adders The result of adding two binary digits could produce a carry value Recall that 1 + 1 = 10 in base two Half adder A circuit that computes the sum of two bits and produces the correct carry bit 25 Truth table Adders Circuit diagram representing a half adder Boolean expressions sum = A B carry = AB 26 Adders Full adder A circuit that takes the carry-in value into account 27 Stored-Program Concept Instructions and data both stored in memory unit 28 Memory Memory A collection of cells, each with a unique physical address Most computers are byte-addressable Cell at address 11111110 contains 10101010 “Little endian” bit numbering: Memory Memory What does 10101010 mean? No way to answer that Could be an instruction, a natural number, a signed integer, a character, part of an image, … Arithmetic/Logic Unit Performs basic arithmetic operations such as addition and subtraction Performs logical operations such as AND, OR, and NOT Most modern ALUs have a small amount of special storage units called registers that can be accessed faster than main memory 31 Input/Output Units Input Unit A device through which data and programs from the outside world enter the computer system; Can you name three? Output unit A device through which results stored in the computer memory are made available outside the computer system Can you name two? 32 Control Unit Control unit The organizing force in the computer Instruction register (IR) Contains the instruction that is being executed Program counter (PC) Contains the address of the next instruction to be executed Central Processing Unit (CPU) ALU and the control unit called the Central Processing Unit, or CPU 33 Flow of Information Bus In general: A communication system that transfers data between components inside a computer or between computers; the medium (wires, optical fiber, etc.) and the protocols (rules for sharing the medium nicely) “The” bus: Connects the CPU, main memory, I/O devices, and possibly other components (e.g. hard disk drive) 34 What is an N-bit Processor? It could mean any of these: • N-bit general registers • N-bit ALU • N-bit addresses • N-bit data bus 35 The Fetch-Execute Cycle Fetch the next instruction Decode the instruction Get data if needed Execute the instruction Why is it called a cycle? 36 The Fetch-Execute Cycle 37 RAM and ROM Random Access Memory (RAM) Memory in which each location can be accessed and changed Read Only Memory (ROM) Memory in which each location can be accessed but not changed RAM is volatile, ROM is not What does volatile mean? 38 Secondary Storage Devices Why is it necessary to have secondary storage devices? Can you name some of these devices? 39 Magnetic Disks Magnetic Disks Seek time Time for read/write head to be over right track Latency Time for sector to be in position Access time Can you define it? Transfer rate Rate at which data moves from the disk to memory 41 Optical Disks CD A compact disk that uses a laser to read information stored optically on a plastic-coated disk; data is evenly distributed around spiral track CD-ROM read-only memory CD-DA digital audio CD-WORM write once, read many RW or RAM both read from and written to DVD Digital Versatile Disk, used for storing audio and video Blu-ray Higher capacity DVD allowing higher resolution video, etc. 42 Flash Drives Flash Memory Nonvolatile Can be erased and rewritten Supports USB mass storage standard 43 Touch Screens Touch screen A computer monitor that can respond to the user, touching the screen with a stylus or finger There are four types • • • • 44 Resistive Capacitive Infrared Surface acoustic wave (SAW) Touch Screens Resistive touch screen A screen made up of two layers of electrically conductive material • One layer has vertical lines, the other has horizontal lines • When the top layer is pressed, it comes in contact with the second layer which allows electrical current to flow • The specific vertical and horizontal lines that make contact dictate the location on the screen that was touched 45 Touch Screens Capacitive touch screen A screen made up of a laminate applied over a glass screen • Laminate conducts electricity in all directions; a very small current is applied equally on the four corners • When the screen is touched, current flows to the finger or stylus • The location of the touch on the screen is determined by comparing how strong the flow of electricity is from each corner 46 Touch Screens Infrared touch screen A screen with crisscrossing horizontal and vertical beams of infrared light • Sensors on opposite sides of the screen detect the beams • When the user breaks the beams by touching the screen, the location of the break can be determined 47 Touch Screens Surface acoustic wave (SAW) A screen with crisscrossing high frequency sound waves across the horizontal and vertical axes • When a finger touches the surface, corresponding sensors detect the interruption and determine location of the touch 48 Embedded Systems Embedded systems Computers that are dedicated to perform a narrow range of functions as part of a larger system Empty your pockets or backpacks. How many embedded systems do you have? 49 Operating System Software Categories Application software Software written to address specific needs—to solve problems in the real world System software Software that manages a computer system at a fundamental level Can you name examples of each? 51 Computer Gaming •Computer gaming is a computer simulation of a virtual world •Game designers must have knowledge of the following to make people, objects, and environments behave realistically in a virtual world: • • • • • • • 52 Computer graphics Artificial intelligence Human-computer interactions and simulation Software engineering Computer security Fundamentals of mathematics Laws of physics relating to gravity, elasticity, light, and sound Roles of an Operating System Operating system System software that • manages computer resources, such as memory and input/output devices • provides an interface through which a human can interact with the computer • allows an application program to interact with these other system resources 53 Roles of an Operating System What operating systems have you used? 54 Roles of an Operating System The various roles of an operating system generally revolve around the idea of “sharing nicely” An operating system manages resources, and these resources are often shared in one way or another among programs that want to use them 55 Application Gameplay •Gameplay: The type of interactions and experiences a player has during the game •Game genres, based on gameplay, include: • • • • • • 57 Action games Shooter games Action-adventure games Life-simulation games Role-playing games Strategy games Creating the Virtual World •Game engine--a software system within which games can be created •Following functionality provided by tools of a game engine: • A rendering engine for graphics • A physics engine to provide a collision detection system and dynamics simulation • A sound-generating component 58 Creating the Virtual World • Additional functionality resulting from tools of a game engine: • A scripting language apart from the code driving the game • Animation • Artificial intelligence algorithms (e.g., path-finding algorithms) • A scene graph that holds the spatial representation in a graphical sense 59 Soft Skills •High Quality Game Design and Development Requires Effective Use of “Soft Skills”: • Effective collaboration with designers, programmers, and artists on various technical ideas throughout the entire game design and development process • Flexibility and adaptability as the game design constantly evolves and changes throughout the development and production process • 60 Communication Networking Computer network A collection of computing devices connected in order to communicate and share resources Connections between computing devices can be physical using wires or cables or wireless using radio waves or infrared signals Can you name some of the devices in a computer network? 62 Networking Node (host) Any device on a network Data transfer rate (bandwidth) The speed with which data is moved from one place to another on a network Why is bandwidth so key? 63 Networking Computer networks have opened up an entire frontier in the world of computing called the client/server model 64 Networking Protocol A set of rules that defines how data is formatted and processed on a network File server A computer dedicated to storing and managing files for network users Web server A computer dedicated to responding to requests for web pages P2P model A decentralized approach that shares resources and responsibilities among many “peer” computers 65 Types of Networks Local-area network (LAN) A network that connects a relatively small number of machines in a relatively close geographical area Ring topology connects all nodes in a closed loop on which messages travel in one direction Star topology centers around one node to which all others are connected and through which all messages are sent Bus topology nodes are connected to a single communication line that carries messages in both directions 66 Types of Networks Ethernet The industry standard bus technology for localarea networks Types of Networks Wide-area network (WAN) A network that connects local-area networks over a potentially large geographic distance Metropolitan-area network (MAN) The communication infrastructures that have been developed in and around large cities Gateway One particular set up to handle all communication going between that LAN and other networks 68 Types of Networks 69 Types of Networks Internet A wide area network that spans the planet So, who owns the Internet? 70 Internet Connections Wireless network A network in which devices communicate with other nodes through a wireless access point Bluetooth A technology used for wireless communication over short distances 71 Internet Connections Internet backbone A set of high-speed networks that carry Internet traffic, provided by companies such as AT&T, Verizon, GTE, British Telecom, and IBM Internet service provider (ISP) An organization providing access to the Internet 72 Internet Connections Various technologies available to connect a home computer to the Internet Phone modem converts computer data into an analog audio signal for transfer over a telephone line, and then a modem at the destination converts it back again into data Digital subscriber line (DSL) uses regular copper phone lines to transfer digital data to and from the phone company’s central office Cable modem uses the same line that your cable TV signals come in on to transfer the data back and forth 73 Internet Connections Broadband A connection in which transfer speeds are faster than 768 kilobits per second • DSL connections and cable modems are broadband connections • The speed for downloads (getting data from the Internet to your home computer) may not be the same as uploads (sending data from your home computer to the Internet) 74 Packet Switching Packet A unit of data sent across a network Router A network device that directs a packet between networks toward its final destination Packet switching Messages are divided into fixed-sized, numbered packets; packets are individually routed to their destination, then reassembled Packet Switching Take a message, break it into three packets, and simulate this process 76 Open Systems A logical progression... Proprietary system A system that uses technologies kept private by a particular commercial vendor Interoperability The ability of software and hardware on multiple machines and from multiple commercial vendors to communicate Open systems Systems based on a common model of network architecture and a suite of protocols used in its implementation 77 Open Systems Open Systems Interconnection Reference Model A seven-layer logical break down of network interaction to facilitate communication standards Each layer deals with a particular aspect of network communication 78 Network Protocols • Network protocols are layered such that each one relies on the protocols that underlie it • Sometimes referred to as a protocol stack 79 TCP/IP Transmission Control Protocol (TCP) Software that breaks messages into packets, hands them off to the IP software for delivery, and then orders and reassembles the packets at their destination Internet Protocol (IP) Software that deals with the routing of packets through the maze of interconnected networks to their final destination 80