Cos 101 Introduction to Computing Sciences Lecture Notes PDF

Document Details

LuxuriousGyrolite5136

Uploaded by LuxuriousGyrolite5136

Nile University of Nigeria

Asim Balarabe Yazid

Tags

computer science data representation binary computer science fundamentals

Summary

These lecture notes cover data representation, Boolean operations, and memory, highlighting different ways of storing and manipulating information in computers. The lecture also covers computer architecture topics like the CPU and ALU.

Full Transcript

COS 101 Introduction to Computing Sciences. Lecture 1: Data storage: data representation, data storage, types of data Hamisu store in Ismail AHMAD a computer. Nile University of Nigeria, Abuja Faculty of Computing Department of Cyber Security....

COS 101 Introduction to Computing Sciences. Lecture 1: Data storage: data representation, data storage, types of data Hamisu store in Ismail AHMAD a computer. Nile University of Nigeria, Abuja Faculty of Computing Department of Cyber Security. © Asim Balarabe Yazid Bit and their storage  First, we must consider how information can be stored inside computers. By “information” we mean the following  Numbers  Text  Images  Sound  Video, etc.  For today’s computers, information is encoded as patterns of 0’s and 1’s called bits (short for binary digits).  The reason we use only two symbols (0 and 1) for information encoding is because it’s simple, not because it’s powerful. © Asim Balarabe Yazid 2 Data Representation  Some possible meanings for a single bit  Numeric value (1 or 0)  Boolean (true or false)  A bit can only represent one of two values, for more values, we need a long string of bits to represent them 010100101 © Asim Balarabe Yazid 3 Boolean operations  Operations that manipulate one or more 1/0 (or true/false) values are called Boolean operations, in honor of Mathematician George Boole (1815-1864).  The four Boolean operations are  AND  OR  XOR (exclusive or)  NOT  They are like arithmetic operators (+,-) because they combine a pair of value to produce a result © Asim Balarabe Yazid 4 Boolean operations  AND result is true (1) when both of its component are true, we conclude 1 AND 1 should be 1, where as all other cases should produce an output of 0.  OR result is true (1) when at least one its component is true, other cases should produce an output of 0.  XOR result is true (1) when its component are not the same.  NOT it compute only one input, if its input is true (1) the output should be false (0), otherwise if its false (0) the output will be true (1). © Asim Balarabe Yazid 5 Example of Boolean operations © Asim Balarabe Yazid 6 Gate example  A digital circuit’s operation can be summarized by a truth table 0 1 1 0 0 0 0 © Asim Balarabe Yazid 7 Flip-flop A flip-flop is a circuit that produces an output value of 0 or 1, which remains constant until a temporary pulse from another circuit causes it to shift to the other value. Our purpose in introducing the flip-flop it demonstrates how devices can be constructed from gates, a process known as digital circuit design, which is an important topic in computer engineering © Asim Balarabe Yazid 8 Another way of constructing flip-flop Reasons for introducing Flip-flop  Construction device using gate  Provide example of abstraction  Alternative way of storing bits © Asim Balarabe Yazid 9 Hexadecimal Notation  A long string (101101010011 ) of bits is called stream.  Stream are difficult for the human mind to comprehend. Therefore, the representation of such bit pattern is represented in short notation called hexadecimal notation.  Hexadecimal notation takes advantage of the fact that bit patterns within a machine tend to have lengths in multiples of four.  Example  101101010011. can be divided into the following: 1011 0101 0011 © Asim Balarabe Yazid 10 Hexadecimal encoding system © Asim Balarabe Yazid 11 Main memory  A computer contains a large collection of circuits (such as flip-flops), each capable of storing a single bit. This bit reservoir is known as the machine's main memory.  Memory structure: Information is store in manageable units called a cell, each cell has a capacity of 8 bits which is equivalent to 1 byte.  Computers with small memory capacity may have a main memories consisting of a few hundred cells, whereas computers with large memory capacity may have billions of cells in their main memories.  Memory cell are arrangement in form of a row © Asim Balarabe Yazid 12 Main memory  How to identify individual cells in a computer main memory?  Assigning a unique address to every cell © Asim Balarabe Yazid 13 Main memory  How can we access the content of memory cell?  Read operation  Write operation  the circuitry that actually holds the bits is combined with the circuitry required to allow other circuits to store and retrieve data from the memory cells. In this way, other circuits can get data from the memory by electronically asking for the contents of a certain address (called a read operation), or they can record information in the memory by requesting that a certain bit pattern be placed in the cell at a particular address (called a write operation). © Asim Balarabe Yazid 14 Main memory  Why computer main memory is often called random access memory (RAM)?  Why some computers are faster than others?  Refresh circuit  Computers memory constructed from such technology is often called dynamic memory (DRAM) or Synchronous DRAM (SDRAM). © Asim Balarabe Yazid 15 Unit of measuring memory capacity Unit & Description  Bit (Binary digit)  A binary digit is logical 0 and 1 representing a passive or an active state of a component in an electric circuit.  Nibble  A group of 4 bits is called nibble.  Byte  A group of 8 bits is called byte © Asim Balarabe Yazid 16 Mass Storage  Due to the limited storage capacity of main memory most computers have additional memory capacity called a mass storage (or secondary storage) such as the following:  Magnetic disks  CDs  DVDs  Flash drives, etc.  Advantage and disadvantage of mass storage? Flexibility Motion  Terminologies used for differentiating the memory; on-line and off-line © Asim Balarabe Yazid 17 Disk storage system © Asim Balarabe Yazid 18 Mass storage system Back in 1956, disk storage are huge © Asim Balarabe Yazid 19 Flash drive Flash memory technology has the potential of alleviating drawback of magnetic and optic technology storage that required physical motion. In a flash memory system, bits are stored by sending electronic signals directly to the storage medium where they cause electrons to be trapped in tiny chambers of silicon dioxide, thus altering the characteristics of small electronic circuits. Since these chambers are able to hold their captive electrons for many years, this technology is suitable for off-line storage of data. © Asim Balarabe Yazid 20 Representing information as bit patterns  Text  Numerical data  Images  Sound © Asim Balarabe Yazid 21 Representing text  Is represented by a code which is assigning a unique bit pattern to each character in a text. The text is then represented in a long string of bit.  Back in 1940s and 1950s there are several code that lead to communication problems. To overcome this situation the American Standard Code for Information Interchange (ASCII)  This code uses bit pattern of 7 length for upper, lowercase letters, tab, line break. Later extended to 8 bit pattern per symbol by adding a 0 at most significant end of each of the 7 bit pattern. © Asim Balarabe Yazid 22 Representing numeric value  Number are encoded into bit 0 and 1 each digit in a group of 4 bit pattern. # Bit 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1111 More precise later © Asim Balarabe Yazid 23 Representing images  Image is represented as a collection of dot which called pixel, short for picture element.  A black and white image is encoded as a long string of bits representing the rows of pixels in the image, where each bit is either 1 or 0 depending on whether the corresponding pixel is black or white. This is the approach used by many machines.  Color images; RGB encoding is use © Asim Balarabe Yazid 24 Representing sound (1) The most generic method of encoding audio information for computer storage and manipulation is to sample the amplitude of the sound wave at regular intervals and record the series of values obtained. For instance, the series 0, 1.5, 2.0, 1.5, 2.0, 3.0, 4.0, 3.0, 0 would represent a sound wave that rises in amplitude, falls briefly, rises to a higher level, and then drops back to 0. © Asim Balarabe Yazid 25 Binary notation In previous slide, we saw that binary notation is a means of representing numeric values using only the digits 0 and 1 rather than the ten digits 0 through 9 that are used in the more common base ten notational system. © Asim Balarabe Yazid 26 Conversion from radix 2 to radix 10 © Asim Balarabe Yazid 27 Conversion from radix 10 to radix 2 © Asim Balarabe Yazid 28 Binary arithmetic  Modern computers usually use binary representation of numerical data, therefore, numerical calculations must be done in radix-2 as well  Binary calculation is similar to radix 10 calculation where you add some number and take a reminder depending on the position of the number. Let look at the following examples. (a) (b) © Asim Balarabe Yazid 29 Binary representation of fraction © Asim Balarabe Yazid 30 Representing integers  The process of representing integer (i.e positive and negative) in todays’ computer is called twos’ complement 0111 1000 +1 1001 © Asim Balarabe Yazid 31 Method for twos’ complement representation We merely copy the original pattern from right to left until a 1 has been copied, then we complement the remaining bits as they are transferred to the final bit pattern © Asim Balarabe Yazid 32 Method for twos’ complement representation © Asim Balarabe Yazid 33 Summary  Information representation in computer and some operation on them.  Text  Images  Sound  Numeric  Memory of computer  Main memory  Mass storage (secondary storage)  Measure of memory capacity © Asim Balarabe Yazid 34 Glimpse of next class  Computer architecture  The CPU basics  ALU  Control unit  Register unit  Machine instruction  Data transfer  ALU  Control © Asim Balarabe Yazid 35 Lecture 01 ends Question?? Thank you for coming. © Asim Balarabe Yazid 36

Use Quizgecko on...
Browser
Browser