Computer Organization and Architecture Lecture Notes PDF
Document Details
Uploaded by PureHyperbole2059
ZCAS University
Tags
Summary
These lecture notes cover computer organization and architecture. The document explains the difference between computer organization and computer architecture. It details hardware components like the CPU, memory, input/output devices, and how they interact. It also discusses topics like software, binary code, algorithms, programming languages, high-level and low-level languages, and translators.
Full Transcript
CCS2412 - LECTURE NOTES 2 OMPUTER ORGANISATION AND ARCHITECTURE Computer Organization Vs Computer Architecture "Computer organization" and "computer architecture" are related terms in the field of computer science. However, they refer to different aspects of how computers are designed...
CCS2412 - LECTURE NOTES 2 OMPUTER ORGANISATION AND ARCHITECTURE Computer Organization Vs Computer Architecture "Computer organization" and "computer architecture" are related terms in the field of computer science. However, they refer to different aspects of how computers are designed and structured. Here's a comparison between the two terms: Computer Organization: Computer organization refers to the way hardware components are arranged and interconnected to form a computer system. It deals with the internal structure and design of the computer's hardware components, such as the CPU (Central Processing Unit), memory, input/output devices, and how they interact with each other. Key points about Computer Organization: Components: Focuses on the individual hardware components and their arrangement within the computer system. Interconnections: Deals with how components are connected to each other to enable communication and data transfer. Data Path: Involves the data path that data takes as it moves between different hardware units. Control Unit: Addresses how the control unit manages and coordinates the activities of various hardware components. Microarchitecture: Refers to the design decisions at a very detailed level, such as the design of registers, pipelines, and cache systems. Computer organization is concerned with the low-level details of hardware design, including timing, logic gates, circuits, and how individual components work together to execute instructions. Computer Architecture: Computer architecture, on the other hand, is broader in scope and encompasses the design and organization of both hardware and software elements that make up a computer system. It deals with the overall structure, functionality, and design principles that guide the development of computer systems. Key points about Computer Architecture: Instruction Set Architecture (ISA): Defines the set of instructions that a computer's hardware can execute and how those instructions are encoded. Memory Hierarchy: Addresses the organization of memory subsystems, including cache memory and main memory. Parallelism and Pipelining: Examines techniques for improving performance through parallel processing and instruction pipelining. Performance Optimization: Focuses on optimizing the system's performance through techniques like pipelining, caching, and instruction-level parallelism. System-Level Design: Includes considerations of input/output, memory management, interrupts, and system-level interactions. Computer architecture looks at the big picture of how a computer system works, including both hardware and software aspects. It defines the high-level structure and principles that guide the design of computers and their components. In summary, computer organization deals with the internal hardware design and component arrangement. It deals with How the system is implemented. while computer architecture encompasses the broader design principles and functionality of a computer system, including hardware and software aspects. It deals with What the system does. Basic Attributes, Features and Processes What is Software? Software is a set of instructions that tells the computer what to do, when to do, and how to do. Example are, MS Excel that we use in Microsoft, WhatsApp and games, all are the types of different software. Suppose we want to add 2 numbers and want to know the answer. Then we must give the computer instructions, Step-1: take 2 value. Step-2: store that 2 value Step-3: add 2 value by using + operator Step-4: save the answer Separate instructions are provided for the + operator so the computer knows how to do addition when it encounters + sign. So, what converts the code? And the answer to the question is a software called translator which translates our language code into machine language /code that can be understood by the computer. There are two main types of translators (Compiler and Interpreter) and these are briefly explained below: Now the question is how do we give our input? We give our input with the use of hardware. For example scanner, keyboard, mouse (not the one that eats cheese). When we give input through hardware, the software translates it into machine language and then it is processed and our output is shown. Process: If we want to display letter ‘A’ on screen we will first open notepad. Then we will press Caps lock key or shift key to make letter capital, after that we will press letter ‘a’. And our screen will show the letter ‘A’. Below are some related concepts that can help in understanding computers: Binary Code: Computers communicate and process information using a binary code, which is a system of ones and zeroes. Each binary digit (or bit) represents a simple “on” or “off” state, and combinations of bits can represent more complex information. Algorithms: An algorithm is a set of instructions or steps that a computer program follows to solve a problem or complete a task. Algorithms are used to perform a wide range of tasks, from sorting data to searching for patterns. Programming Languages: Programming languages are used to write computer programs. There are many different programming languages, each with its own syntax and set of rules. Hardware vs Software: Hardware refers to the physical components of a computer, such as the CPU, memory, and storage devices. Software, on the other hand, refers to the programs and instructions that tell the hardware what to do. Networks: Computers can be connected together in networks, which allow them to communicate and share resources. Networks can be wired or wireless, and can be used for tasks such as sharing files, accessing the internet, or playing multiplayer games. User interfaces: User interfaces are the means by which humans interact with computers. They can be graphical, such as a desktop or mobile operating system, or text- based, such as a command line interface. Types of Computer: Personal computers (PCs) / Microcomputers: These are the most common type of computer and are designed for personal use. PCs include desktops, laptops, and tablets. Servers / Minicomputers: Servers are designed to manage and distribute resources and data to multiple users or devices. They are often used in businesses or organizations to store and share data and run applications. Mainframes: Mainframe computers are large, powerful machines that are designed to handle massive amounts of data and perform complex operations. They are often used in large corporations or government agencies. Supercomputers: Supercomputers are extremely powerful computers that are designed to process data at extremely high speeds. They are often used for scientific research and other specialized applications. Embedded Systems: Embedded systems are small computers that are built inside other devices, such as appliances, cars, and medical devices. They are designed to perform specific functions and operate without human intervention. Wearable Computers: Wearable computers are small, portable devices that are worn on the body, such as smartwatches (examples include the Apple Watch, Samsung Galaxy Watch, and Fitbit Versa) or fitness trackers (examples include Fitbit devices, Garmin fitness trackers, and Xiaomi Mi Band), or Smart Glasses (examples include Google Glass and Microsoft HoloLens). They are designed to track data and provide information on the go. Features of a computer include: Processor: The processor is the brain of the computer, and it carries out all the instructions and calculations required by the system. Memory: The memory or RAM (Random Access Memory) stores data temporarily for the processor to access quickly. Storage: Storage devices like hard disks, solid-state drives, or external drives provide long-term storage for data and files. Input Devices: Input devices like keyboards, mice, scanners, and cameras enable the user to provide data and instructions to the computer. Output Devices: Output devices like monitors, printers, and speakers display the results of the computer’s processing. Operating System: The operating system manages the computer’s resources, controls the hardware, and runs application programs. Networking: Networking capabilities allow computers to communicate and share resources with other computers and devices. Software: Software is the set of instructions that tell the computer what to do, and it can range from simple applications to complex programs. Graphics and Sound: Graphics and sound capabilities enable the computer to display and manipulate images and play sounds and videos. Connectivity: Connectivity features like USB, Wi-Fi, Bluetooth, and Ethernet enable the computer to connect to other devices and the internet. CPU Components and Processes CPU Components and Processes The Central Processing Unit (CPU), sometimes referred to as the Processor, performs the system’s calculation and processing activities. The CPU is a microscopic circuitry that serves as the main information processor in a computer. On a higher level, the CPU is actually a number of interconnected processing units that are each responsible for one aspect of the CPU’s function. As a way of summarizing the CPU’s function, we shall briefly look at the five devices below: - RAM (Random Access Memory), - Registers, - Buses, - the ALU (Arithmetic and Logic Unit), - the Control Unit. 1. RAM: Random Access Memory. RAM and Memory are normally used interchangeably. RAM holds the program instructions and the data that is required for processing. It is located external to CPU and is much slower than Registers. Generally, data has to be loaded into a CPU Register from RAM before the CPU can process it. RAM is temporary; that is, its contents can be changed at any time and it is erased when power to the computer is turned off. Cache is also a local memory that is used to temporarily store the information available in the RAM for faster access during 2. Registers These components are special memory locations that can be accessed very fast. They are small local memory locations inside the chip that temporarily stores the instructions (and / or data) which is currently being worked on by the processing units. There are many components, with different functions, that are generally referred to as Registers. More on the registers will be re-visited at a later time. 3. Buses These components are the information highway for the CPU. Buses are bundles of tiny wires that carry data and / or signals between components. Each bus contains several wires that allow for the parallel transmission of information / signals between various CPU hardware components. The three popular buses are the address bus, the data bus, and the control bus. 4. ALU: Arithmetic and Logic Unit This component is the number cruncher of the CPU. Arithmetic and Logic Unit (ALU) perform: basic arithmetic (such as add, subtract, multiply and divide), comparisons (greater than, less than, and equal to), and logical operations (and, or, and not) and a host of other calculations on binary numbers. The Arithmetic and Logic Unit is composed of complex circuitry. 5. Control Unit: This component is responsible for directing the flow of instructions and data within the CPU by issuing control signals to different components. This is done after decoding / interpreting the instructions which have been fetched from memory. The Control Unit is actually built of many other selection circuits such as decoders and multiplexors. Advantages of computers 1. Increased efficiency and productivity: Computers can perform tasks much faster and more accurately than humans, allowing for increased efficiency and productivity in various industries. 2. Storage and Organization of Information: Computers can store large amounts of data and organize it in a way that is easily accessible and searchable. 3. Improved communication: Computers enable people to communicate easily and instantly with others, regardless of their location. 4. Access to Information and Resources: The internet provides access to a vast amount of information and resources that would otherwise be difficult or impossible to obtain. 5. Automation of Repetitive tasks: Computers can automate repetitive and mundane / routine tasks, freeing up time and resources for more important work. Disadvantages of computers: Dependence on Technology: Over-reliance on computers can lead to problems if they break down or malfunction, leading to loss of productivity and data. Security Risks: Computers can be vulnerable to viruses, malware, and hacking, leading to data breaches and other security risks. Social Isolation: The overuse of computers can lead to social isolation and reduced face-to-face interaction, leading to social and emotional problems. Environmental Impact: The production and disposal of computers can have a negative impact on the environment due to the use of resources and the creation of electronic waste. Job Displacement: Automation and the use of computers can lead to job displacement in certain industries, requiring workers to adapt to new skill sets or find new employment. High Level and Low Level Languages A language is basically a mode of communication, because it is used to share information, ideas, and opinions. In computer systems, programming languages are used by the software developers or programmers to creates applications or software systems. A programming language provides a way of writing computer instructions that are used to perform a specific task. Examples of computer programming languages include C, C++, Java, JavaScript, Python, Ruby, Scala, Perl, C#, Groovy, Dart, etc. Based on the closeness of a programming language to the system hardware (mainly processor), computer programming languages are classified into two categories namely, high-level languages and low-level languages. The most fundamental difference between the two is that: low-level languages are closer to the system hardware and require the knowledge of hardware to write the instructions; whereas high-level programming languages are the machine independent languages that do not require the hardware knowledge to write instructions. What is a High-Level Language? A High-Level Language (HLL) is a computer programming language that uses English like statements to write the computer instructions. High-Level Languages are most widely programming languages because they are easy to understand by human being. HLLs are designed with operator / programmer in mind. They give programmers the ability to write code quickly, debug and maintain it. Below is a list of some important characteristics associated to high-level languages: It can easily be interpreted as well as compiled in comparison to low-level language. It can be considered as a programmer-friendly language. It is easy to understand. It is easy to debug. It is simple in terms of maintenance. It requires a compiler/interpreter to be translated into machine code. It can be run on different platforms. It can be ported from one location to another. It is less memory efficient, i.e., it consumes more memory in comparison to low-level languages. Examples of high-level languages include C, C++, Java, and Python. It is widely used. What is a Low-Level Language? A Low Level Language is also a category of computer programming languages that relate to specific architecture and hardware of a particular computer system; from machine code, binary and hexadecimal. Because of this, low-level language is sometimes also known as machine language / machine code. A machine code is: A language commonly written in hexadecimal and binary form. Not a widely used language due to the complexity i.e. difficult for programmers to work with and understand. An assembly language, which is written using mnemonics and / or abbreviations of English words, is considered to be part of the low-level language category. This is mainly because it is written in machine dependent instructions and would normally have a one-to-one mapping with an associated machine language. The assembly language is more direct and quicker when used in a computer system (in comparison to high-level languages). Assembly languages need a translator in order to be translated into machine code (binary). Low-Level Languages (including Assembly Languages) are not user-friendly to human-beings and are therefore not commonly used by programmers. However, Low-Level Languages are more friendly for machine because the computer processor can generally “directly” process the codes written in the low-level language. Below is a list of some important characteristics associated to high-level languages: It can be understood easily by the machine. It is considered as a machine-friendly language. It is difficult to understand. It is difficult to debug. Its maintenance is also complex. It is not portable. It depends on the machine; hence it can not be run on different platforms. It requires an assembler that would translate instructions: from assembly language to machine code. It is not used widely in today's times. To conclude, high-level languages are more friendly for the programmer because they use “English-like statements” in the codes; Whereas low-level languages are more machine-friendly because they generally use “binary language codes” to write the computer instructions. Translators: Computers do not understand any programming language that are normally used by programmers. These programming languages should therefore be translated into machine code / machine language. Technology makes use of translators as computers are unable to recognize anything that is not 0 or 1. We have different types of translators; explained below: Compiler – A compiler is a program that translates the entire source code of a high-level programming language into machine code or another lower-level representation (intermediate code). The translation process performed by a compiler involves several stages, which include the syntax analysis and code generation (object code). The resulting compiled code can be executed directly by the computer’s hardware; independently of the original source code. A compiler translates HLL to machine code. The resulting code (object code) can be reused after translation. Compilers typically perform optimizations and produce more efficient code. Common examples include the GCC compiler for C/C++ and the Java Compiler for Java. In summary, we can say: A compiler takes the entire source code as input and generates machine code or intermediate code as output. The generated code is typically saved in a separate file and can be executed multiple times without the need for recompilation. Interpreter – An interpreter is a program that directly executes source code written in a high-level programming language. It is a software tool that reads and executes the source code of a program line by line, translating and executing each line immediately after reading it. In other words, Interpreters do not produce a separate executable file; they interpret and execute the source code directly. This approach allows for more dynamic execution and easier debugging since errors are often caught as the code is being executed. An interpreter reads and performs actions from HLL. It does not reuse code (It will not remember the code and store even if you run it multiple times). Interpreters are known for providing immediate feedback and are often used in scripting languages like Python, JavaScript, and Ruby. In summary, an interpreter: executes the source code line by line without creating any other file; provides immediate feedback in cases where syntax errors are encountered. Assemblers – An assembler is a program that translates assembly language code into machine code. Assembly language is a low-level programming language that is closely related to the architecture of a computer's CPU. Assemblers convert assembly language mnemonics and / or English word abbreviations (symbolic instructions) into binary code / machine code that the computer's CPU can directly execute. The translated version is commonly used by internal components such as the CPU. Using an Integrated / Interactive Development Environment (IDE): Most high level programming languages offer the use of an IDE for program development. This contains an editor with an interpreter and/or compiler together with debugging tools, which can improve the speed of program development. QUESTIONS