CCS2412 - Lecture Notes 1 PDF
Document Details
Uploaded by PureHyperbole2059
ZCAS University
Tags
Related
- INF 1101 Introduction to Computer Systems PDF
- Computer Architecture & Organization Lecture 1 PDF
- Lesson 1 - Introduction to Computer Organization PDF
- Computer Organization and Architecture Lecture Notes PDF
- Computer Organization and Architecture Past Paper PDF (2024-25)
- Introduction to Computer System PDF
Summary
These are lecture notes for a computer science course, covering foundational concepts like computer architecture and organization and binary representation. The notes offer detailed explanations and examples.
Full Transcript
CCS2412 - LECTURE NOTES 1 OMPUTER ORGANISATION AND ARCHITECTURE Topic 1 Introduction Computer Organization and Architecture is used to design computer systems. Computer Architecture is considered to be those attributes of a system that are visible to the user like addressing techniques, instr...
CCS2412 - LECTURE NOTES 1 OMPUTER ORGANISATION AND ARCHITECTURE Topic 1 Introduction Computer Organization and Architecture is used to design computer systems. Computer Architecture is considered to be those attributes of a system that are visible to the user like addressing techniques, instruction sets, and bits used for data. It has a direct impact on the logic execution of a program. It defines the system in an abstract manner, and deals with What does the system do. Whereas, Computer Organization is the way in which a system has to structure, its operational units, the interconnections between them that achieve the architectural specifications. It is the realization of the abstract model. It deals with How to implement the system. GENERAL INTRODUCTIONS 1. A Simple Understanding of a Computer Introduction : A computer is an electronic device that can process and store information. It can perform calculations, manipulate data, and execute instructions to accomplish specific tasks. The basic components of a computer include the central processing unit (CPU), memory (RAM), storage (hard drive or solid-state drive), input devices (keyboard, mouse, etc.), output devices (monitor, printer, etc.), and various peripheral devices (such as USB drives or external hard drives). The CPU is often considered the brain of the computer, as it performs most of the processing and calculations required for a computer to function. RAM is the temporary memory that stores data and instructions while the computer is running. Storage is the long-term memory where data is stored even when the computer is turned off. Input devices allow users to input data or commands into the computer, while output devices display the results of the computer’s processing. Peripheral devices are additional components that can be added to a computer to enhance its functionality. A computer is an electronic device that can perform tasks based on instructions provided to it. It consists of hardware components such as the central processing unit (CPU), memory, input/output devices, and storage devices. The CPU is the brain of the computer and performs the bulk of the processing tasks. Memory, also known as RAM, is where data and instructions are temporarily stored while the computer is running. Input/output devices, such as a keyboard, mouse, and monitor, allow users to interact with the computer and receive information from it. Storage devices, such as a hard drive or solid-state drive, store data and programs permanently on the computer. Computers can run different types of software, including operating systems, applications, and games. They can also be connected to the internet and used to access online services, communicate with other people, and share information. Overall, computers are incredibly versatile machines that have become an integral part of modern life, used for work, entertainment, education, and many other purposes. Computer is a device that makes our work easy. Computer is a device that helps us to complete our task easily and speedily. Computer doesn’t have a brain like human beings. We have to give them instructions on what to do when a particular situation arises. We have to tell them everything from what to expect for data (what type of data), how to process it (how to perform calculations) and where to store the data. We humans, understand language that is composed of words which further is composed of letters. Computers do not understand our language nor the words like “hello, good morning, discipline, etc”. Computers only understand binary language whose vocabulary contains only two letters or states or symbols i.e. 0 and 1, True and False, On and off. To maintain the states transistors are used. Transistors are tiny device that are used to store 2 values 1 and 0 or on and off. If the transistor is “on” we say that it has a value 1, and if it is “off” the value is 0. For example, a memory chip contains hundreds of millions or even billions of transistors, each of which can be switched on or off individually. A transistor can store 2 distinct values, and we can have millions of different values stored on a memory chip consisting entirely of 0’s and 1’s. But how does a transistor get its value? When a very little amount of electric current passes through transistor it maintains the state of 1 and when there is no electric current then the transistor has the state of 0. How is all this connected to computer? This 0’s and 1’s forms the building block of computer. With the combinations of 0 and 1 we create a whole new language For example, 0 can be written as 0, 1 as 1 2 as 10 3 as 11 4 as 100 5 as 101 a as 01100001 A as 01000001 s as 01110011 U as 01010101 Hello as, 01001000 01100101 01101100 01101100 01101111 Hello World! as, 01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001 And so on… ASCII Computer Code Computers work in binary code. Information is coded using 0s and 1s. Each 0 or 1 is called a bit. In the early years of computer development, different computer companies applied the binary system in their own way. The code for the letters in the word “cat” was often different in different brands of computers. Eventually, a set of standards was developed. Computer manufacturers agreed to use one code called the ASCII (American Standard Code for Information Interchange). ASCII is an 8-bit code. That is, it uses eight bits to represent a letter or a punctuation mark. Eight bits are called a byte. A binary code with eight digits, such as 1101 1011, can be stored in one byte of computer memory. The word "CAT" in a word processor becomes 0100 0011, 0100 0001, and 0101 0100. The word "cat" is 0110 0011, 0110 0001, and 0111 0100. The word CAT becomes 01000011 01000001 01010100 While cat is 01100011 01100001 01110100 Each letter, number, and symbol is represented by an 8-bit ASCII code. Part of the ASCII code is given in the slide below. Notice that there is even an ASCII code for a blank space. What would be the ASCII code for the word “Cat” Since there are 8 bits in a byte, there are 2^8 different possible sequences for one byte, ranging from 00000000 to 11111111. This means that a byte can be used to represent any type of value with no more than 2^8 = 256 possible values. Since the number of things that you can enter on a computer keyboard is smaller than 256, characters (letters, decimal digits and special characters such as punctuation marks, etc) can be represented with bytes. A standard is needed to ensure that the code system that is used on your computer is the same as the code that is used on mine. ASCII, the American Standard Code for Information Interchange, is the code that is most commonly used today. Since these codes are limited to 256 possible combinations, certain character sets, such as Chinese, Arabic, Japanese, Klingon and others, cannot be represented using these codes. This problem is solved by using another code, Unicode, which uses 2 bytes for each character. This extension allows 2^16 different symbols to be represented, a total of 65,536. The use of Unicode gives more flexibility in the representation of data. The drawback of using Unicode is that it takes twice as much space to store the same number of characters. A word is the number of bits that are manipulated as a unit by the particular CPU of the computer. The size of the words used by a computer’s central processing unit (CPU) depends on the bit-processing ability of the CPU. A 32-bit processor, for example, can use words that are up to four bytes long (32 bits). Computers are often classified by the number of bits they can process at one time. Today most CPUs have a word size of 32 or 64 bits. Data is fetched from memory to the processor in word size chunks and manipulated by the ALU in word size chunks. All other things being equal, (and they never are), larger word size implies faster and more flexible processing. Bits, Bytes and Words In Summary: - A Bit: (Short for binary digit) is the smallest unit of information on a machine "computer". A single bit can hold only one of two values: 0 or 1. - A Byte: A sequence of adjacent bits, usually eight, that is used to represent a character: 1 Byte = 8 Bits. - A Word: It is a number of bits that can be manipulated as a unit. The size of a word varies from one computer to another, depending on the CPU. For computers with a 32-bit processors, a word size is 32 bits (4 bytes). On some computers with 64-bit processors, a word size is 64 bits (8 bytes). Activities 1. Use the ASCII code to write your first name or nickname in binary numbers beginning with an uppercase letter and continuing with lowercase letters. Put the letters of your name in the first column. 2. On a separate sheet of paper, write a short message in ASCII. Exchange messages with a partner and decode each other's message. 3. The ASCII code for a blank space is the decimal number 32, or the binary number 0010 0000. Why do you think it is important to have a code for a blank space? 4. How many characters of text are there in an average book? To help answer this question, select several different books of varying lengths. For each book, estimate the number of characters of text. Remember to count the punctuation marks and include the blank character between words and sentences. Since ASCII is an 8-bit code and requires 8 binary numbers to represent each letter, blank space, or punctuation mark, how many binary numbers does it take to represent the text of an average book? (Hint: Multiply 8 by the average number of text characters.) So now the question arises how can a human remember this code? It seems impossible! Well, we humans can do everything that we desire and this code can be remembered very easily but we don’t have to remember. We just have to use our language and the software (also built by human) converts our normal letters into the binary language. Data Storage in a Computer System All different forms of data are treated in the same manner (stored, processed & transmitted). They all have to be converted into an equivalent string of zeros and ones. Three categories for data are usually: Text / Numbers Sound / Voice Video / Moving Pictures Integer and Character Representations Both the integers and characters are represented in the computer system as bytes; ie eight bits. For an integer, we only need to convert that integer (decimal) to an equivalent number in base two (binary): From base 10 to base 2. For a character, one needs to be given the byte for another character which could then be used to deduce the byte for another character. Charact Bit Byte Charact Bit Byte er pattern numbe er pattern numbe r r A 01000001 65 ¼ 1011110 188 0 B 01000010 66. 0010111 46 0 C 01000011 67 : 0011101 58 0 a 01100001 97 $ 0010010 36 0 b 01100010 98 \ 0101110 92 0 o 01101111 111 ~ 0111111 126 0 p 0111000 112 1 0011000 49 0 1 q 0111000 113 2 0011001 50 1 0 r 0111001 114 9 0011100 57 0 1 x 0111100 120 © 1010100 169 0 1 y 0111100 121 > 0011111 62 Thus, when you type a 'C' on the keyboard, circuitry on the keyboard and in the computer converts the 'C' to the byte: 01000011 and stores the letter in the computer's memory as well as instructing the monitor to display it. The Figure below shows the letter ‘K’ being converted to an equivalent byte in ASCII Coding System. Character As a Byte Character Representation If the person typed the word "CAB", it would be represented by the following three bytes in the computer's memory: 01000011 C 01000001 A 01000010 B Think of it as three rows of eight switches in memory being ON or OFF. Measurement of the data in a computer system 8 Bits = 1 Byte = 1 Character (Demo using a notepad) Because a byte represents only a small amount of information, amounts of computer memory and storage are usually given in 1,024 bytes = 1 Kilobyte, 1,048,576 bytes = 1,024 Kilobytes = 1 Megabyte 1,024 megabytes = 1 Gigabyte 1,024 gigabyte = 1 Terabyte A terabyte is equal to 1,024 gigabytes and there are lots of things bigger than one terabyte. 1,024 Terabytes = 1 Petabyte. 1,024 Petabytes = 1 Exabyte. 1,024 Exabytes = 1 Zettabyte. 1,024 Zettabyte = 1 Zottabyte. Computer manufacturers express the capacity of memory and storage in terms of the number of bytes it can hold. The number of bytes can be expressed as kilobytes. Kilo represents 2 to the tenth power, or 1024. Kilobyte is abbreviated KB, or simply K. A kilobyte is 1024 bytes. Thus, the memory of a 640K computer can store 640x1024, or 655,360 bytes. Memory capacity may also be expressed in terms of megabytes (1024x1024 bytes). One megabyte, abbreviated MB, means roughly one million bytes. With storage devices, manufacturers sometimes express memory amounts in terms of gigabytes (abbreviated GB); a gigabyte is roughly one billion bytes. Computer memory, or RAM, in some computers might hold 6 GB, or roughly 6 billion bytes. Some computer hard disks hold terabytes (e.g. 1 TB). Bits are the building blocks for all information processing that goes on in digital electronics and computers. Questions: 1. How much is 4GB of RAM when expressed in KB? [Show the working] 2. The hard disk space on a desktop computer is 512GB. How much data capacity is this in TB? [Show the working] 3. What is the maximum number of bits which can be stored in a 2KB memory device? [Show the working] 4. Tasila has a smart mobile phone whose memory capacity is 6GB. She decides to store some music files on her phone. On average, a typical mp3 encoded music file takes up 4MB of space. How many (maximum) of these music files (tracks) can she store on her phone? [Show the working] 5. A student’s 16GB Flash Disk is currently 95% full of data. To create more space on the Flash Disk, the student decided to delete 8,000MB of data. How much data in KB do we still have on the Flash Disk? [Show the Working] 6. On your laptop, you currently have 2500 documents with an average file size of 50KB, 5 movies using 2GB of space each, 1500 photos with an average file size of 3MB. If you decide to store all of these things in the cloud, what is the minimum storage space that you would need to purchase per month? Your answer should be in KB. [Show the working] QUESTIONS