Fundamentals of Computer PDF
Document Details
Uploaded by Deleted User
MIT First Grade College
Suhas B Raj
Tags
Summary
This document provides a comprehensive overview of computer fundamentals, covering topics such as computer characteristics, evolution, different types of computers, generations of computers, and their advantages and disadvantages. It also discusses analog, digital, and hybrid computers.
Full Transcript
FUNDAMENTALS OF COMPUTER Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 1| P a g e FUNDAMENTALS OF COMPUTER Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 2| P a g e FUNDAMENTALS OF COMPUTER...
FUNDAMENTALS OF COMPUTER Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 1| P a g e FUNDAMENTALS OF COMPUTER Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 2| P a g e FUNDAMENTALS OF COMPUTER UNIT 1 FUNDAMENTALS OF COMPUTER Basics of Computer Computer is an advanced electronic device that takes raw data as an input from the user and processes it under the control of a set of instructions (called program), produces a result (output), and saves it for future use. How does the computer work? It is as simple as making tea. To prepare tea, we add water, tea powder, milk, and sugar. These are all considered as input. After adding all, we have to boil. That boiling is called processing. After boiling, we get tea. That is called output. Characteristics of computer Speed A computer works with much higher speed and accuracy compared to humans while performing mathematical calculations. Computers can process millions (1,000,000) of instructions per second. The time taken by computers for their operations is microseconds and nanoseconds. Accuracy Computers perform calculations with 100% accuracy. Errors may occur due to data inconsistency or inaccuracy. Computer errors caused due to incorrect input data or unreliable programs are often referred to as Garbage-In-Garbage-Out (GIGO). Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 3| P a g e FUNDAMENTALS OF COMPUTER Diligence A computer can perform millions of tasks or calculations with the same consistency and accuracy. It doesn’t feel any fatigue or lack of concentration. Its memory also makes it superior to that of human beings. Versatility Versatility refers to the capability of a computer to perform different kinds of works with same accuracy and efficiency. Reliability A computer is reliable as it gives consistent result for similar set of data i.e., if we give same set of input any number of times, we will get the same result. Automation Computer performs all the tasks automatically i.e. it performs tasks without manual intervention. Evolution of computer Abacus Approximately 4,000 years ago, the Chinese invented the Abacus. It was the first machine used for counting and calculating. It is made of a wooden frame, metal rods, and wooden beads Abacus was mainly used for addition, subtraction and later for division and multiplication. Today, the abacus is still used widely in China and other Asian countries to count and calculate, just as we use calculators. Napier’s bones In the early 17th century, John Napier, a Scottish mathematician, invented another calculating tool. “Napier’s bones” was based upon manipulation of rods with printed digits. The rods were made of bone, ivory, wood or metal. The set consists of 10 rectangular blocks with multiples of a different digit on each of the four sides. The slide Rule The slide Rule was invented by William Oughtred. It is based on the principle that actual distance from the starting point of the rule is directly proportional to the logarithm of the numbers printed on the rule. The slide rule is embodied by the two sets of scales that are joined together, with a marginal space between them. Adding Machine-Pascaline In 1642, at the age of 19, a French mathematician by the name of Blaise Pascal invented the Pascaline. The Pascaline is known as the first mechanical and automatic calculator. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 4| P a g e FUNDAMENTALS OF COMPUTER The Pascaline was a wooden box that could only add and subtract by means of a series of gears And wheels. It had a box with eight movable wheels called dials. When each wheel rotated one revolution, it would then turn the neighboring wheel. Leibniz Calculator Mathematician Gottfried Leibniz built a calculator in 1650 that could add, subtract, multiply and divide the numbers. Jacquard loom In 1801, Joseph Mary Jacquard invented the Jacquard loom. A powered loom that used punched wooden cards to automatically weave incredibly detailed patterns including pictures and text. This can be taken as the first “Read only Memory” device. Difference and Analytical Engine In the early 1820s, an English mathematician by the name Charles Babbage designed a computing machine called the Difference Engine. This machine was to be used in the calculating and printing of simple math tables. In the 1830s, he designed a second computing machine called the Analytical Engine. This machine consisted five units, which became the basic principle for the development of modern computer. Hence Charles Babbage is known as the "Father of Computers”. First Programmer-1833 AD Lady Ada Lovelace was a first computer programmer, who designed program for Babbage’s Analytical Engine. Hollerith Tabulating Machine-1890 AD In 1889, an American named Herman Hollerith invented a counting machine to count the population of USA. This electronic machine is able to read the information on the punched cards and process it electronically. Herman Hollerith was the founder of the company than became famous as IBM. Generations of Computers ✓ The computer has evolved from a large-sized simplecalculating machine to a smaller but much more powerful machine. ✓ The evolution of computer to the current state is defined in terms of the generations of computer. ✓ Each generation of computer is designed based on a new technological development, resulting in better, cheaper and smaller computers that are more powerful, faster and efficient than their predecessors. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 5| P a g e FUNDAMENTALS OF COMPUTER First Generation Computers (1940-1956) The first computers used vacuum tubes for circuitry and magnetic drums for Memory. They were often enormous and taking up entireroom. First generation computers relied on machine language. They were very expensive to operate and in addition to using a great deal of electricity, generated a lot of heat, which was often the cause of malfunctions. In this generation, mainly batch processing operating system was used. Punch cards, paper tape, and magnetic tape was used as input and output devices. The computers in this generation used machine code as the programming language. The UNIVAC and ENIAC computers are examples of first-generation computing devices. Advantages It was only electronic device. First device to hold memory. Disadvantages Too bulky i.e. large in size. Vacuum tubes burn frequently. They were producing heat. Maintenance problems. Second Generation Computers (1956-1963) Transistors replaced vacuum tubes in the second generation of computers. Second-generation computers moved from cryptic binary machine language to symbolic. High-level programming languages were also being developed at this time, such as early versions of COBOL and FORTRAN. These were also the first computers that stored their instructions in their memory. Advantages Size reduced considerably. The very fast. Very much reliable. Disadvantages They over heated quickly. Maintenance problems. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 6| P a g e FUNDAMENTALS OF COMPUTER Third Generation Computers (1964-1971) The development of the integrated circuit was the hallmark of the third generation of computers. Transistors were miniaturized and placed on silicon chips, called semiconductors. Instead of punched cards and printouts, users interacted with third generation computers through keyboard sand monitors and interfaced with an operating system. Allowed the device to run many different applications at one time. Advantages IC`s are very small in size Improved performance Production cost cheap Disadvantages IC`s are sophisticated. Fourth Generation Computers (1971-present) The microprocessor brought the fourth generation of computers, as thousands of integrated circuits were built onto a single silicon chip. The Intel 4004 chip, developed in 1971, located all the components of the computer. From the central processing unit and memory to input/output controls on a single chip. Fourth generation computers also saw the development of GUIs, the mouse and handheld devices. Fifth Generation Computers (present and beyond) Fifth generation computing devices, based on artificial intelligence. Are still in development, though there are some applications, such as voice recognition. The use of parallel processing and superconductors is helping to make artificial intelligence a reality. The goal of fifth-generation computing is to develop devices that respond to natural language input and are capable of learning and self-organization. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 7| P a g e FUNDAMENTALS OF COMPUTER Different Types of Computer: Based on Working Principle, Purpose and Size Computer can be classified in many ways. The common way is to classify the computer according to working principle, purpose and size. There are different types of computer. 1. Types of Computer- Based on working Principal 1. Analog computer 2. Digital computer 3. Hybrid computer 2. Types of Computer- Based on Purpose 1. General Purpose Computer 2. Special Purpose Computer 3. Types of Computer- Based on Size 1. Micro Computer 2. Mini Computer 3. Mainframe Computer 4. Super Computer Types of Computer- Based On working Principal. On the basis of computer working Principle the computer can be classified into three types. Analog Digital computer Hybrid computer Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 8| P a g e FUNDAMENTALS OF COMPUTER Analog Computer It is used to process analog data. Analog computer operates by measuring rather than counting. An analog computer measures continuous electrical or physical magnitudes like voltage, pressure, water flow etc. An analog computer has the ability to accept inputs which vary with time and intensity and directly apply them to various devices which perform desired operation. It produces output in the form of graph. These computer are mostly used in process control plants. Advantages of using analog computers It allows real-time operations and computation at the same time and continuous representation of all data within the rage of the analog machine. In some applications, it allows performing calculations without taking the help of transducers for converting the inputs or outputs to digital electronic form and vice versa. The programmer can scale the problem for the dynamic range of the analog computer. It provides insight into the problem and helps understand the errors and their effects. Digital Computer a digital computer operates directly on decimal digit that represents either discrete data or symbols. It converts the data into digits and then all operations are done on these digits at extremely fast rates. Digit computer basically knows how to count the digits. Computers used for business and scientific application are digital computers. Advantages of digital computers It allows you to store a large amount of information and to retrieve it easily whenever You need it. You can easily add new features to digital systems more easily. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 9| P a g e FUNDAMENTALS OF COMPUTER Different applications can be used in digital systems just by changing the program without making any changes in hardware The cost of hardware is less due to the advancement in the IC technology. It offers high speed as the data is processed digitally. It is highly reliable as it uses error correction codes. Reproducibility of results is higher as the output is not affected by noise, temperature, humidity, and other properties of its components. Hybrid computer Hybrid computer utilize the best qualities of both analog and digital computers. They are suited for situation where digital processing of data collected in analog form is desirable. For example:-in a hospital intensive care unit analog devices may measure a patient’s heart function, temperature etc. these measurements may then be converted into numbers and supplied to digital devices. Other areas are guided missile system new aircraft design etc. Advantages of using hybrid computers Its computing speed is very high due to the all-parallel configuration of the analogue subsystem. It produces precise and quick results that are more accurate and useful. It has the ability to solve and manage big equation in real-time. It helps in the on-line data processing. Types of Computer- Based on Purpose Purpose wise computer can be classified into two types General Purpose Computer. Special Purpose Computer. General Purpose Computer Theses computer can store different programs and can thus be used in countless application. A General Purpose Computer can perform any kind of jobs with equal efficiency simply by changing the application program stored in main memory. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 10| P a g e FUNDAMENTALS OF COMPUTER Special purpose computer A Special Purpose Computer is the one that is designed to perform only one special task. The program or instructions set is permanently stored in such a machine. It does its single task very quickly and it cannot be used for any other purpose. These computers are often used to perform specific function such as controlling a manufacturing process or directing communications. Types of Computer- Based on Size Micro Computer Mini Computer Mainframe Computer Super computer Micro Computer or personal computers A microcomputer is a computer whose CPU is a microprocessor. A microprocessor is a processor all of whose component are on a single integrated circuit chip. Personal computers are a kind of microcomputer. Personal computers are called so because they are designed for personal use of individual or individual small business units’ office automation unit or professionals. PC can be used for variety of applications like computer literacy, fun and games, business applications, programming Characteristics of a microcomputer It is the smallest in size among all types of computers. A limited number of software can be used. It is designed for personal work and applications. Only one user can work at a time. It is less expansive and easy to use. It does not require the user to have special skills or training to use it. Generally, comes with single semiconductor chip. It is capable of multitasking such as printing, scanning, browsing, watching videos, etc. Types of Micro Computer or personal computers Desktop Computer. Laptop Computer. Palmtop Computer, Digital Diary, Notebook, PDAs. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 11| P a g e FUNDAMENTALS OF COMPUTER Mini computer They are smaller version of the mainframes. Generally they offer the same computing power as bigger counterparts. The most important advantage of a mini computer over the main frame is that it is cheaper in cost smaller in size and reliable. It does not require air conditioning and can be operated in room temperature. Main used of these systems is in education in local government word processing etc. in business they are being used for involving stock payroll etc. it is generally used as server system on networks with personal computers as nodes. Characteristics of mainframe or minicomputer It is light weight that makes it easy to carry and fit anywhere. It is less expensive than mainframe computers. It is very fast compared to its size. It remains charged for a long time. It does not require a controlled operational environment. Applications of minicomputers A minicomputer is mainly used to perform three primary functions, which are as follows. Process control Data management Communications Portal Mainframe Computer Mainframe computer Mainframe computers are designed to support hundreds or thousands of users simultaneously. They can support multiple programs at the same time. It means they can execute different processes simultaneously. These features of mainframe computers make them ideal for big organizations like banking and telecom sectors, which need to manage and process high volume of data. Mainframe computers are designed to support hundreds or thousands of users simultaneously. They can support multiple programs at the same time. It means they can execute different processes simultaneously. These features of mainframe computers make them ideal for big organizations like Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 12| P a g e FUNDAMENTALS OF COMPUTER banking and telecom sectors, which need to manage and process a high volume of data that requires integer operations such as indexing, comparisons, etc. Characteristics of Mainframe Computers It can process huge amount of data, e.g. millions of transactions in a second in the banking sector. It has a very long life. It can run smoothly for up to 50 years after proper installation. It gives excellent performance with large scale memory management. It has the ability to share or distribute its workload among other processors and input/output terminals. There are fewer chances of error or bugs during processing in mainframe computers. If any error occurs it can fix it quickly without affecting the performance. It has the ability to protect the stored data and other ongoing exchange of information and data. Applications of mainframe computers In health care, it enabled hospitals to maintain a record of their millions of patients in order to contact them for treatment or related to their appointment, medicine updates or disease updates. In the field of defence, it allows the defence departments to share a large amount of sensitive information with other branches of defence. In the field of education, it helps big universities to store, manage and retrieve data related to their courses, admissions, students, teachers, employees and affiliated schools and colleges. In the retail sector, the retail companies that have a huge customer base and branches use mainframe computers to handle and execute information related to their inventory management, customer management, and huge transactions in a short duration. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 13| P a g e FUNDAMENTALS OF COMPUTER Super computer They are most expensive of all the computers. These computers are big general purpose computers capable of executing more than 10,000 million instruction per second and have storage capacities of millions of bits per chip. These computers are used to solve the multi- variety mathematical problems such as atomic nuclear and plasma physics seismology, aerodynamics etc. Super computer are typically capable of handling hundreds of millions of floating point. Operations per second (MFLOPS). The speed of super computers generally measured in “FLOPS” (Floating Point Operations per Second). Super computers are used for highly calculation- intensive tasks such as weather forecasting, climate research, molecular modeling, physical simulation, and cryptanalysis and like military are scientific agencies are heavy users. Some super computers are – Cray 1, Cray 2, Cray 3 perform 10 billion operation per second, Param, Cyber 810&830 etc. Supercomputers are the biggest and fastest computers. They are designed to process huge amount of data. A supercomputer can process trillions of instructions in a second. It has thousands of interconnected processors. Supercomputers are particularly used in scientific and engineering applications such as weather forecasting, scientific simulations and nuclear energy research. The first supercomputer was developed by Roger Cray in 1976. Characteristics or applications of supercomputers It has the ability to decrypt your password to enhance protection for security reasons. It produces excellent results in animations. It is used for virtual testing of nuclear weapons and critical medical tests. It helps in designing the flight simulators for pilots at the beginner level for their training. It helps in extracting useful information from data storage centers or cloud system. For example, in insurance companies. It has played a vital role in managing the online currency world such as stock market and bit coin. It helps in the diagnosis of various critical diseases and in producing accurate results in brain injuries, strokes, etc. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 14| P a g e FUNDAMENTALS OF COMPUTER It helps in scientific research areas by accurately analyzing data obtained from exploring the solar system, satellites, and movement of Earth. It also used in a smog control system where it predicts the level of fog and other pollutants in the atmosphere. INPUT OUTPUT ORGANIZATION Peripheral devices and input-output (I/O) interfaces are crucial components in a computer system, responsible for enabling communication between the computer and the external environment. Input & Output Devices Input Device An input device is used to feed data into computer. Input devices are capable of converting data into a form which can be recognized by computer. A computer has several input device namely, Keyboard, Mouse, Trackball, Joystick, Scanner, Light pen, Bar Code Reader, OCR, OMR, MICR etc. Note: The device used to accept the data and instructions from the user is called input device. Keyboard The most common input device is the keyboard. It is used to enter both numerical and character type data. It is like a mechanical type writer with alpha numeric and special keys, punctuation keys, functional keys to perform specific. The keyboards contain 101 keys or 104 keys. The keyboard detects the key pressed and generates the corresponding ASCII codes which can be recognized by the computer. Types of keyboard 1. Standard keyboard: The standard keyboards have their basic layout. The average number of keys on a regular keyboard is 105/108; QWERTY keyboards are the most common and have the six alphabets Q, W, E, R, T, and Y in the first row. 2. Ergonomics: It refers to study of method that can reduce stress on muscles to avoid repetitive strain injury. It mostly deals with optimizing posture and technique while working, so the work can be carried out in the easiest manner. 3. Wireless keyboard: It is a keyboard that does not need to connect to the computer via a wire. This makes very convenient for the use the keyboard comfortably. Wireless keyboard use Bluetooth, Infrared (IR) to connect to the computer. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 15| P a g e FUNDAMENTALS OF COMPUTER 4. Virtual keyboard: It is a software device that led to use input data just like hardware keyboard. They open up as an application and can be controlled by a mouse or wire touch screen. 5. Compact keyboard: These keyboards are slim and usually do not have the numerical keypad that is present on the right side of the keyboard these are typically used in laptops. Mouse Mouse is an input device that controls the movement of the cursor on the display screen. MOUSE stands for “Mechanically Operated User Serial Engine”. The Mouse is used as a pointing device. Mouse is a small device; you can roll/navioperators along a flat surface. In a mouse, a small ball/IR rays is kept inside and touches the pad through a hole at the bottom of the mouse. There are two types of mouse. o Mechanical o Optical Mechanical: This mouse has a small rubber ball underneath that moves against two rollers as it passes across a flat surface. Optical: This mouse more accurate and has no moving parts. Ts use a laser to detect movement. Joystick A joystick is an input device consisting of a stick that pivots on a base and reports its angle or direction to the device it is controlling. The joystick can be moved in all four directions. The function of the joystick is similar to that of a mouse. It is mainly used in playing computer games. Joysticks are also used for controlling machines such as cranes, trucks, underwater unmanned vehicles, surveillance cameras and zero turning radius lawn mowers. Scanner The scanner is an input device which works more like a photocopy machine. It is used when some information is available on a paper and it is to be transferred to the computer for further manipulation. The scanner captures images from the source which are then converted into the digital form. Optical Mark Reading and Recognition (OMR) Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 16| P a g e FUNDAMENTALS OF COMPUTER Optical Mark Reader is a device that reads pencil marks and converts them into computer process able form. Special pre-printed forms are designed with boxes which can be marked with a dark pencil or ink. Such documents are read by a reader, which transcribes the marks into electrical pulses which are transmitted to the computer. They are widely used in applications like objective type answer papers evaluation in which large number of candidates appear, time shits of factory employees etc. Optical Character Recognition (OCR) The main use of these devices is to recognize alphabetic and numeric character printed on paper. The OCR technique permits the direct reading of any printed character without any special ink. With OCR, a user can scan a page from a book. The computer will recognize the characters in the page as a letters and punctuations marks and stores. This can be edited using a word processor the size (width, height and depth) of the scanned. OCR’s are used in applications such as Credit Card billing and reading of pin code numbers in large post office to sort mail geographically. Magnetic Ink Character Recognition (MICR) MICR is a form of character recognition that reads the text printed with magnetic charged ink. The shapes of the characters by sensing the magnetic charge in the ink and translates these shapes into computer processed format. MICR is widely used by banks to process cheques. The cheques can be read using a special input unit, which recognizes magnetic ink characters. This method eliminates the manual errors. It also save time ensures security and accuracy of data. Output device When the data and instruction are fed into the computer and processed the next step is get the desired output. This output may be displayed on the monitor or printed on the computer. The output displayed on the monitor is called soft copy output. The output produced on a computer is called hard copy output. Note: The device that displays output to the user is called output device. Monitor It is commonly used output device sometimes called as display screen/VDU. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 17| P a g e FUNDAMENTALS OF COMPUTER Monitors are connected with the computer are similar in appears to a television set. Monitor display image and text. The smallest dot that can be displayed is called a pixel. The resolution of the monitor determines the quality of the display. Some popular resolutions are 640X480 pixels, 800X600 pixels and 1024X768 pixels. The different size of the monitor is measured diagonally may be 12”, 14”, 17”, 19”, 21”. The different types of monitors: o CRT (Cathode Ray Tube) o LCD (Liquid Crystal Display) o TFT ( Thin Film Transistors) o LED (Light Emitting Diode) Printer Printer is an output device that prints text or images on paper. By printing you create a ‘hard copy’ of data. There are different kinds of printers, which vary in their speed and print quality. The two main types of printer namely; o Impact Printers o Non-Impact Printers. Impact printers It includes printers that print by striking device against inked ribbon. Impact printers use a print head containing a number of metal pins, which strike an inked ribbon placed between the print head and the paper. Line printers, dot-matrix printers are some of the impact printers. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 18| P a g e FUNDAMENTALS OF COMPUTER Characteristics of Impact Printers 1. In impact printers, there is physical contact with the paper to produce an image. 2. Due to being robust and low cost, they are useful for bulk printing. 3. Impact printers are ideal for printing multiple copies because they can easily print through many layers of papers. 4. Due to its striking activity, impact printers are very noisy. 5. Since they are mechanical in nature, they tend to be slow. 6. Impact printers do not support transparencies. 7. Measured with characters per second. Line printer Line printers are high speed printers capable of printing an entire line at a time. A line printer can print 150 lines to 3000 lines per minute. The limitations of line printers are they can print only one font, they can’t print graphics. The print quality is low and they are noisy to operate. It can print large volume of text data very fast compared to the other printers. It is also used to print on multi part stationeries to prepare copies of a document. Dot matrix printer The most popular serial printer is the dot matrix printer. It prints one line of 8 or 14 points at a time, with print head moving across a line. They are similar to typewriters. They are normally slow. The printing speed is around 300 characters per second. It uses multi part stationeries to prepare copies of a document. Non-impact printer Non-impact printer don’t use striking device. The ink or semi –solid ink is stored in the printer cartridges and the flow of ink is controlled by the processor. It is much faster and can print color, different font and size also. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 19| P a g e FUNDAMENTALS OF COMPUTER Characteristics of non-impact printers 1. They possess the ability to change type face automatically. 2. These printers produce high quality graphics. 3. These printers usually support the transparencies. 4. Measured in dots pen inches. 5. The speed is calculated by the number of pages per minute (PPM). 6. The size of the printing various A4, A3, A2, A0 and jumbo size. Thermal printer Thermal printers are printers that produce images by pulling electrically heated pins against special heat-sensitive paper. They are inexpensive and used widely in fax machine and calculators. Thermal printer paper tends to darken over time due to exposure to sunlight and heat. So the printed matters on the paper fade after a week or two. It also produces a poor quality print. Laser printer Laser printer uses a laser beam and dry powered ink to produce a fine dot matrix pattern. In can produce very good quality of graphics images. Laser printers print one entire page at a time and are typically faster and have better quality output. One of the chief characteristics o laser printer is their resolution- how many dots per inch (dpi) they lay down. The available resolutions range from 300 dpi at the low end to around 1200 dpi at the higher end. Inkjet printer Inkjet printers use color cartridges which combine magenta, yellow and cyan links to create color tones. A black cartridge is also used for crisp monochrome output. Inkjet printers works by spraying ionizing ink at a sheet of paper. Magnetized plates in the ink’s path direct the ink onto the paper in the described shape. It prints one line at a time. Print quality is high, speed is slow, typically about 100 CPS. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 20| P a g e FUNDAMENTALS OF COMPUTER Plotter Plotter is an output device that draws shapes on paper based on commands from a computer. Plotter differs from printers in that they draw lines using a pen. As a result, they can produce continuous lines, whereas printers can only stimulate lines printing a closely spaced series of dots. Multicolor plotters use different colored pens to draw different colors. Plotters are more expensive than printers. They used in engineering applications. Speakers The speakers are the output device. The sound signals from analog/ digital are converted in to audible frequency in the speakers and produce voice output [audio data]. Using speakers along with speech synthesizer software, the computer can provide voice output. Voice output has become very common in many places like airlines, banks, automatic telephone enquiry system etc. Users can also hear music/songs using the voice output system. Namely 2.1 or 5.1 which indicates the position of the speakers and tracking systems. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 21| P a g e FUNDAMENTALS OF COMPUTER MEMORY ORGANIZATION Mainly computer system consists of three parts that are central processing unit (CPU), Input Devices, and Output Devices. The Central Processing Unit (CPU) is divided into two parts again: arithmetic logic unit (ALU) and the control unit (CU). The set of instruction is in the form of raw data. A large amount of data is stored in the computer memory with the help of primary and secondary storage devices. The CPU is like the heart/brain of the computer. The user does not get the desired output, without the necessary option taken by the CPU. The Central processing unit (CPU) is responsible for the processing of all the instructions which are given by the user to the computer system The data is entered through input devices such as the keyboard, mouse, etc. This set of instruction is processed by the CPU after getting the input by the user, and then the computer system produces the output. The computer can show the output with the help of output devices to the user, such as monitor, printer, etc. CPU (Central Processing Unit) Storage Unit ALU(Arithmetic Logic Unit) Control Unit Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 22| P a g e FUNDAMENTALS OF COMPUTER Central Processing Unit (CPU) The computer system is nothing without the Central processing Unit so, it is also known as the brain or heat of computer. The CPU is an electronic hardware device which can perform different types of operations such as arithmetic and logical operation. The CPU contains two parts: the arithmetic logic unit and control unit. We have discussed briefly the arithmetic unit, logical unit, and control unit which are given below. Control Unit The control unit (CU) controls all the activities or operations which are performed inside the computer system. It receives instructions or information directly from the main memory of the computer. When the control unit receives an instruction set or information, it converts the instruction set to control signals then; these signals are sent to the central processor for further processing. The control unit understands which operation to execute, accurately, and in which order. Arithmetic and Logical Unit The arithmetic and logical unit is the combinational digital electronic circuit that can perform arithmetic operations on integer binary numbers. It presents the arithmetic and logical operation. The outputs of ALU will change asynchronously in response to the input. The basic arithmetic and bitwise logic functions are supported by ALU. Storage Unit The information or set of guidelines are stored in the storage unit of the computer system. The storage unit provides the space to store the data or instruction of processed data. The information or data is saved or hold in computer memory or storage device. The data storage is the core function and fundamental of the computer components. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 23| P a g e FUNDAMENTALS OF COMPUTER Components of Computer System The hardware and software exist on the computer. The information which is stored through the device is known as computer software. The hardware components of the computer system are related to electronic and mechanical parts, and the software component is related to data and computer programs. Many elements are connected to the main circuit board of the computer system called a “motherboard.” These are mainly five components of the computer system. The computer hardware, computer software, and liveware exist in the element of the computer system. Processor Main Memory Secondary Memory Input Devices Output Devices Processor The processor is an electric circuitry within the computer system. The Central processing unit is the central processor or main processor of the computer system. The processor carries out the instructions of the computer program with the help of basic arithmetic and logic, input/output operations. Main Memory The Random Access Memory is the main memory of the computer system, which is known as RAM. The main memory can store the operating system software, application software, and other information. The Ram is one of the fastest memory, and it allows the data to be readable and writeable. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 24| P a g e FUNDAMENTALS OF COMPUTER Secondary memory We can store the data and programs on a long-term basis in the secondary memory. The hard disks and the optical disks are the common secondary devices. It is slow and cheap memory as compare to primary memory. This memory is not connected to the processor directly. It has a large capacity to store the data. The hard disk has a capacity of 500 gigabytes. The data and programs on the hard disk are organized into files, and the file is the collection of data on the disk. The secondary storage is direct access by the CPU; that’s why it is different from the primary storage. The hard disk is about 100 times the capacity of the main memory. The main difference between primary and secondary storage is speed and capacity. There are several large blocks of data which are copied from the hard disk into the main memory. Input Devices The user provides the set of instruction or information to the computer system with the help of input devices such as the keyboard, mouse, scanner, etc. The data representation to the computer system is in the form of binary language after that the processor processes the converted data. The input unit implements the data which is instructed by the user to the system. We can enter the data from the outside world into the primary storage as the input through input devices. The input devices are the medium of communication between the outside world and the computer system. There are some important features of input devices which are given below. The input devices receive or accept the data or instruction from the user, who exist in the outside world. These devices convert the data or instruction into the machine-readable form for further processing. The input device performs like the connection between the outside world and our computer system. The keyboard and mouse are common examples of input devices. When the whole procedure is finished, we get the desired output from the output devices such as monitor, printer, etc. Output Devices The output devices produce or generate the desired result according to our input, such as a printer, monitor, etc. These devices convert the data into a human-readable form from binary code. The computer system is linked or connected to the outside world with the help of output devices. The primary examples of output devices are a printer, projector, etc. These devices have various features which are given below. These devices receive or accept the data in the binary form. The output devices convert the binary code into the human-readable form. These devices produce the converted result and show to the user. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 25| P a g e FUNDAMENTALS OF COMPUTER Microprocessor Microprocessor is a programmable device that takes in input performs some arithmetic and logical operations over it and produces the desired output. Microprocessor is a digital device on a chip that can fetch instructions from memory, decode and execute them and give results. It performs some basic operations like addition, subtraction, multiplication, division and some logical operations using its Arithmetic and Logical Unit (ALU). New Microprocessors also perform operations on floating-point numbers also. Data in microprocessors can move from one location to another. It has a Program Counter (PC) register that stores the address of the next instruction based on the value of the PC, Microprocessor jumps from one location to another and takes decisions. Storage Unit A storage device is an integral part of the computer hardware which stores information/data to process the result of any computational work. Primary memory Primary memory is a segment of computer memory that can be accessed directly by the processor. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 26| P a g e FUNDAMENTALS OF COMPUTER Classification of Primary Memory Primary memory can be broadly classified into two parts: Read-Only Memory (ROM) Random Access Memory (RAM) Read-Only Memory Any data which need not be altered are stored in ROM. ROM includes those programs which run on booting of the system (known as a bootstrap program that initializes OS) along with data like algorithm required by OS. Anything stored in ROM cannot be altered or changed. Types of ROM PROM: Programmable ROM can be modified once by the user. The user buys a blank PROM and writes the desired content but once written content cannot be altered. EPROM: Erasable and Programmable ROM Content can be changed by erasing the initial content which can be done by exposing EPROM to UV radiation. This exposure to ultra-violet light dissipates the charge on ROM and content can be rewritten on it. EEPROM: Electrically Erasable and Programmable ROM Content can be changed by erasing the initial content which could be easily erased electrically. However, one byte can be erased at a time instead of deleting in one go. Hence, reprogramming of EEPROM is a slow process. Random Access Memory Any process in the system which needs to be executed is loaded in RAM which is processed by the CPU as per Instructions in the program. Like if we click on applications like Browser, firstly browser code will be loaded by the Operating system into the RAM after which the CPU will execute and open up the Browser. Types of RAM DRAM: Dynamic RAM or DRAM needs to periodically refresh in few milliseconds to retain data. DRAM is made up of capacitors and transistors and electric charge leaks from capacitors and DRAM needs to be charged periodically. DRAM is widely used in home PCs and servers as it is cheaper than SRAM. SRAM: Static RAM or SRAM keeps the data as long as power is supplied to the system. SRAM uses Sequential circuits like a flip-flop to store a bit and hence need not be periodically refreshed. SRAM is expensive and hence only used where speed is the utmost priority. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 27| P a g e FUNDAMENTALS OF COMPUTER RAM ROM RAM stands for Random Access Memory ROM stands for Read-Only Memory RAM allows the computer to read data ROM stores the program required to initially quickly to run applications. It allows Reading and boot the computer. It only allows Reading. writing. RAM is volatile i.e. its contents are lost when the It is non-volatile i.e. its contents are retained device is powered off. even when the device is powered off. The two main types of RAM are static RAM and The types of ROM include PROM, dynamic RAM. EPROM and EEPROM. Secondary Storage Unit A secondary storage device refers to any non-volatile storage device that is internal or external to the computer. It can be any storage device beyond the primary storage that enables permanent data storage. Magnetic Disks Magnetic disks are thin circular plastic plates on which some magnetic material is coated. Magnetic disks come in various sizes and materials. They use the properties of magnetism to store the data on a magnetic surface. A disk pack normally consists of such disks mounted on a central shaft. The central shaft rotates at speeds of about 7200 revolutions per minute (RPM). In a disk plate information is stored on both surfaces. The surface is further divided into a number of invisible concentric circles called as tracks. The tracks are further divided into various sections called as sectors. To store information, it is necessary for us to identify the track and sector where it has to be stored. The stored information can be read any number of times without affecting the stored data. But when new data is written it erases the previously written data. Two types of magnetic disks are o Hard Disk o Floppy Disk Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 28| P a g e FUNDAMENTALS OF COMPUTER Hard Disk The most common physical device for storing files in the hard disk. The hard disk typically contains several rotating disk plates, which are permanently encased in a hard disk. The surfaces of the plates are covered by metal oxide; electromagnetic recording heads. It performs read/write operation. There is one head for each surface, and all the head move together. The disk rotates at around 7200 rpm. Modern disks typically hold 260 GB to 1000 GB (TB) of data. The surface of a plate is organized has a number of concentric tracks. Each track is divided into sectors. Set of matched tracks are called cylinders. Floppy Disk Floppy diskette contains a single flat piece of circular plate (the disk) coated with metal oxide and enclosed in plastic cover. Floppy disks are small and portable. The three common sizes are 3.5”, 5.25” and 8” diameter. Most commonly used floppy disks is of 3.5" in size with storage capacity of 1.44 MB of data. Disk drives for floppy disks are called floppy drives. Floppy disks are slower to access than hard disks and have less storage capacity. It is less expensive. Optical Disk Optical disk is a random access, removable disk on which data is written and read through the use of laser beam. Optical disk consists of rotating disk, which is coated with highly reflective material. Data recording on the disk is done by focusing a laser beam on the surface of the spinning disk, which stores data as microscopic light and dark spots on the disk surface. The dark spots are called pits. The lighter, non-spitted surface areas of the disk are called lands. The process of recording data onto a optical disk are called burning. There are different types of optical laser disks. o CD ROM o DVD ROM Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 29| P a g e FUNDAMENTALS OF COMPUTER CD ROM CD-ROM stands for Compact Disk Read Only Memory. It is read only optical storage medium capable of holding up to 682 MB of data. Accessing of data from CD ROM is quite a bit faster than a floppy disk but slower than hard disk. To read a CD-ROM a device called CD-ROM drive is needed. CD technology uses a near infrared laser. There are two types of CD-ROM’s. o CD-R: It is also called as Recordable CD o CD-RW: It is also called as Re-Writable CD DVD DVD stands for “Digital Versatile Disk”. It is an optical disk technology with a 4.7 GB storage capacity. DVD can be single or double sided, and can have two layers on each side. A double sided, two-layered DVD will hold up to 17 GB of Video, Audio or other information. DVD technology uses a red laser. There are two types of DVD. o DVD-R: It is also called as DVD Recordable. o DVD-RW: It is also called as DVD Re-Writable. Blu-Ray Disk Blu-ray Disk, referred as BD. It is a high capacity storage technology with 25 GB to 50 GB capacity to store HD movies and other information. The name Blu-ray is derived from the blue-violet color laser, used to read data stored on disk. Portable Storage Device A Portable Storage Device is a small hard drive designed to hold any kind of digital data. This is slightly different from a portable media player which stores and plays music and movies. Some are fixed size hard drives of 256 GB, 320 GB, 500 GB and 1 TB. It may be useful alternative to backing up or purging memory cards if a computer is unavailable for downloading. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 30| P a g e FUNDAMENTALS OF COMPUTER Difference between Primary memory and Secondary memory Primary Memory Secondary Memory Semiconductor memory. Magnetic or Optical memory. Volatile(Temporary) Non-Volatile(Permanent) Expensive Less Expensive Faster Slower Also called as Main Memory Also called as Auxiliary Memory Example: RAM, ROM Example: HDD, Pen drive etc. Cache Memory The cache memory (pronounced as cash) is placed in between the CPU and Main memory. It is much faster than main memory. Its access time is much less compared to that of the main memory. The cache memory is an intermediate memory and is not accessible to users. It stores instructions and data, which are to be immediately executed. It is used to reduce the average access time reading data, which normally stored in the main memory. The cache memory increases the operating speed of the system. But it is much costlier than main memory. HOW CPU AND MEMORY WORKS Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 31| P a g e FUNDAMENTALS OF COMPUTER CENTRAL PROCESSING UNIT (CPU) CPU is the brain of a computer system. It performs all major calculations and comparisons, and also activates and controls the operations of other units of the computer system. Hence, no other single component of a computer determines its overall performance as much as it’s CPU. In order to evaluate a computer’s capabilities quickly, it is important to know how CPU’s are internally structured, how different CPU’s differ from each other, and how to evaluate CPU speed. These and other related concepts are described below. CONTROL UNIT (CU) We saw that the two basic components of a CPU are control unit (CU) and Arithmetic Logic Unit (ALU). The control unit of a CPU Selects and interprets program instructions and, then coordinates their execution. As figure shows, it has some special purpose registers (whose functions are described in a later subsection) and a decoder to perform these activities. The special purpose registers named instruction register and program control register, respectively, hold the current instruction and the next instruction for execution, and in this way help the control unit in instruction selection, On the other hand, the decoder has necessary circuitry to decode and interpret the meaning of every instruction supported by the CPU. Each instruction is accompanied by microcode - very basic directions that tell the CPU how to execute the instruction. Although, the control unit does not perform any actual processing of data, it acts as the central nervous system for all other components of computer. It manages and coordinates the entire computer system including its input and output units. It obtains instructions from a program stored in main memory, interprets the instructions, and issues signals that cause other units of the system to execute them. ARITHMETIC LOGIC UNIT (ALU) ALU of a CPU is the place where actual execution of Instructions takes place during data processing. When the control unit encounters an instruction that involves an arithmetic operation (such as add, subtract, multiply, divide) or a logic operation (such as less than, equal to, greater than) it passes control to the ALU. As shown in Figure, the ALU has some special purpose registers (whose functions are described in a later subsection) and necessary circuitry to carry out all arithmetic and logic operations included in the set of instructions supported by the CPU. For example, control unit might load two numbers into ALU registers and then tell the ALU to add them (an arithmetic operation) or to check if they are equal (a logical operation). When entire CPU (both CU and ALU) is contained on a single tiny silicon chip, it is called a microprocessor. INSTRUCTION SET Every CPU has built-in ability to execute a set of machine instructions called its instruction set. Most CPUs have 200 or more instructions (such as add, subtract, and compare) in their instruction set. The list of instructions supported by a CPU in its instruction set forms the basis for designing the machine language for the CPU. Since each processor has a unique instruction set, machine language programs written for one computer will generally not run on another computer with a different CPU. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 32| P a g e FUNDAMENTALS OF COMPUTER CPUs made by different manufacturers have different instruction sets. In fact, different CPU models of the same manufacturer may have different Instruction sets. However, manufacturers tend to group their CPUs into "families" having similar instruction sets. When they develop a new CPU, they ensure that its instruction set includes all instructions in the instruction set of its predecessor CPU plus some new ones. This manufacturing strategy is known as backward compatibility and the new CPU is said to be backward compatible with its predecessor. This feature allows software written for a computer with a particular CPU to work on computers with newer processors of the same family, in turn, it allows users of these computer systems to upgrade their systems easily without worrying about converting all their existing software. REGISTERS As a computer's CPU interprets and executes instructions, there is movement of information between various units of the computer. To handle this process satisfactorily and to speed up rate of information transfer, the CPU uses a number of special memory units called registers. These registers hold information temporarily and are part of CPU (not main memory). Length of a register is equal to the number of bits' it can store. Hence, we refer to a register that can store 8 bits as an 8-bit register. Most CPUs sold today have 32-bit or 64-bit registers. The length of registers of a computer is sometimes called its word size. The bigger the word size, the faster a computer can process a set of data. With all other parameters being same, a CPU with 32-bit registers can process data twice as large as one with 16-bit registers. Although, the number of registers varies from computer to computer, there are some registers common to all computers. Functions of these registers are described below. Each of these registers possesses the ability to receive information, hold it temporarily, and pass it on as directed by the control unit. MEMORY ADDRESS REGISTER (MAR) It holds the address of the active memory location. It is loaded from program control register when the system reads an instruction from memory. MEMORY BUFFER REGISTER (MBR) It holds the contents of the accessed (read/written) memory word. The system transfers an instruction word placed in this register to instruction register. A data word placed in this register is accessible for operation with accumulator register or for transfer to I/O register. To store word in a memory location, the system first transfers it to MBR and then writes it in memory from MBR. PROGRAM CONTROL REGISTER (PC) It holds the address of the next instruction for execution. Normally, a system stores instructions of a program in consecutive memory locations, and executes them in sequence unless it encounters a branch instruction. A branch instruction is an operation that causes a transfer to a non-consecutive instruction. The system transfers address part of a branch instruction to PC register so it becomes the address of the next instruction. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 33| P a g e FUNDAMENTALS OF COMPUTER ACCUMULATOR REGISTER (A) It holds the data on which the system has to operate, intermediate results, and results of operations performed. The system uses it during execution of most instructions. The system returns the result of an arithmetic operation to accumulator register for transfer to main memory through memory buffer register. In many computers, there are more than one accumulator registers. INSTRUCTION REGISTER (IR) It holds the current instruction under execution. As soon as the instruction is in this register, its operation and address parts (see Chapter 12) are separated. The system sends the part of the instruction to MAR, while it sends operation part to control unit, where it is decoded interpreted. Finally, the control unit generates and sends command signals to the appropriate unit for carrying out the task specified in the instruction. INPUT/OUTPUT REGISTER (I/O) The system uses it to communicate with input/output devices. An input transfers all input information (such as instructions and data) to this register. Similarly, the system transfers all output information to this register and an output device picks up data for output from here. Summarizes the functions of each of these registers SL.NO NAME OF REGISTER FUNCTION 1. Memory Address (MAR) Holds address of the active memory location 2. Memory Buffer (MBR) Holds information on its way to and from memory 3. Program Control (PC) Holds address of the next instruction to be executed 4. Accumulator (A) Accumulates results and data to be operated upon 5. Instruction (IR) Holds an instruction while it is being executed 6. Input/output (I/O) Communicates with I/O devices Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 34| P a g e FUNDAMENTALS OF COMPUTER TYPES OF SOFTWARE Software refers to a set of instructions, data, or programs used to operate computers and execute specific tasks. Unlike hardware, which refers to the physical components of a computer, software is intangible and is essential for enabling the hardware to perform meaningful work. System Software ✓ Systems of tow are is a computer program that controls the system hardware and interacts with application software. ✓ System software is hardware dependent and not portable. ✓ System software provides a convenient environment for program development and execution. ✓ Programming languages like assembly language/C/C++/Visual C++/Pascal are used to develop the system software. Language Translators. Operating System. Utilities Software. Application Software ✓ Application software that has been written to process performs a specific job. ✓ Application software is generally written in high level languages. ✓ It focus is on the application not the computing system. ✓ Application software is classified in to two types Application Specific General Purpose ✓ Application specific software is created to execute an exact task. ✓ It has a limited task. For example, accounting software for maintaining accounts. ✓ General purpose software is not limited to only one function. For example: Microsoft office (MS-Word, MS-Excel), Tally, Oracle etc. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 35| P a g e FUNDAMENTALS OF COMPUTER Utility Software The Utility Software is system software that helps to maintain the proper and smooth functioning of a Computer System. Some examples are antivirus software, file management tools, compression tools, disk management tools, etc. Introduction to Computer Languages Programming Language is a set of rules called syntax which user has to follow ,to instruct the computer what operation are to be performed. Computer language are classified in to two categories Low-Level Languages Machine level languages ▪ Assembly languages High-Level Languages ▪ General Purpose languages (Ex: BASIC, PASCAL,C) ▪ Specific Purpose languages(Ex: COBOL, FORTAN,C++) Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 36| P a g e FUNDAMENTALS OF COMPUTER COMPUTER LANGUAGES Machine Level Language ✓ Machine level language is the fundamental language of a computer. ✓ It is written using binary numbers i.e.0’sand1’s. ✓ A program written in the machine level language is called Machine code. ✓ The instructions provided in machine language are directly understood by the computer and converted into electrical signals to run the computer. For example a typical program in machine language to add two numbers STATEMENTS ACTION 0001 00110010 Load the data 0100 10100101 Add the contents 1000 00101001 Store the results 0000 00000000 Stop ✓ An instruction given in the machine language has two parts: o OPCODE(Operation Code) o Operand(Address/Location) ✓ The first 4-bit represents Op code denoting operation such as load, move, store etc. ✓ The last 8-bit represents the operand denoting the address. Advantages: It can be directly typed and executed and no compilation or translation is requires. Disadvantage: These instructions are machine dependent and it is difficult to program modify and debug errors. Assembly Level Language ✓ Assembly level language is a low level programming language that allows a user to write programs using letters, words and symbols called mnemonics, instead of the binary digits used in machine level languages. ✓ A program written in the assembly level language is called Assembly code. ✓ For example a typical program in assembly language to add two numbers STATEMENTS ACTION STA A Load the data to accumulator ADD B Add the contents of B to Accumulator STR C Store the results in location C PRT C Print the results HLT Stop Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 37| P a g e FUNDAMENTALS OF COMPUTER ✓ However a program in assembly language has to be converted to its equivalent machine language to be executed on computer. ✓ The translator program that converts an assembly code into machine code is called an assembler. Advantages Mnemonic code are easy to remember, easy to understand, easy to modify and debug. Disadvantage These languages are the mnemonic are machine dependent and assembly language programming takes longer to code. High-level Languages ✓ A language designed to make programming easier through the use of familiar English words and symbols. ✓ High-level languages used English like language, which are easier to learn and use. ✓ High-level languages are machine independent. Therefore, a program written for one computer can be executed on different computers with no or only slight modifications. ✓ Some of the high-level languages are C, C++, JAVA, FORTRAN, QBASIC, and PASCAL. ✓ For example a typical program in high level language to add two numbers: cin>>a>>b; ▪ c=a+b; ▪ printf (“Answer=%d”,c); ✓ However a program in high-level language has to be converted to its equivalent machine language to be executed on comput er. ✓ The translator program that converts a high level code into machine code is called a compiler. Advantage ✓ HLL’s are machine independent. ✓ Easy to learn and understand. ✓ Easy to modify and debug the program. Disadvantage ✓ HLL is slower in execution. ✓ HLL requires a compiler to convert source code to object code. ✓ HLL take more time to execute and require more memory. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 38| P a g e FUNDAMENTALS OF COMPUTER LANGUAGE TRANSLATORS ✓ The translator translates the high-level language to low level language. ✓ There are three types of translators: Compilers, Interpreters and Assemblers. Translators Assembler Complier Interpreters Assembler ✓ Assembler is system software which translates an assembly language program in to its machine language. ✓ It recognizes the mnemonics used in the assembly level languages and substitutes the required machine code for each instruction. ✓ Example: TASM (Turbo Assembler), MASM (Microsoft Macro Assembler) etc. SOURCE CODE ASSEMBLER MACHINE CODE Compilers ✓ Compiler is system software that translates high level language (source code) in to the machine level language (machine/object code). ✓ It reads the whole program and translates the entire program at once into a series of machine level language instructions. ✓ Once compiled the program normally gets saved automatically and can be executed directly. ✓ Examples: C, C++. MACHINE CODE SOURCE CODE COMPILER 110101011 Interpreters ✓ An Interpreter reads once a statement of a high-level language program at a time and translates it into machine level language and executes it immediately. ✓ It continue stored translate and execute the statements one by one until it reaches the end of the program. ✓ Therefore, it is slower than a compiler. ✓ The machine code produced by the interpreter is not saved and hence to execute a statement again it has to be interpreted again. Example: BASIC, PROLOG. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 39| P a g e FUNDAMENTALS OF COMPUTER Difference between Compiler and Interpreter Compiler Interpreter A compiler is a program which converts the Interpreter takes a source program and runs it entire source code of a programming language line by line, translating each line as it comes to into executable machine code for a CPU. it. Compiler takes large amount of time to analyze Interpreter takes less amount of time to analyze the entire source code but the overall execution the source code but the overall execution time time of the program is comparatively faster. of the program is slower. Compiler generates the error message only after scanning the whole program, so Its Debugging is easier as it continues debugging is comparatively hard as the error translating the program until the error is met can be present anywhere in the program. Generates intermediate object code. No intermediate object code is generated. Examples: C, C++, Java Examples: Python, Perl Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 40| P a g e FUNDAMENTALS OF COMPUTER UNIT 2 NUMBER SYSTEM Digital Computer, data and instructions are stored in computer memory using binary code (or machine code) represented by Binary digit’s 1 and 0 called BIT’s. The data may contain digits, alphabets or special character, which are converted to bits, understandable by the computer. The number system uses well defined symbols called digits. Number systems are basically classified into two types. ✓ Non-positional number system. ✓ Positional number system. Non-Positional Number System In olden days people use of this type of number system for simple calculations like additions and subtractions. The non-positional number system consists of different symbols that are used to represent numbers. Roman number system is an example of the non-positional number system i.e.I=1, V=5, X=10, L=50. This number system cannot be used effectively to perform arithmetic operations. Positional Number System ✓ Decimal number system ✓ Binary number system. ✓ Octal number system. ✓ Hexadecimal number system. The total number of digits present in any number system is called Base or Radix. Every number is represented by a base (or radix) x, which represents x digits. The base is written after the number as subscript such as 512 (10).It is a Decimal number as its base is 10.To determine the quantity that the number represents, the number is multiplied by An integer power of x depending on the position it is located and then finds the sum of the weighted digits. Example: Consider a decimal number 512.45(10) which can be represented in equivalent value as 5x102+1x101+2x100+4x10-1+5x10-2 Decimal Number System It is the most widely used number system. The decimal number system consists of 10 digits from 0 to 9. It has 10 digits and hence its base or radix is 10. These digits can be used to represent any numeric value. Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 41| P a g e FUNDAMENTALS OF COMPUTER Example: 123(10), 456(10), 7890(10). Consider a decimal number 542.76(10) which can be represented in equivalent value as 5x102+4x101+2x100+7x10-1+6x10-2 Hundreds Tens Units One-tenth One-hundredth Weights 102 101 100 10-1 10-2 Digits 5 4 2 7 6 Values 500 40 2 0.7 0.06 Binary Number System Digital computer represents all kinds of data and information in the binary system. Binary number system consists of two digits 0(low voltage) and 1(high voltage). Its base or radix is 2. Each digit or bit in binary number system can be 0or1. The positional values are expressed in power of 2. Example: 1011(2), 111(2),100001(2) Consider a binary number 11011.10(2) which can be represented in equivalent value as 1x24 +1x23+0x22+1x21 +1x20+0x2-1+0x2-2 Weights 24 23 22 21 20 2-1 2-2 Digits 1 1 0 1 1 1 0 Values 16 8 4 2 1 0.5 0.25 Note: In the binary number 11010(2) The left most bit 1 is the highest order bit.It is called as Most Significant Bit (MSB). The right most bit 0 is the lower bit. It is called as Least Significant Bit (LSB). Octal Number System The octal number system has digits starting from 0 to 7. The base or radix of this system is 8. The positional values are expressed in power of 8. Any digit in this system is always less than 8. Example:123(8), 236(8), 564(8) The number 6418 is not a valid octal number because 8 is not a valid digit. Consider an Octal number 234.56(8) which can be represented in equivalent value as. 2x82 +3x81+4x80+5x8-1+6x8-2 Weights 82 81 80 8-1 8-2 Digits 2 3 4 5 6 Values 64 8 1 0.125 0.015625 Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 42| P a g e FUNDAMENTALS OF COMPUTER Hexadecimal Number System The hexadecimal number system consists of 16 digits from 0 to 9 and A to F. The letters A to F represent decimal numbers from 10 to 15. That is, ‘A’ represents 10, ‘B’ represents 11, ‘C’ represents 12, ‘D’ represents 13, ‘E’ represents 14 and ‘F’ represents 15. The base or radix of this number system is 16. Example: A4(16),1AB(16), 934(16),C(16) Consider a Hexadecimal number 5AF.D(16) which can be represented in equivalent value as 5x162+Ax161+Fx160+Dx16-1 Weights 162 161 160 16-1 Digits 5 A F D Values 256 16 1 0.0625 Number System Base Symbol used Binary 2 0, 1 Octal 8 0,1,2,3,4,5,6,7 Decimal 10 0,1,2,3,4,5,6,7,8,9 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Hexadecimal 16 Where A=10;B=11;C=12;D=13;E=14;F=15 Suhas B Raj. Asst.Prof.Dept of CA,MITFGC 43| P a g e FUNDAMENTALS OF COMPUTER Inter Conversions Conversion from Decimal to Binary Step1: Divide the given decimal number by 2. Step2: Take the remainder and record it on the right side. Step3: Repeat the Step 1 and Step 2 until the decimal number cannot be divided further. Step4: The first remainder will be the LSB and the last remainder is the MSB.The equivalent binary number is then written from left to right i.e. from MSB to LSB. Example: To convert the decimal number 87(10) to binary. So 87 decimal is written as1010111 in binary. It can be written as 87(10) =1010111(2). Convert decimal fraction number to binary number Step1: Multiply the given decimal fraction number by 2. Step2: Note the carry and the product. Step3: Repeat the Step 1 and Step 2 until the decimal number cannot be divided further. Step4: The first carry will be the MSB and the last carry is the LSB. The equivalent binary fraction number is written from MSB to LSB. Example1: To convert the decimal number 0.3125(10) to binary. Multiplyby2 Carry Product 0.3125 x2 0(MSB) 0.625 0.625 x2 1 0.25 0.25 x2 0 0.50 0.50 x2 1(LSB) 0.00 0.00 Therefore, 0.3125(10) = 0.0101(2) OR Suhas B Raj. Asst.Prof. Dept of CA, MITFGC 44 |page FUNDAMENTALS OF COMPUTER Example2: To convert the decimal number 152.671875(10) to binary. Steps to convert binary number to decimal number Step1: Start at the right most bit. Step2: Take that bit and multiply by 2n, when n is the current position beginning at 0 and increasing by1 each time. This represents a power of two. Step3: Then add all the products. Step4: After addition, the resultant is equal to the decimal value of the binary number. Example1: To convert the binary number 1010111(2) to decimal. Therefore, 1010111(2) =87(10) Example2: To convert the binary number 11011.101(2) to decimal. =1x24+1x23+0x22+1x21+1x20+1x2-1+0x2-2+ 1x2-3 Suhas B Raj. Asst.Prof. Dept of CA, MITFGC 45 |page FUNDAMENTALS OF COMPUTER =1x16 + 1x8 + 0x4+1x2+1x1 + 1x0.5+0x0.25+ 1x0.125 =16 +8 +2+1 +0.5 +0.125 = 27.625(10) OR Weights 24 23 22 21 20 2-1 2-2 2-3 Digits 1 1 0 1 1 1 0 1 Values 16 8 4 2 1 0.5 0.25 0.125 Therefore, 11011.101(2) =27.625(10) Conversion from Decimal to Octal Step1: Divide the given decimal number by8. Step2: Take the remainder and record it on the side. Step3: Repeat the Step1 and Step 2 until the decimal number cannot be divided further. Step4: The first remainder will be the LSB and the last remainder is the MSB.The equivalent octal number is then written from left to right i.e. from MSB to LSB. Example 1: To convert the decimal number 3034(10) to octal number. ✓ So 3034 decimal is written as 5732 in octal. ✓ It can be written as3034(10)=5732(8) ✓ Note: If the number is less than 8 the octal number is same as decimal number. Example 2: To convert the decimal number 0.3125(10) to octal number. 0.3125 x 8 = 2.5000 2 0.5000 x 8 = 4.0000 4 Therefore, 0.3125(10) =0.24(8) Convert octal number to decimal number Step1: Start at the right most bit. Step2: Take that bit and multiply by 8n, when n is the current position beginning at 0 and Suhas B Raj. Asst.Prof. Dept of CA, MITFGC 46 |page FUNDAMENTALS OF COMPUTER increasing by 1 each time. This represents the power of 8. Step3: Then add all the products. Step4: After addition, the resultant is equal to the decimal value of the octal number. Example 1: To convert the octal or base 8 number 5732(8) to decimal =5x83+7x83+3x81+2x80 =5x512+7x64+3x8+2x1 =2560+448+24+2 =3034 Therefore, 5732(8) = 3034(10) Example2: To convert the octal number 234.56 (8) to decimal number. =2x82+3x81+4x80+5x8-1+6x8-2 =2x64+ 3x8+ 4x1+ 5x0.125+ 6x0.015625 =128 +24 + 4+0.625 +0.09375 = 156.71875(10) OR Weights 82 81 80 8-1 8-2 Digits 2 3 4 5 6 Values 64 8 1 0.125 0.015625 Therefore, 234.56(8) =156.71875(10) Conversion from Decimal to Hexadecimal Step 1: Divide the decimal number by16. Step 2: Take the remainder and record it on the side. Step3: Repeat the Step 1 and Step 2 until the decimal number cannot be divided further. Step4: The first remainder will be the LSB and the last remainder is the MSB.The equivalent hexadecimal number is then written from left to right i.e. from MSB to LSB. Example To convert the decimal number 16242(10) to hexadecimal ✓ So 16242 decimal is written as 3F72 in hexadecimal. 16 16242 16 1015 2 LSB ✓ It can be written as 16242(10)=3F72(16) 16 63 7 ✓ Note: If the number is less than 16 the hexadecimal number is same as 16 3 F MSB Suhas B Raj. Asst.Prof. Dept of CA, MITFGC 47 |page FUNDAMENTALS OF COMPUTER Decimal number. Convert hexadecimal number to decimal number Step1: Start at the right most bit. Step2: Take that bit and multiply by16n, where n is the current position beginning at 0 and increasing by1 each time. This represents a power of 16. Step3: Then add all the products. Step4: After addition, the resultant is equal to the decimal value of the hexadecimal number. Example1: To convert the Hexadecimal or base-16 number 3F72 to a decimal number. Therefore, 3F72 (16) =16242(10) Example2: To convert the hexadecimal number 5AF.D (16) to decimal number. =5x162+10x161+15x160 +13x16-1 =5x256+10x16 +15x1 +13x0.0625 =1280 +160+15+0.8125 = 1455.8125(10) OR Weights 162 161 160 16-1 Digits 5 A F D Values 256 16 1 0.0625 Therefore, 5AF.D (16) =1455.8125(10) Conversion from Binary to Octal Step1: Take a binary number in groups of 3 and use the appropriate octal digit in its place. Step2: Begin at the rightmost 3 bits. If we are not able to form a group of three, insert 0s to the left until we get all groups of3bits each. Suhas B Raj. Asst.Prof. Dept of CA, MITFGC 48 |page FUNDAMENTALS OF COMPUTER Step3: Write the octal equivalent of each group. Repeat the steps until all groups have been converted. Example1: Consider the binary number 1010111(2) 1 010 111 1 2 7 Therefore, 1010111(2) =127(8) Example2: Consider the binary number 0.110111(2) 0 110 111 0 6 7 Therefore, 0.110111(2) =0.67(8) Example3: Consider the binary number 1101.10111(2) 001 101 101 110 1 5 5 6 Therefore, 1101.10111(2) =15.56(8) Note: To make group of 3 bits, for whole numbers, it may be necessary to add a0’s to the left of MSB and when representing fractions, it may be necessary to add a 0’s to right to LSB. Conversion from Octal to Binary Step1: Take the each digit from octal number Step2: Convert each digit to3-bit binary number (Each octal digit is represented by a three bit binary number as shown in Numbering System Table). Octal digit 0 1 2 3 4 5 6 7 Binary 000 001 010 011 100 101 110 111 Equivalent Example1: Consider the octal number 456(8) into binary 4 100 5 101 6 110 Therefore, 456(8) =100101110(2) Suhas B Raj. Asst.Prof. Dept of CA, MITFGC 49 |page FUNDAMENTALS OF COMPUTER Example2: Consider the octal number73.16 (8) into binary 7 100 3 101 1 001 6 110 Therefore, 73.16(8) = 100101.001110 (2) Conversion from Binary to Hexadecimal Step1: Take a binary number in groups of 4 and use the appropriate hexadecimal digit in its place. Step2: Begin at the rightmost 4 bits. If we are not able to form a group of four, insert 0s to the left until we get all group’s of4 bits each. Step3: Write the hexadecimal equivalent of each group. Repeat the steps until all groups have been converted. Example1: Consider the binary number 1011001(2) 0101 1001 5 9 Therefore, 1011001(2) =59 (16) Example2: Consider the binary number 0.11010111(2) 0 1101 0111 0 D 7 Therefore, 0.110111(2) =0.D7 (16) Conversion from Hexadecimal to Binary Step1: Take the each digit from hexadecimal number Step2: Convert each digit to 4 bit binary number. (Each hexadecimal digit is represented by a 4 bit binary number as shown in Numbering System Table). Example: Consider the hexadecimal number CEBA (16) Therefore, CEBA (16) =1100 1110 1011 1010(2) Conversion from Hexadecimal to Octal Step1: write the binary equivalent of each hexadecimal digit. Suhas B Raj. Asst.Prof. Dept of CA, MITFGC 50 |page FUNDAMENTALS OF COMPUTER Step2: Regroup the min to3 bits from the right side with zeros added, if necessary. Step3: Convert each group into its equivalent octal digit. Example: Consider the hexadecimal number FADE (16) F 1111 A 1010 D 1101 E 1110 Therefore, FADE (16) =1111 10101101 1110 (2) Group the bits into group of 3 bits from LSB as 001 111 101 011 011 110 1 7 5 3 3 6 FADE (16) =175336 (8) Suhas B Raj. Asst.Prof. Dept of CA, MITFGC 51 |page FUNDAMENTALS OF COMPUTER 1’sComplement representation This is the simplest method of representing negative binary number. The 1’s complement of a binary number is obtained by changing each 0 to 1 and each 1 to 0. In other words, change each bit in the number to its complement. Example 1: Find the 1’s complement of 101000. Original binary number 1 0 1 0 0 0 Find 1’s Complement 0 1 0 1 1 1 Thus 1’s complement of 101000 is 010111. Example 2: Find the 1’s Complement of 1010111. Original binary number 1 0 1 0 1 1 1 Find 1’s Complement 0 1 0 1 0 0 0 Thus 1’s complement of 101000 is 010111. 2’s Complement representation The 2’s complement of a binary number is obtained by taking 1’s complement of the number and Adding 1 to the Least Significant Bit (LSB) position. The general procedure to find 2’s complement is given by: 2’s Complement = 1’s Complement + 1 Example 1: Find the 2’s complement of 101000. Original binary number 10 1 0 0 0 Find 1’s Complement 01 0 1 1 1 Add 1 to LSB + 1 Hence 2’s Complement of 101000 is 01 1 0 0 0 Example 2: Find the 1’s and 2’s complement of 1011101. Original binary number 10 1 1 1 0 1 1’s Complement 01 0 0 0 1 0 + 1 Hence 2’s Complement is 0 1 0 0 0 1 1 Suhas B Raj. Asst.Prof. Dept of CA, MITFGC 52|page FUNDAMENTALS OF COMPUTER Note: Negation: It is the operation of converting a positive number to its negative equivalent or a negativenumber to its positive equivalent. Negation is performed by performing 2’s complement system. Example 1: Consider the number +12. Its binary representation is 01100(2). Find the 2’s Complement of +12. Original binary number 0 1 1 0 0 Find 1’s Complement 1 0 0 1 1 Add 1 to LSB + 1 2’s Complement 1 0 1 0 0 Clearly, this is a negative number since the sign bit is 1. Actually, 10100 represent -12(10) which is the negative equivalent of the number 12(10) Example 2: Consider the number -12. Its binary representation is 10100(2). Find the 2’s Complement of -12. Original binary number 1 0 1 0 0 Find 1’s Complement 0 1 0 1 1 Add 1 to LSB + 1 2’s Complement 0 1 1 0 0 Clearly, this is a positive number since the sign bit is 0. Actually, 01100 represent 12(10) which is the negative equivalent of the number -12(10) Subtraction of Binary Number using Complement Most of the computers perform subtraction using complemented number. This is less expensive because the same addition circuit is used for subtraction with slight changes in the circuit. In the binary number system, we can perform subtraction operation using two methods of complements: o Subtraction using 1’s Complement o Subtraction using 2’s Complement Suhas B Raj. Asst.Prof. Dept of CA, MITFGC 53|page FUNDAMENTALS OF COMPUTER Subtraction using 1’s Complement Case 1: Subtracting a smaller number from a larger number (Minuend is greater than Subtrahend) o Step 1: Find the 1’s complement of the subtrahend. o Step 2: Add this to the minuend. o Step 3: Carry is generated, this carry is called as the end around carry o Step 4: Add the end around carry back to the LSB to get the final difference. Example 1: Subtract 15 from 23 using 1’s complement. Decimal Binary Minuend 23 10111 Subtrahend -15 01111 1’s complement of subtrahend is 10000 Minuend 10 1 1 1 1’s Complement of subtrahend +10 0 0 0 End around carry 110 1 1 1 Add end around carry + 1 Difference is 10 0 0 Case 2: Subtracting a larger number from a smaller number (Minuend is less than Subtrahend) o Step 1: Find the 1’s complement of the subtrahend. o Step 2: Add this to the minuend. o Step 3: There will be no carry, Re complement the answer to get the difference Example 1: Subtract 52 from 25 using 1’s complement. Decimal Binary Minuend 25 011001 Subtrahend -52 110100 1’s complement of subtrahend is 001011 Minuend 01 1 0 0 1 1’s Complement of subtrahend +00 1 0 1 1 10 0 1 0 0 Since there is no carry take 1’s complement and 01 1 0 1 1 attach a negative sign Hence, the result = - 011011 i.e. - 27 Suhas B Raj. Asst.Prof. Dept of CA, MITFGC 54|page FUNDAMENTALS OF COMPUTER Subtraction using 2’s Complement Case 1: Subtracting a smaller number from a larger number (Minuend is greater than Subtrahend) o Step 1: Find the 2’s complement of the subtrahend. o Step 2: Add this to the minuend. o Step 3: Carry is generated, Discard the carry and the remaining bits give the difference. Example 1: Subtract 09 from 17 using 2’s complement. Decimal Binary Minuend 17 10001 Subtrahend -09 01001 1’s complement of subtrahend (9) is 1 0 1 1 0 Add 1 to LSB + 1 STEP 1 2’s complement of 9 is 10111 Minuend 10 0 0 1 2’s Complement of subtrahend +1 0 1 1 1 STEP 2 End around carry 0 10 1 0 0 Discard the carry STEP 3 Difference is 10 0 0 Hence, the result = 1000 i.e. 8 Case 2: Subtracting a larger number from a smaller number (Minuend is less than Subtrahend) o Step 1: Find the 2’s complement of the subtrahend. o Step 2: Add this to the minuend. o Step 3: There will be no carry, hence take the 2’s complement of the answer and place a Negative sign in front. Example 1: Subtract 47 from 26 using 2’s complement. Decimal Binary Minuend 26 011010 Subtrahend -47 101111 1’s complement of subtrahend (47) is 0 1 0 0 0 0 Add 1 to LSB + 1 STEP 1 2’s complement of 9 is 010001 Suhas B Raj. Asst.Prof. Dep