ldp.pdf
Document Details
Uploaded by Deleted User
Tags
Full Transcript
Unit -1 Introduction Introduction What is Computer? "A computer is a programmable electronic device that takes data, perform instructed arithmetic and logical operations, and gives the output." Whatever is given to the computer as input is c...
Unit -1 Introduction Introduction What is Computer? "A computer is a programmable electronic device that takes data, perform instructed arithmetic and logical operations, and gives the output." Whatever is given to the computer as input is called 'data’, while the output received after processing is called 'information'. History of Computer The term 'Computer' was first introduced in 1640 and referred to as 'one who calculates'. It was derived from the Latin word 'computare', which meant 'to calculate’. When the computers were introduced, they were large and could fill an entire room. In 1833, Charles Babbage (known as the father of the computer) invented an early calculator, which was named as the 'difference engine’. Later in 1837, he introduced the first mechanical, general-purpose computer 'Analytical Engine’. Over time, computers became powerful in performance and small in size. Basic block diagram and functions of various components of computer Input All the data received by the computer goes through the input unit. The input unit comprises different devices like a mouse, keyboard, scanner, etc. In other words, each of these devices acts as a mediator between the users and the computer. The data that is to be processed is put through the input unit. The computer accepts the raw data in binary form. It then processes the data and produces the desired output. The 3 major functions of the input unit are- Take the data to be processed by the user. Convert the given data into machine-readable form. And then, transmit the converted data into the main memory of the computer. The sole purpose is to connect the user and the computer. In addition, this creates easy communication between them. CPU – Central Processing Unit Central Processing Unit or the CPU, is the brain of the computer. It works the same way a human brain works. As the brain controls all human activities, similarly the CPU controls all the tasks. Moreover, the CPU conducts all the arithmetical and logical operations in the computer. Now the CPU comprises of two units, namely – ALU (Arithmetic Logic Unit) and CU (Control Unit). Both of these units work in sync. The CPU processes the data as a whole. ALU – Arithmetic Logic Unit The Arithmetic Logic Unit is made of two terms, arithmetic and logic. There are two primary functions that this unit performs. Data is inserted through the input unit into the primary memory. Performs the basic arithmetical operation on it. Like addition, subtraction, multiplication, and division. It performs all sorts of calculations required on the data. Then sends back data to the storage. The unit is also responsible for performing logical operations like AND, OR, Equal to, Less than, etc. In addition to this it conducts merging, sorting, and selection of the given data. CU – Control Unit The control unit as the name suggests is the controller of all the activities/tasks and operations. All this is performed inside the computer. The memory unit sends a set of instructions to the control unit. Then the control unit in turn converts those instructions. After that these instructions are converted to control signals. These control signals help in prioritizing and scheduling activities. Thus, the control unit coordinates the tasks inside the computer in sync with the input and output units. Memory Unit All the data that has to be processed or has been processed is stored in the memory unit. The memory unit acts as a hub of all the data. It transmits it to the required part of the computer whenever necessary. The memory unit works in sync with the CPU. This helps in faster accessing and processing of the data. Thus, making tasks easier and quicker. There are two types of computer memory- 1. Primary Memory 2. Secondary Memory Primary memory – This type of memory cannot store a vast amount of data. Therefore, it is only used to store recent data. The data stored in this is temporary. It can get erased once the power is switched off. Therefore, is also called temporary memory or main memory. RAM stands for Random Access Memory. It is an example of primary memory. This memory is directly accessible by the CPU. It is used for reading and writing purposes. For data to be processed, it has to be first transferred to the RAM and then to the CPU. Secondary memory – As explained above, the primary memory stores temporary data. Thus it cannot be accessed in the future. For permanent storage purposes, secondary memory is used. It is also called permanent memory or auxiliary memory. The hard disk is an example of secondary memory. Even in a power failure data does not get erased easily. Output There is nothing to be amazed by what the output unit is used for. All the information sent to the computer once processed is received by the user through the output unit. Devices like printers, monitors, projectors, etc. all come under the output unit. The output unit displays the data either in the form of a soft copy or a hard copy. The printer is for the hard copy. The monitor is for the display. The output unit accepts the data in binary form from the computer. It then converts it into a readable form for the user. Concepts of Hardware and software Hardware The term hardware refers to mechanical device that makes up computer. Computer hardware consists of interconnected electronic devices that we can use to control computer’s operation, input and output. Examples of hardware are CPU, keyboard, mouse, hard disk, etc. Software A set of instructions that drives computer to do stipulated tasks is called a program. Software instructions are programmed in a computer language, translated into machine language, and executed by computer. Software can be categorized into two types − System software Application software System Software System software operates directly on hardware devices of computer. It provides a platform to run an application. It provides and supports user functionality. Examples of system software include operating systems such as Windows, Linux, Unix, etc. Application Software An application software is designed for benefit of users to perform one or more tasks. Examples of application software include Microsoft Word, Excel, PowerPoint, Oracle, etc. Compiler and interpreter Compiler The Compiler is a translator which takes input i.e., High-Level Language, and produces an output of low-level language i.e. machine or assembly language. The work of a Compiler is to transform the codes written in the programming language into machine code (format of 0s and 1s) so that computers can understand. Advantages of Compiler Compiled code runs faster in comparison to Interpreted code. Compilers help in improving the security of Applications. As Compilers give Debugging tools, which help in fixing errors easily. Disadvantages of Compiler The compiler can catch only syntax errors and some semantic errors. Compilation can take more time in the case of bulky code. Interpreter An Interpreter is a program that translates a programming language into a comprehensible language. The interpreter converts high-level language to an intermediate language. It contains pre-compiled code, source code, etc. It translates only one statement of the program at a time. Interpreters, more often than not are smaller than compilers. Advantages of Interpreter Programs written in an Interpreted language are easier to debug. Interpreters allow the management of memory automatically, which reduces memory error risks. Interpreted Language is more flexible than a Compiled language. Disadvantages of Interpreter The interpreter can run only the corresponding Interpreted program. Interpreted code runs slower in comparison to Compiled code. Concepts of Machine level, Assembly level and high level programming Machine-level language The machine-level language is a language that consists of a set of instructions that are in the binary form 0 or 1. Creating a program in a machine-level language is a very difficult task as it is not easy for the programmers to write the program in machine instructions. It is error-prone as it is not easy to understand, and its maintenance is also very high. A machine-level language is not portable as each computer has its machine instructions, so if we write a program in one computer will no longer be valid in another computer. Assembly Language The assembly language contains some human-readable commands such as mov, add, sub, etc. The problems which we were facing in machine-level language are reduced to some extent by using an extended form of machine-level language known as assembly language. Since assembly language instructions are written in English words like mov, add, sub, so it is easier to write and understand. As we know that computers can only understand the machine-level instructions, so we require a translator that converts the assembly code into machine code. The translator used for translating the code is known as an assembler. The assembly language code is not portable because the data is stored in computer registers, and the computer has to know the different sets of registers. High-Level Language The high-level language is a programming language that allows a programmer to write the programs which are independent of a particular type of computer. When writing a program in a high-level language, then the whole attention needs to be paid to the logic of the problem. A compiler is required to translate a high-level language into a low-level language.