Document Details

MatureCotangent

Uploaded by MatureCotangent

Graphic Era Deemed to be University

Tags

computer science computer architecture computer networks introduction to computers

Summary

This document provides an introduction to computers, covering topics such as generation of computers, computer system memory hierarchy, input/output, RAM/ROM, software and hardware, algorithms, and flowcharts.

Full Transcript

UNIT-I INTRODUCTION TO COMPUTERS & ALGORITHMS & FLOWCHARTS Topics: Generation of computers, Computer system memory hierarchy, Input / Output, RAM/ROM, Software & Hardware, Understand bit, byte, KB, MB, GB and their relations to each other, Operating System overview, Comput...

UNIT-I INTRODUCTION TO COMPUTERS & ALGORITHMS & FLOWCHARTS Topics: Generation of computers, Computer system memory hierarchy, Input / Output, RAM/ROM, Software & Hardware, Understand bit, byte, KB, MB, GB and their relations to each other, Operating System overview, Computer Networks Overview. Algorithms and Flow Charts – Examples of Flow charts for loops and conditional statements. --8 Hrs Why Computer? Increases the productivity and efficiency. Can crunch data at lighting speed. Can store vast amounts of information and reduce wastage of resources otherwise. Helps sort, organize, and search through information. Connects to the vast world of information through the Internet. Gets a better understanding of data. Allows to keep connected with each other. Can help in making a decision using the vast data. Introduction to computers Computer is an electronic device that accepts input as data, processes it & stores temporarily into a storage device and gives out useful output. RAW DATA INFORMATION COMPUTER INPUT OUTPUT PROCESSING A program is a sequence of instructions written using a computer programming language to perform a specified task. Computers have power to perform billions of calculations in fraction of seconds. They are very accurate and are reliable. Data? Data represents facts and figures. Examples Ram scored 99% marks. Max. Temperature today at Dehradun was 25 degrees centigrade. Mumbai had a rainfall of 220mm on 20th July 2020. BSE : Sensex was trading at 40,000 points. The above examples talk about facts and figures. The examples in the previous slide demonstrate that they are some facts but does not make much sense. Now lets analyze the following: – Ram scored 99% marks and stood first to the class. – He was the highest scorer in the University. – He secured a rank amongst the first 10 students in the state. Characteristics of computers Speed Accuracy Automatic Diligence Memory No I.Q. Economical Versatile Applications of computers Word Processing Internet Digital Audio or Video Composition Desktop Publishing e-Business Bioinformatics Health care GIS and Remote Sensing Meteorology Multimedia and Animation Legal System Retail Business Generation of computers The computers of today have originated in the second half of the twentieth century. As the technology improved in physics and electronics there was evolutionary developments in the hardware and software of computers. Sooner the computer started to evolve, and the technological advancement marked a generation of computers. 1. First Generation of Computers: Computers were developed between 1940–1956 and were called the first-generation computers. They were large and limited to basic calculations. They consisted of large devices like the vacuum tubes. The input method of these computers was a machine language known as the 1GL or the first-generation language. The data was entered using physical methods such as punch cards, paper tape, and magnetic tape into those computers. Examples of the first generation computers include ENIAC, EDVAC, UNIVAC, IBM-701, and IBM-650. J.P.Eckert and J.W.Mauchy invented the first successful electronic computer called ENIAC, that stands for “Electronic Numeric Integrated and Calculator”. These computers were large and very unreliable. They would heat up and frequently shut down and could only be used for very basic computations. Advantages: 1. They were made up of vacuum tubes which were the only electronic component available during those days. 2. These computers could do calculations in milliseconds. Disadvantages: 1. Heavy, Bulky, and very big in size, weighed about 30 tons. 2. These computers were very costly. 3. The vacuum tubes required a large cooling system. 4. Limited programming capabilities 5. Large amount of energy consumption. 6. Not reliable and frequent maintenance was required. 2 Second generation: Second generation Computers were developed between 1957-1963. These computers were more reliable and in place of vacuum tubes, they used transistors (semiconductors). Smaller in size compared to first generation computers. The input for these computers were higher level languages like COBOL, FORTRAN etc. Second generation computers were first to store instructions in memory, which moved from a magnetic drum to magnetic core technology. Second generation computers were first developed for the atomic energy industry. Examples of the second-generation computers include IBM 1620, IBM 7094, Honeywell 400, CDC 1604, CDC 3600, UNIVAC 1108. They were faster than their predecessors. Advantages: 1. Due to the presence of transistors instead of vacuum tubes, the size of electronic components decreased. 2. Less heating effect coz. energy consumed was less as compared to 1st generation of computers. 3. Assembly language and punch cards were used as input. 4. Low cost than first generation computers. 5. Better speed, could calculate in microseconds. 6. Better portability as compared to first generation Disadvantages: 1. A cooling system was required. 2. Constant maintenance was required. 3. Only used for specific purpose. 3 Third Generation of Computers: Computers developed in the third generation period of 1964 – 1971 differed from the first and the second generations by the fact that a new circuit element like IC’s (Integrated Circuits) were used. An integrated circuit is a small device that can contain thousands and thousands of devices like transistors, resistors and other circuit elements that make up a computer. Robert Noyce and Jack Kilby in 1958-1959 invented Integrated Circuit or the IC chips. With the invention of IC’s, it became possible to fit thousands of circuit elements into a small region and hence the size of the computers eventually became smaller and smaller. Computers that used IC’s during that period were, PDP-8 (Personal Data Processor), PDP-11, ICL 2900, IBM 360 series, IBM 370/168, Honeywell-6000 series. These computers had few megabytes of main memory and magnetic disks which could store few tens of megabytes of data per disk drive. High level programming languages like COBOL and FORTRAN were standardized by ANSI Some more high level programming languages like PL/I PASCAL and BASIC were introduced at this time. Third generation computers were the first to implement time sharing operating systems. Input to these computers could now be provided using keyboards and mouse. Advantages: 1. Faster than second generation computers and could perform 1 million transactions per second. 2. Smaller, cheaper and more reliable than their predecessors. 3. These computers had faster and larger primary memory and secondary storage. 4. Widely used for scientific as well as business applications. 5. During this generation of computers, standardization of existing high-level languages and invention of new high-level languages was done. 6. Had time sharing operating system which allowed interactive use of computer by one or more users simultaneously thereby improving the productivity of the users. Disadvantages: 1. IC chips were difficult to maintain. 2. Highly sophisticated technology was required for the manufacturing of IC chips. 3. A cooling system was required. 4 Fourth Generation of Computers: Fourth Generation of computers were developed between 1972 – 1989. These computers used VLSI technology or the Very Large Scale Integrated (VLSI) circuits technology and were based on microprocessor. Intel was the first company to develop a microprocessor. A microprocessor is used in a computer for any logical and arithmetic operation and to perform execute any program. Graphics User Interface (GUI) technology used provided more comfort to users. The first “personal computer” or PC developed by IBM, belonged to this generation. VLSI circuits had almost about 5000 transistors on a very small chip and were capable of performing many high-level tasks and computations. These computers were thus very compact and thereby required a small amount of electricity to run. Examples, STAR 1000, CRAY-X-MP (Supercomputer), DEC 10, PDP 11, CRAY- This generation of computers had the first “supercomputers” that could perform many calculations accurately. They were also used in networking and used higher and more complicated languages as their inputs. The computer languages like languages like C, C+, C++, DBASE etc. were the input for these computers. Advantages: 1. Fastest in computation and size was reduced as compared to the previous generation of computer. 2. Heat generated was negligible. 3. Small in size as compared to previous generation computers. 4. Required less maintenance. 5. All types of high-level language could be used in these types of computers. Disadvantages: 1. The Microprocessor design and fabrication were very complex. 2. Cooling system was required in many cases due to the presence of ICs. 3. Advance technology was required to make the ICs. 5 Fifth Generation of Computers: This is the present generation of computers and is the most advanced one. The generation began around 1990 and is the present generation of computers. The methods of input include the modern high-level languages like Python, R, C#, Java etc. The aim of the fifth generation is to make a device, which could respond to natural language input and was capable of learning and self-organizing. This generation is based on ULSI (Ultra Large Scale Integration) technology resulting in the production of microprocessor chips having millions and billions of electronic components. Examples include: Intel P4, i3 – i10, AMD Athlon, Desktop, Laptop, NoteBook etc. Advantages: 1. They are most reliable and work faster. 2. They are available in different sizes and unique features. 3. They come with more user-friendly interfaces with multimedia features. Disadvantages: 1. They tend to be sophisticated and complex tools. 2. They give more power to companies to watch what you are doing and even allow malicious users to infect your computer. 3. They may make the human brain dull. Computer System Memory Hierarchy Memory Hierarchy Design is divided into two main types: a) External Memory or Secondary Memory Comprising of Magnetic Disk, Optical Disk, Magnetic Tape i.e. peripheral storage devices which are accessible by the processor via I/O Module. b) Internal Memory or Primary Memory Comprising of Main Memory, Cache Memory & CPU registers. This is directly accessible by the processor. Fig. 1 Memory hierarchy The following characteristics of Memory Hierarchy can be made from above Fig. 1: i. Capacity: It is the total volume of information the memory can store. As we move from top to bottom in the hierarchy, the capacity increases. ii. Access Time: It is the time interval between the read/write request and the availability of the data. As we move from bottom to top in the hierarchy, the access time decreases. iii. Performance: Earlier computer system were designed without Memory Hierarchy, due to large difference in access time the speed gap increased between the CPU registers and Main Memory, which resulted in lower performance of the system and thus, enhancement was required. The performance of the system increased by minimizing the levels of memory hierarchy to access & manipulate data. iv. Cost per bit: As we move from bottom to top in the Hierarchy, the cost per bit increases i.e. Internal Memory is costlier than External Memory. Functional components of a Digital Computer Von Neumann proposed design architecture for an electronic digital computer with the following basic functional components as shown in Fig. 2. Input-Output unit Main Memory that stores data and instructions Processing unit contains arithmetic logical unit and processor registers Control unit that contains an instruction register and program counter Secondary device. Fig. 2 Components of a Digital Computer Input Unit: The input unit consists of input devices that are attached to the computer. These devices take input and convert it into binary language that the computer understands. Some of the common input devices are keyboard, mouse, joystick, scanner etc. Central Processing Unit (CPU): Once the information is entered into the computer by the input device, the processor processes it. The CPU is called the brain of the computer because it is the control center of the computer. It first fetches instructions from memory and then interprets them so as to know what is to be done. If required, data is fetched from memory or input device. Thereafter CPU executes or performs the required computation and then either stores the output temporarily in the memory or displays on the output device. The CPU has three main components which are responsible for different functions – Arithmetic Logic Unit (ALU), Control Unit (CU) and Memory registers. Arithmetic Logical Unit (ALU): The ALU, as its name suggests performs mathematical calculations and takes logical decisions. Arithmetic calculations include addition, subtraction, multiplication and division. Logical decisions involve comparison of two data items to see which one is larger or smaller or equal. Control Unit: The Control unit coordinates and controls the data flow in and out of CPU and also controls all the operations of ALU, memory registers and also input/output units. It is also responsible for carrying out all the instructions stored in the program. It decodes the fetched instruction, interprets it and sends control signals to input/output devices until the required operation is done properly by ALU and memory. Memory Registers: A register is a temporary unit of memory in the CPU. These are used to store the data that is directly used by the processor. Registers can be of different sizes(16 bit, 32 bit, 64 bit and so on) and each register inside the CPU has a specific function like storing data, storing an instruction, storing address of a location in memory etc. Memory : Memory attached to the CPU is used for storage of data and instructions and is called internal memory. The internal memory is divided into many storage locations, each of which can store data or instructions. Each memory location is of the same size and has an address. With the help of the address, the computer can read any memory location easily without having to search the entire memory. When a program is executed, it’s data is copied to the internal memory and is stored in the memory till the end of the execution. The internal memory is also called the Primary memory or Main memory. This memory is also called as RAM, i.e. Random Access Memory. Output Unit : The output unit consists of output devices that are attached with the computer. It converts the binary data coming from CPU to human understandable form. The common output devices are monitor, printer, plotter etc. Computer Memories Computer memory is an internal storage area used to store data and programs. Computer memory can be categorized into two major types which can be used to store data and programs. 1. Primary or Main memory 2. Secondary or Auxiliary memory While the main memory holds instructions and data when a program is executing, the auxiliary or the secondary memory holds data and programs not currently in use and provides long-term storage. The primary memory is volatile, so the data can be retained in it, only when the power is on. Moreover, it is very expensive and therefore limited in capacity. The secondary memory stores data or instructions permanently, even when the power is turned off. It is cheap and can store large volumes of data. Moreover, data stored in auxiliary memory is highly portable, as the users can easily move it from one computer to the other. The only drawback of secondary memory is that data can be accessed from it at a very slow speed as and when compared with the data access speed of primary memory. A memory is just like a human brain. The memory is divided into large number of small parts called cells. Each location or cell has a unique address. For example, if the computer has 64k words, then this memory unit has 64 * 1024 = 65536 memory locations. The address of these locations varies from 0 to 65535. 1. Primary or Main memory Primary memory holds only those data and instructions on which the computer is currently working. It stores instructions and data of a program in execution. It is volatile in nature, it can retain content as long as power is ON. It is expensive and also limited in capacity as compared to secondary memory i.e. it stores only the relevant data or instructions currently required for a program or application. They are made up of semiconductors. Very fast compared to secondary memory but slower than Internal CPU memory (Registers). Examples include RAM, ROM, etc and can vary in a size from 4 to 16 GB. Characteristics of Main Memory: These are semiconductor memories. It is known as the main memory. A computer cannot run without the primary memory. Usually volatile memory. Data is lost in case power is switched off. It is the working memory of the computer. Faster than secondary memories. RAM is of two types: − Static RAM (SRAM) Dynamic RAM (DRAM) Static RAM (SRAM): Flip Flop (latch) is used to represent 1 and 0’s. The word static indicates memory refresh is not required, it retains memory contents as long as power is being supplied. These are popular because of the following reasons: Simpler Design Faster and used as cache memory Highly Reliable Expensive and Long life The Fig.3 illustrates a static ROM chip. They find applications in digital Cameras, high end mobile phones. Fig. 3 Static RAM Dynamic RAM (DRAM): It is made up of combinations of Capacitor and Transistor. The Capacitor gradually discharges and must be continually refreshed in order to maintain the data. This is achieved by a refresh circuit that rewrites the data several times per second. It is used as RAM as shown in Fig.4. The following are the reasons it is preferred over static RAM: It is cheaper, smaller, higher capacity, forms major part of main memory. It has Short data lifetime Slower as compared to SRAM Smaller/Denser in size, Less expensive More power consumption Fig. 4 DRAM 2. Secondary Memory or Auxiliary memory It is used to store Data and programs that are not currently in use or not immediately required by the program. It stores the information permanently as long as user desires and is not dependent on power unlike primary memory. It’s Cheaper and can store very large quantity of data. Memory is organized into a number of partitions called as cells just like housing colony. Each cell has a unique address that can be used to identify and is used to store data permanently. The examples include Hardisk, Pen Drives, CD-ROM, DVD, Magnetic Tapes etc. Read Only Memory ROM stands for Read Only Memory Data stored in ROM also known as firmware. Generally used in PC to store instructions needed to Boot-up a computer. Non-volatile. Information is programmed/stored permanently in such memories ROM extensively used in electronic items like washing machine, Dishwasher, Cameras and microwave oven among others. Stores BIOS program used in the Computer Booting Process. Types of ROMs and their characteristics a. MROM (Masked ROM) These are Hard-wired devices that contain pre-programmed set of data or instructions supplied by the manufacturers. These programs once written cannot be changed. MROM are used in electronic devices like Washing machine, Smart TV’s, Microwave, refrigerator etc. b. PROM (Programmable Read Only Memory) PROM can be modified only once by the user/manufacturer. It can be programmed only once and is not erasable. They are used in devices such as cell phones, RFID tags, medical devices etc. c. EPROM (Erasable and Programmable Read Only Memory) EPROM can be erased by ultra-violet light. These can be modified by writing many a times by erasing and writing the contents. These are used in smart memory, memory sticks etc. d. EEPROM (Electrically Erasable and Programmable Read Only Memory) EEPROM is programmed and erased electrically. It can be erased and reprogrammed about ten thousand times. Selective location can be modified and programmed. They can be erased one byte at a time, rather than the entire chip. These find applications in flash memory, remote keyless systems, microcontrollers etc. Cache Memory Cache memory is a very high-speed semiconductor memory which can speed up the CPU. It acts as a buffer between the CPU and the main memory. It is used to hold those parts of data and program which are most frequently used by the CPU. The parts of data and programs are transferred from the disk to cache memory by the operating system, from where the CPU can access them. Cache memory is basically a portion of memory made of high-speed static RAM (SRAM) instead of the slower and cheaper dynamic RAM (DRAM) which is used for main memory. It’s the special memory having speed of access time much faster than RAM and hence is suitable for CPU to synchronize. It’s made of SRAM (Static RAM) and is smaller and much expensive than RAM. It is placed between CPU and RAM, as shown in Fig. 5, which acts like a buffer between CPU and RAM. CPU looks for Instructions and Data first in the Cache memory then into RAM. The idea is to fetch most frequently accessed data and instructions so that they are immediately made available to CPU. Fig. 5 Cache Memory Advantages of cache memory − 1. Cache memory is faster than main memory. 2. It consumes less access time as compared to main memory. 3. It stores the program that can be executed within a short period of time. 4. It stores data for temporary use. Disadvantages − 1. Cache memory has limited capacity. 2. It is very expensive. SEQUENTIAL AND RANDOM ACCESS: Memory devices can be accessed either randomly or sequentially. Computer - Memory Units Memory unit is the amount of data that can be stored in the storage unit. This storage capacity is expressed in terms of Bytes. 1. 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. A bit is a binary digit, the smallest unit of data on a computer. A bit can hold only one of two values: 0 or 1, corresponding to the electrical values of off or on, respectively. 2. Nibble: A group of 4 bits is called nibble. 3. Byte: A group of 8 bits is called byte. A byte is the smallest unit, which can represent a data item or a character. 4. Word: A computer word, like a byte, is a group of fixed number of bits processed as a unit. The length of a computer word is called word-size or word length. It may be as small as 8 bits or may be as long as 96 bits. Unit Equivalent 1 kilobyte (KB) 1,024 bytes 1 megabyte (MB) 106 bytes or 103 KB 1 gigabyte (GB) 109 bytes or 103 MB 1 terabyte (TB) 1012 bytes or 103 GB 1 petabyte (PB) 1015 bytes or 103 TB 1 exabyte (EB) 1018 bytes or 103 PB 1 zettabyte (ZB) 1021 bytes or 103 EB 1 yottabyte (YB) 1024 bytes or 103 ZB Practice Problems: Q 1: Karan has 600 MB of data. Kiran has 2000 MB of data. Will it all fit on Alice's 4 GB pen drive? Sol: Yes it fits: 600 MB + 2000 MB is 2600 MB. 2600 MB is 2.6 GB, so it will fit on the 4 GB drive no problem. Equivalently we could say that the 4 GB drive has space for 4000 MB. Q2: Janahavi has 100 small images, each of which is 500 KB. How much space do they take up overall in MB? Sol: 100 times 500 KB is 50000 KB, which is 50 MB. Q3: Assume a group is recording the sound inside a haunted House for 20 hours as MP3 audio files. About how much data will that be, expressed in GB? Sol: MP3 audio takes up about 1 MB per minute. 20 hours, 60 minutes/hour, 20 * 60 yields 1200 minutes. So that's about 1200 MB, which is 1.2 GB. Similarly, one 1 GB is 1,024 MB, or 1,073,741,824 (1024x1024x1024) bytes. A terabyte (TB) is 1,024 GB; 1 TB is about the same amount of information as all of the books in a large library. A petabyte (PB) is 1,024 TB. 1 PB of data, if written on a stack of CDs would create a stack of height a mile high. An exabyte (EB) is 1,024 PB. A zettabyte (ZB) is 1,024 EB. Finally, a yottabyte (YB) is 1,024 ZB. Computer languages Programming language is a language specifically designed to express computations that can be performed using the computer. These languages are used to create programs that are used to give the instructions. A programming language is a computer language that is used by programmers to communicate with computers. Programs is a set of instructions that can be executed by a computer to perform a specific task. Computer languages can be classified into three types: Machine Language Assembly Language High Level Language 1. Machine Level Language (MLL) Program is a set of instructions which are executed by the CPU using data to achieve an objective. CPU fetches an instruction, decodes or figures it out and then executes the instruction. Instructions are written in terms of 1s and 0s only i.e in Binary meaning ON/OFF, where ON represents 1 and 0 indicates OFF. These MLL differs from Computer to Computer based on hardware architecture. MLL is Fastest in execution & Efficient Code can be written. Extremely difficult to write and can make mistakes. MLL does not need a translator because it is already in the machine-readable form. For example: To representation 80 in the computer system it is represented as 1010000. So, it is very difficult to learn. To overcome this problem the assembly language was invented. 2. Assembly Level Language (ALL) Assembly language is easier to learn than Machine language. Assembly language uses mnemonics to represent data such as Mov, Add, Sub, End, etc. Assembly language is easy to understand and readable by human being as compared to machine language. Modifications and error fixing can be done in assembly language. It is slower in execution as compared to machine language. For example Stop 0000 Start 0001 Error 1111 Add 1010 It is easy to remember the assembly language because some alphabets and mnemonics are used. Start, Stop, Error, Add are all examples of Mnemonics. System software Assembler is used to convert mnemonics into machineunderstandable form. It is the highly dependent on the machine architecture. 3. High level language High level language uses English like language and is simpler to write a program compared to Assembly or Machine language. It is programmer friendly language. Knowledge of Hardware is not required. It is easy to understand and debug. It needs software like compiler or interpreter for translation. It is used widely for programming and is faster in development and completion of coding tasks. It is easy to maintain and is portable i.e. can run or execute on any platform as it is independent of hardware architecture as shown in fig. 6. Examples: FORTRAN, COBOL, C, C++, JAVA etc Fig. 6 Relationship between HLL, ALL and MLL Translators Assembler Compiler Interpreter Linker Loader Computers understand only machine language. Support system software’s to accept a program in high level language and help it execute on a given machine. 1. Assembler System program that transforms code in Assembly language to Machine language (object code) Assembly Language Machine Language MOV A, B 0010 1100 0011 2. Compiler Translates a computer program written in a high level programming language to an executable code for a target machine. i.e. Source Code to Assembly or Machine code. High Level Language A=B Assembly Language MOV A, B Machine Language 0010 1100 0011 Examples of compilers: GNU or Turbo C Compiler 3. Interpreter Reads a program in high level language and executes the instructions without having to compile the program first. Takes a line of source code and executes that line. Then proceeds to do the same with the subsequent line. Examples: Python, PERL, BASIC languages Compiler Interpreter Translates the entire program into Converts one line of the source machine code and then allows linking program and then executes that and loading for execution. line. Proceeds to the next statement in this manner. Compiled program runs faster Comparatively slower. Halts at the first error. Produces complete error/warning list Compile once run many times Source code required each time. Ex: C, C++ JAVA, Python etc. Linker and Loader Linker Linker is alternatively referred as binder, link editor. Assume, we write some code that uses built in function POW to compute power (xy ie say some base X raise to exponent >. )) Y, the code for which already exists in the header file < >= b) THEN { s (a + b + c)/2 area ← SQRT(s*(s-a)*(s-b)*(s-c)) Write “Area is:”, area } ELSE { Write”Invalid Triangle” } STOP 3. IF-ELSEIF-ELSE statement: Syntax: IF (Condition_A is TRUE) THEN { Sa Sb....... Sn } ELSE IF (Condition_B is TRUE) THEN { Sa Sb....... Sn } ELSE { Na Nb........ Nn } Q: WAA to find a number is Positive, Negative or Zero START 1. num 0 2. Read num 3. IF (num = 0) THEN { Print “Number is ZERO” } ELSE IF (num < 0) THEN { Print “Number is Negative” } ELSE { Print “Number is Positive” } STOP Algorithms based on Repetition Repetition, which involves executing one or more steps for a number of times, can be implemented using constructs such as while, do-while, and for loops. These loops execute one or more steps until some condition is true. 1. while loop: Syntax: WHILE (CONDITION_TRUE) DO Ia Ib.... In END-WHILE Q: WAA to display Numbers from 1 to N START 1. num 1, N 2. Get N // Last Number 3. WHILE (num

Use Quizgecko on...
Browser
Browser