Fit 1
Fit 1
Fit 1
It is an electronic device, which can perform arithmetic operations at a very fast speed. It is the fastest calculating device. It is the device, which operates on data, stores it, processes and retrieves information as and when required. It is also known as data processor. The act of processing [Storing, Sorting, Searching, Manipulating] data using a computer system is called data processing. Data is the raw facts or figures and information is the processed data. Any computer system is made up of following four parts 1. Hardware: These are the physical devices such as monitor, printer, keyboard, mouse etc. 2. Software: It is a set of instructions, which makes computer to perform tasks. It tells the computer what to do. Some times these set of instructions are called programs. 3. Users: People who actually use the computer system for their own help are called users. Data: it consists of raw facts or bits of information. The computer organizes data in various files. The computer system have following hardware components 1. CPU: It is the brain of the computer system. It controls all the peripherals attached to it and executes various instructions. 2. Input devices: These devices are used to provide inputs to the computer. For example Mouse, Keyboard, Joysticks etc. 3. Output devices: With these devices we can get the output. For example Monitor, Printer, Plotter etc. 4. Read Only Memory (ROM): Some instructions are required permanently in order to start the computer system. Every time a computer is switched on, these instructions are carried out in a specific order until the computer is started properly. It contains a set of startup instructions, which ensures that various kinds of the memories attached with the computer system are functioning properly, also checks for the peripherals and operating
Page 1 of 2
system. This memory is non volatile in nature, it means the data / instructions stored in it are stored permanently they does not get lost. 5. Random Access Memory (RAM): Whenever an application is started or some input is given via some input device, it is stored in RAM. RAM is volatile in nature, it means as soon as the system is shut down, the data stored in this memory gets lost. The size of RAM is a factor in determining the speed of a computer. 6. Mass storage device (Hard Disk): It allows us to store very big amount of data permanently. The capacity of Hard disks available in the market is up to 80GB.
Page 2 of 2
Relationship Between Human-Being & A Computer In principle a computer works purely on the working philosophy of a human being. It hardware parts are analogues to human parts as shown below S.No. Human Being 1 Brain 2 Permanent Memory With Brain 3 Very Fast Memory With Brain 4 Slow Memory With Brain 5 Secretary Or Personal Assistant 6 Telephone Diary / Notepad 7 Eye / Nose / Ear / Tongue 8 Mouth / Hands / Legs Computer CPU ROM CPU Registers RAM Cache Memory CD /Floppy / Hard Disk Input Devices Key Board /Mouse / Joysticks Output Devices Monitor / Printer /Plotter
Characteristics Of A Computer
1. Automatic: A machine is said to be automatic if it works without human intervention. Once they start on a job, they carry on until it is completed without any human assistance. 2. Speed: It is a very fast device. The latest computer can perform a take in the billionth portion of a second. 3. Accuracy: The degree of accuracy of a computer is very high. It can find out the results of mathematical calculation accurate up to 20 places of decimal and very speedily. 4. Diligence: Unlike humans a computer is free from tiredness and lack of concentration. It can continuously work for hours, without creating errors or grumbling. 5. Versatility: A computer is capable of performing almost any task, if the task can be reduced to a series of logical steps. It can send and receive data in various forms like text, sound, video, graphics etc. Because of this it is used in all fields of life. 6. Storage: It can store very large amount of data and also it can retrieve the information required, in fractions of a second. After several years the information can be recalled and it would be as accurate as on the day when it was inputted to the computer. 7. No IQ: It does not possess any intelligence of its own. It has to be told what to do and in which sequence. 8. No Feelings: They have no feelings and no instincts because they are machines hence computers themselves cannot make any judgments on their own. The judgment taken by the computer is based on the instructions and data present with it.
Computer Classification
Types of Computer By Use Digital Computer: A digital computer is designed to process data in numerical form. The digital computer works on binary number system. The binary system has only two binary digits (BITs) 0 and 1. Binary digits are easily expressed in the computer circuitry by the presence (1) or absence (0) of a current or voltage. A series of eight consecutive bits is called a Byte. A byte permits 28 = 256 different on-off combinations of bits. Hence with 256 distinct bit combinations, we can represent 256 distinct alphanumeric characters, numeral, punctuation characters and special characters etc. The standard for this representation of character set is known as ASCII-8. Some languages, such as Japanese, Chinese, and Korean, require more than 256 unique symbols. The use of two bytes, or 16 bits, for each symbol, permits the representation up to of 65,536 characters or ideographs. Such an arrangement is called a Unicode Character. It is the international standard for such a character set. Digital computers are used for reservations systems, scientific investigation, dataprocessing and word-processing applications, desktop publishing, electronic games and many other purposes. Analog Computer: The application of analog computers is at all places where; the data is a function of time. For example Speedometers and Watt-Hour Meters etc. An analog computer operates on data provided by the physical instruments. It is designed to process data with variable parameters. It translates the relationships between the variables into analogous relationships in binary. This feature helps, analog computers to be useful in the simulation and evaluation of dynamic situations, such as the spacecraft path simulation, changing weather patterns over the globe. The key component of the analog computer is the operational amplifier. The number of
Hybrid Computer: This computer is a combination all the features of Digital and Analog computers. In this computer some part of the problem is solved in Digital way and some part is solved in Analog way at the same time. They have the very good functionality of Analog computer and all the qualities of a Digital computer in it. Types of Computer By Capability There is variety of computers that we see today. They can be divided into different categories depending upon the size, efficiency, memory and number of users. Broadly they can be divided it to the following categories. It is important to note that this categorization was fruitful before the year 1995. The computer available now a days (Pentium IV) are very much powerful than the mainframe computer of early 1995. Microcomputer: It is a small, low cost computer with a processor based on single silicon chip. It contains a microprocessor as its CPU, a memory unit, an Input device and an Output device. The word length of a microcomputer lies in the range of 8 to 32 bits. Microcomputer has wide range of application for example they are used for Daily Routine Works, Industrial Control, Instrumentation etc. Note A latest stand alone PC with configuration (Pentium IV 2.8 GHz, 512 MB RAM, 80 GB Hard Disk, DVD Combo Drive) can be referred as a Microcomputer now a days. Mini Computer: Mini computers were faster and more powerful than microcomputer in earlier 1995. Their word length is 32 bit or more. Most minicomputers use Motorola 68030 and 68040 processor as the CPU. This is designed to support more than one user at a time. A mini computer can support up to 64
terminals and are extensively used for Payroll Applications, Accounting and Scientific computation. A minicomputer is a medium sized general-purpose computer that supersedes the microcomputer of early 1995 in cost, storage capacity, speed and ability to support a great variety of peripheral device. Most of HLL and OS available before year 1995 were supported by minicomputer. Minis were common in Research Groups, Engineering Firms and Colleges. This type of computer was generally used for processing large volume of data in an organisation. Note A Client Sever Network with about 80 PCs having latest configuration (Pentium IV 2.8 GHz, 512 MB RAM, 80 GB Hard Disk, DVD Combo Drive) for all can be referred as a Minicomputer now a days. Practically minicomputer concept is not used now a days. Mainframes: Mainframe computers were very powerful general purpose computers. They were faster and more powerful than mini computers. Their word length may vary from 48 to 64 bits, memory capacity is 64 to 256 MB, HDD capacity is 1 GB or more. It was used where large amount of data are to be processed or very complex calculations were to be made. They were mainly used in large business and government organization, banks and airline reservation, where large database were required. A multiprocessor main frame can process several tasks at the same time. Most of HLL and OS available before year 1995 were supported by minicomputer. Note A Client Sever Network with about 200 PCs having latest configuration (Pentium IV 2.8 GHz, 512 MB RAM, 80 GB Hard Disk, DVD Combo Drive) for all can be referred as a Mainframe computer now a days. Practically mainframe concept is not used now a days.
Supercomputer: Super Computers are much faster and powerful than all other computers. Their word length ranges from 256 to 512 bits, main memory capacity is 100 GB or more. A super computer works on multiprocessor concept hence it contains a number of CPUs, which work in parallel to make it faster. Super computers are used for massive data processing and solving very complicated engineering problems. They are used for weather forecasting, biomedical research, remote sensing, weapons, R & D, rocketing and atomic physics and other areas of science and technology. Examples of supercomputers are CRAY YMP, CRAY2, NEC SX-3, CRAY XMP and PARAM10000 from India.
COMPUTER GENERATIONS The evolution of computer started from 16th century and resulted in the form that we see today. The present day computer, however, has also undergone rapid change during the last fifty years. This period, during which the evolution of computer took place, can be divided into five distinct phases known as Generations of Computers. Each phase is distinguished from others on the basis of the type of switching circuits used. First Generation (1951-1958) The first generation computers were the voluminous computers. These computers used electronic valves like the ones used in radios and hybrid televisions. ENIAC was the first computer of this category. ENIAC and various other computers of large mainframe type which fall in first generation category are described here: Electronic Numerical Integrator & Calculator (ENIAC): The first electronic based machine was made in 1946 by J.P.Eckert and J.W.Mauchly at the University of Pennysylvania of U.S.A. and was called Electronic numeric integrator and calculator machine. Electronic Delay Storage Automatic Computer (EDSAC): It was built by M.V.Wilkes at Cambridge University in 1949. Lyons Electronic Office (LEO): The first commercial computer was produced by M.V.Wilkes. IBM-701 and IBM-650: These were introduced in 1953 and 1954 respectively by International Business Machines Corporation (IBM). The IBM-650 was the first modern digital computer produced on mass scale. Advantages Vacuum tubes were the only electronic components available during those days. Vacuum tube technology made possible the advent of electronic digital computers.
Page 1 of 6
These computers were the fastest calculating devices of their time. They could perform computations in milliseconds. Disadvantages 1. Too bulky in size 2. Unreliable 3. Thousands of vacuum tubes that were used emitted large amount of heat and burn out frequently 4. Air conditioning required 5. Prone to frequent hardware failure 6. Constant maintenance required 7. Non portable 8. Manual assembly of individual components into functioning unit required 9. Commercial production was difficult and costly 10. Limited commercial use Second Generation (1959-1964) Thanks to the Noble Prize winners John Burdeen, Walter H Brattain and William B Shokley who jointly discovered the transistor (short name for transfer resistor) in the laboratories of Bell Telephone, the company that even today runs most of American telephone systems. The transistor, a smaller and more reliable successor to the vacuum tube, was invented in 1947. However, computers that used transistor were not produced in quantity until over a decade. The second generation emerged with transistor being the brain of the computer. With both the first and the second generation computers, the basic component was a discrete or separate entity. The many thousands of individual components had to be assembled by hand into functioning circuits. The manual assembly of individual components and the cost of labour involved at this assembly stage made the commercial production of these computers difficult and costly.
Page 2 of 6
Advantages 1. Smaller in size as compared to first generation computers 2. More reliable 3. Less heat generated 4. These computers were able to reduce computational times from milliseconds to microseconds 5. Less prone to hardware failures 6. Better portability 7. Wide commercial use Disadvantages 1. Air conditioned required 2. Frequent maintenance required 3. Manual assembly of individual components into a functioning unit was required 4. Commercial production was difficult and costly Third Generation (1965-1970) In 1964, the third generation computers were introduced. These had integrated transistor circuits (I.C.) having higher speed, larger storage capacities and lower price. These computers were called mini computers. Instead of having one transistor of its own, several transistors could be integrated with the other components and sealed up in a small package. The package was called an integrated circuit, I.C. or more popularly a chip. The I.C. was invented by Jack Kilby at Texas Instruments in year 1958. Advantages 1. Smaller in size as compared to previous generation computers. 2. Even more reliable than second generation computers. 3. Even lower heat generated than second generation computers.
Page 3 of 6
4. These computers were able to reduce computational times from microseconds to nanoseconds. 5. Maintenance cost is low because hardware failures are rare. 6. Easily portable. 7. Totally general purpose. Widely used for various commercial applications all over the world. 8. Less power requirement than previous generation computers. 9. Manual assembly of individual components into a functioning unit not required. So human labour and cost involved at assembly stage reduced drastically. 10. Commercial production was easier and cheaper. Disadvantages 1. Air conditioning required in many cases. 2. Highly sophisticated technology required for the manufacture of IC chips. Fourth Generation (1971-1980) Initially, the integrated circuits contained only about ten to twenty components. This technology was named small scale integration (SSI). Later, with the advancement in technology for manufacturing ICs, it became possible to integrate upto a hundred components on a single chip. This technology came to be known as medium scale integration (MSI). Then came the era of large scale integration (LSI) when it was possible to integrate over 30,000 components onto a single chip. Effort is still on for further miniaturization and it is expected that more than one million components will be integrated on a single chip known as very large scale integration (VLSI). A fourth generation computer, which is what we have now, has LSI chips as its brain. It is LSI technology which has led to the development of very small but extremely powerful computers. It was the start of a social revolution. A whole computer circuit was soon available on a single chip, the size of a postage stamp. Overnight computers became incredibly
Page 4 of 6
compact. They became inexpensive to make and suddenly it became possible for anyone and every one to own a computer. Advantages 1. Smallest in size because of high component density. 2. Very reliable. 3. Heat generated is negligible. 4. No air conditioning required in most cases. 5. Much faster in computation than previous generation. 6. Hardware failure is negligible and hence minimal maintenance is required. 7. Easily portable because of their small size. 8. Totally general purpose. 9. Minimal labour and cost involved at assembly stage. 10. Cheapest among all generations. Disadvantage Highly sophisticated technology required for the manufacture of LSI chips. Fifth Generation (1981-till date) Scientists are now at work on the fifth generation computers a promise, but not yet a reality. They aim to bring us machines with genuine I.Q., the ability to reason logically, and with real knowledge of the world. Thus, unlike the last four generations which naturally followed its predecessor, the fifth generation will be totally different, totally novel, totally new. In structure it will be parallel and will be able to do multiple tasks simultaneously. In functions, it will not be algorithmic. In nature, it will not do just data processing but knowledge processing. In interface, it will not be merely deductive, but also inductive. In application, it will behave like an expert. In programming, it will interact with humans in ordinary language. And in architecture, it will have KIPS (Knowledge Information Processing System) rather than the present DIPS/LIPS (Data/Logic Information Processing System).
Page 5 of 6
The odds of coming out with a fifth generation computer are heaviest for Japan. They have already started work in this direction few years back. Japan has chosen the PROLOG (Programming in Logic) language as its operating software and plans to have the final machine talk with human beings, see and deliver pictures and hear the normal, natural language.
Page 6 of 6
Generations
Third 1965-1970 Integrated Circuit Solid state main storage More flexible I/O, disk oriented, Better OS to control I/O reduces human intervention Greater use of HLLs. Fourth 1971-1980 Large scale Integration IC Based Greater Versatility of I/O devices Fifth 1981-??? VLSI IC Based RAM and Storage unlimited
Capacitywise more than First Generation Punched card orientation Magnetic tape orientation Secondary Memory & I/O Low Level Symbolic Language High level Language (COBOL, FORTRAN)
Lanuages Used
Availability of special Languages like C#, Java, programs for special Artificial intelligence applications like packages
Reduction in size and Smaller size, better Modularity and Note book PC, Laptops increased speed and performance and reliability, compatibility of reliability emergence of miniequipment, emergence computers of microcomputers Batch oriented application. Updating Inventory, Airline, Payroll processing Real time Application with Simulation & modeling, Robotics, Fuzzy Logic remote processing, EFT transfer home Reservation, Market computers Forecasting, credit card billing. INTEL P-IV
IBM 1401, Honeywell IBM system 360, Burrough IBM 3081, Burrough B6500, NCR 395 B7900, DEC 2010, IBM 200, CDC 1604 PC-XT
Applications of Computer A computer is today used in a wide range of fields such as business, banking, education, medical care, scientific and engineering applications, manufacturing, legal practice, law enforcement, military affairs, sports and personal use in the home etc. Today the trend is that, computers continue to shrink in size while providing more power. New applications of computer are continually being discovered. 1. Computers In Education: Computers have revolutionized the education field. People from all streams of life now use computers to carry out work for their own intellectual benefits. Computers have made their permanent place in classrooms and libraries where they have become essential to the learning process such as for analyzing, interpreting, searching and scanning the books, journals and magazines. 2. Scientific Us of Computers: Computers can be used scientifically to develop hypothesis, collect and analyse test data, and exchange information electronically with colleagues through out the world. Scientists can access remotely placed databases without travelling any farther than the closest computer. Scientists can also use computers to simulate complex events such as predicting what damage earthquakes is going to do and what will be its intensity or how pollution will change the weather patterns. Sophisticated software even allows intricate molecules to be designed, diagrammed and manipulated. It would be impossible to explore outer space without computers. Satellites and space probes have bought a wealth of information about our solar system and the cosmos. 3. Computers in Medicine and Health Care: In medical field, computers are used for multi purpose tasks such as diagnosing the disease, capture and transmit photographs of internal problems such as blood clots and tumours that previously can be seen only during exploratory surgery, monitoring patients at their bedside and controlling the movement of robotic surgical assistants. Several innovative medical applications use small, special pupose computers. For example pace makers are computers that operate within the human body to help it function better. In addition, computers are so tiny that they can be swallowed are proving to be diagnostic tool. 4. Computers in Engineering: A product designed with a computer can be far more productive than with pencil and paper. While designing a product with a computer, engineers create an electronic model by describing all three dimensions of the object. An object can be seen from a different perspective, by displaying views. On paper, a different drawing for each view is to be produced. To change the design, redraw every effective view, which is quite time consuming without computers.
1
Computer Aided Design (CAD) is used for designing objects with a computer. Specialized CAD systems are available for designing almost anything- from houses, car and buildings to molecules and spacecrafts. Expertise of CAD is now required for specialised engineering jobs. One of the most extensive uses of CAD in recent years was development of Boeings new 777 planes. Computer Aided Engineering (CAE) software allows designers to specify the type of the material to be used for each part. CAE enables to calculate whether the part is compatible with rest of the design and can withstand the necessary stresses and temperature. 5. Legal and Law Enforcement through Computers: Computer legal services software such as Lexis and WestLaw allow lawyers to search through huge collection of information called databases for case information. Lawyers can create their own databases for cases involving special judgements and hearings. The result of hearings can be seen on the computer screens just seconds after the actual statement is made. Computer technology does not stay in the attorneys office. Today, one can see it right in the court room and cab be used to translate all the statements onto readable text. Law enforcement agencies such as police departments use mobile computers, sometimes called mobile data terminals (MDT) in the squad cars. The mobile computer gives the car license number for reference and can tell the officer details like who owns the car, whether it was reported stolen or not etc. A technique commonly known as DNA Finger Printing is very widely used in forensic sciences as it can positively identify someone through traces of blood, skin or hair left at the crime spot. 6. Computers in Theatre, Film and Television: The theatre technicians use coordinated computer controlled lighting cues to brighten or dim the stage. The motion picture industry has achieved astounding computerized special effects. Movies now contain many visual tricks that could never be performed without the aid of computers. Technicians use highpowered computers to create an illusion of a locomotive flying through the air or a robot transforming it self into human being. Computer animation involves creating images of people or other creatures on a computer and then making the images of people or other creatures on a computer and then making the images appear to move against the real or computer generated background. For example, the dinosaurs in Jurassic park were created using computer animation. Jurassic park in particular took advantage of the motion tracking technique.
7. Computers at Home: The personal computers have become common in peoples home, for carrying out the record keeping and majority of household activities. Eg. Televisions contain small computers that automatically fine tune the image, select brightness and correct the colour tones. Washing machines, microwave ovens, dishwashers and sewing machines also use small computers to run them effectively 8. Business through Computers: Computers are ideally suited to handle primary business functions such as accounting, inventory, payroll and personnel etc. and now have become integral part of modern society that without them our economy would grind to a halt. Office people use them to write letters, create budgets, communicate with co-workers, find information, manage projects, and so on. They are such flexible tools that most people in the business community use them everyday. Most sales people who are mostly mobile carry portable computers known as laptops or notebooks, which are as powerful as the desktop models. Sale persons use computers to manage accounts and make presentations. With a laptop, a sales person can write letters, track travel expenses, update customer files and create colourful multimedia presentations to increase the sale value of a product. Computers are also vital in accounting departments for recording accounts receivable and accounts payable, organizing and manipulating large sets of numbers. They are now considered an essential commodity today even in small business as single person can afford to set up a sophisticated accounting system using personal computer. Even if you do not work in a business, the way businesses use computers affect every one. The petty tasks like buying petrol or making a phone call in a PCO involve interaction with computers The operation of a business can be broken down into sub systems or functional areas. Coordination is achieved by the flow of relevant information between these areas or departments. Financial Accounting: It includes external relationships, record keeping using ledger accounting, preparation of key statutory financial statements, tax computation and so on. The main emphasis is on recording, analysing and reporting on past activities. Management accounting includes product costing, cost control through budgets and standards, provision of financial information for planning, control and decision-making. Financial management requires data on purchases, sales, salaries, budget forecasts and control, and long & short-term finance requirements. Thus it will benefit from links with all functional areas in the organisation.
Manufacturing: It deals with all aspects of production process. It includes both long term and short term planning and decision making. This department will take data on stock levels, materials requirements planning, manpower requirements, quality control and production scheduling. Management information systems help with the planning and control of production and computer aided design is available to help with the design of products and process. Links with the marketing department are likely at the product design stage and with the accounts department for ordering from suppliers. Marketing: The work of a Marketing department will cover the following: Market research. Product development and planning Pricing Distribution Promotion One can collect data relating to market research, sales and distribution, customers and after sales service. This can be done with help of computers Personnel: Personnel management deals with all aspects of human resources of the organisation and can cover: Manpower planning Recruitment and selection Employee development Welfare Employee relations An employee database with link to the payroll software would increase efficiency in this functional area, but wider links are unlikely because of confidentiality of information.
Computer Architecture/Design A typical computer system has an Input Unit, a Central Processing Unit, Memory Unit and an Output Unit. This is also known as Von Neumann Architecture of the computer. Over the years the technology has changed but basic design/architecture is not changed. The important elements of a computer system are discussed in the following paragraphs.
Primary Memory ROM RAM
Cache Memory I N P U T U N I T O U T P U T U N I T
Control Unit
Registers ALU
Hard Disk
Floppy /CD
Secondary Memory
Page 1 of 18
Input Unit: The input unit links the external environment with the computer system. Data and instructions inputted to the computer system through this unit. The data can be inputted to the computer by various means, it can be entered through a keyboard, through a card reader, through a mouse etc. All the data supplied to the computer is transformed into the binary codes. Unit called input interface accomplishes this transformation. Input interface is designed to match the unique physical or electrical characteristics of input devices with the requirements of the computer system for example Keyboard, Mouse, Joy stick, Light Pen, Punched Cards, Optical Mark Reader, Magnetic Tape, Optical Character Reader etc. Output Unit: It links the computer with the external environment. The job of an output unit is just opposite of an input unit. It supplies information and results of computation to the outside world. As computers work with binary code, the results produced are also in the binary form. Hence, before supplying the results to the outside world, it must be converted to human readable form. Unit called output interface accomplishes this task. Output interface is designed to match the unique physical or electrical characteristics of output devices (e.g. Monitor, Printer, Plotter) with the requirement of the external environment. Central Processing Unit: The CPU Registers, Arithmetic Logical Unit (ALU) and Control Unit (CU) of a computer system are jointly known as the Central Processing Unit (CPU). It is the brain of any computer system. As in a human body, the brain takes all major decisions and controls all body parts, similarly, in a computer system, all major computations are made by the CPU and is also responsible for activating and controlling the operations of other units. The data it processes is obtained, via the system bus, from the main memory. Results from the CPU are then sent back to main memory via the system bus. Control Unit: The control unit is able to maintain order and direct the operation of the entire system. By selecting, interpreting, and decoding, it executes the program instructions. This unit acts as a central nervous system for the computer. It manages and coordinates the entire computer
Page 2 of 18
system. It directs the flow of data through the CPU, and to and from other devices. Control unit controls the input and output devices and the passing of data to the Arithmetic/Logical Unit for computation. The control unit stores the CPU's microcode, which contains the instructions for all the tasks the CPU can perform. Arithmetic Logic Unit: The Arithmetic Logic Unit (ALU) of a computer system is the place where the actual execution of the instructions takes place during the processing operation. The data and instructions, stored in the primary storage (RAM or Cache) prior to processing, are transferred as and when needed to the ALU. ALU uses various CPU registers to store Intermediate results of computations. The Final result of computations is transferred back to the primary storage. After the completion of processing, the final results that are stored in the primary storage unit are released to an output device or to a secondary storage device. The ALU is connected to a set of registers small memory areas in the CPU, which hold data and program instructions while they are being processed. The ALU is designed to perform all the basic Arithmetic Operations add, subtract, multiply, divide, Relational Operations such as comparisons using < , <=, > , >=, == etc and Logical Operations such as AND, OR, NOT. Primary Memory Primary memory is a type of semiconductor memory that is used to store the data and the instructions to execute that data, temporarily, before being executed. Every program, that needs to be executed, has to brought into this primary memory or main memory from the disk, where they are permanently stored, so that they can be made available to the CPU ready for execution. Primary memory is smaller than the secondary memory or hard disk, and extremely faster. It is volatile in nature i.e. information stored in it is lost as soon as the power is switched off. Primary memory is costlier than the hard disk. Primary memory is bound on the motherboard.
Page 3 of 18
Different Types of Primary Memory (Main Memory) 1. Read Only Memory (ROM) 2. Random Access Memory (RAM) 3. Complementary Metal Oxide Semiconductor Memory (CMOS) 4. Cache Memory Read Only Memory (ROM) This memory contains a number of programs (set of instructions). The most important program of ROM is the Basic Input Output System (BIOS), which activates the hardware (physical components of the computers), such as keyboard, mouse, monitor etc. Whenever computer is switched on, due to BIOS computer checks for all the attached devices and ensures that these devices are in working order, and if it is not working, it generates a message regarding appropriate device. Then it has some instruction to read the operating system form secondary storage device and load it in to the main memory (RAM) of the computer. As its name suggests that it is a read only memory and we can write any thing to it. The capacity of the ROM varies from 64 KB to 256 KB depending upon the model of computer. Characteristics of ROM 1. Non-volatile. 2. Commonly used for storing of program instructions that are not subjected to change. 3. Generally provided by manufacturer Types of ROM 1. Masked ROM Instructions are stored at the time of manufacturing so it cannot be altered. 2. PROM (Programmable ROM) Instructions are stored by the programmers after its manufacturing. Once instructions are stored it can not be erased or altered. 3. EPROM (Erasable Programmable ROM) It is similar to PROM but its contents can be washed out using Ultra Violet Rays and it can be reprogrammed.
Page 4 of 18
4. EPROM (Erasable Programmable Read Only Memory) It is Non-volatile, Programmable and alterable and can be exposed to ultra-violet light to erase its contents. 5. EEPOM (Electrically Erasable Programmable ROM) It is similar to EPROM but its contents can be washed out using high voltage current as UV Rays are costlier. 6. EEPROM (Electronically Erasable Programmable ROM) It is Non-volatile, Programmable, alterable and can be exposed to electrical charges to erase its contents. 7. EAPROM (Electrically Alterable ROM) As compared to EPROM and EEPROM, the information stored can be in EAPROM can be altered later. Random Access Memory (RAM) It is used at the very first instance when any operation on computer requires a memory. It is also used to store the data and instructions during the execution of programs. Contrary of ROM, RAM is temporary (volatile its contents gets washed when power goes off) and is erased when computer is switched off. The memory locations used by the system to store something are chosen randomly so it is called Random Access Memory. The capacity of RAM varies from 128 MB to several GBs with different modals of computer. Types of RAM 1. Dynamic RAM (DRAM) The information stored in this type of RAM has to be refreshed after every few milliseconds, otherwise it is erased. It happens because it is made up of various capacitors and these have tendency to decay its charge. DRAM has higher storage capacity and is cheaper than Static RAM. 2. Synchronous Dynamic RAM (SDRAM) It is a dynamic RAM with a new feature that this memory chip can be operated on the speed of internal clock cycle. Therefore it eliminates the Wait State of CPU during reading or writing operations. Also this RAM can handle bus speed up to 100 MHz. 3. Static RAM (SRAM) The information stored in this RAM need not be refreshed, but it remains stable as long as the power supply is provided. SRAM is costlier but has higher speed (up 10-20 ns) than DRAM. SRAM could be synchronized with internal clock pulse of CPU as SDRAM. In earlier days it was used for cache memory.
Page 5 of 18
4. Pipeline Burst Static RAM (PBS RAM) This memory chip replaced the synchronization problem of SRAM by collecting all the requests during wait state in a pipeline and then delivering the requests instantaneously during a CPU clock cycle and in this way it makes a queue of requests and empties it and when there is no request available in the pipeline we say it got burst (empty). 5. Rambus Dynamic RAM (RDRAM) This RAM can handle bus speed up to 600 MHz. It is used in Pentium IV systems. 6. DDR SDRAM DDR is an acronym for Double Data Rate SDRAM, that supports data transfers on both edges of each clock cycle (the rising and falling edges), effectively doubling the memory chip's data throughput. DDR-SDRAM also consumes less power, which makes it well-suited. A new specification of DDR-SDRAM has emerged in the market DDR-II-SDRAM. With data being transferred 64 bits at a time, DDR2 SDRAM gives a transfer rate of (memory clock rate) 2 (for bus clock multiplier) 2 (for dual rate) 64 (number of bits transferred) / 8 (number of bits/byte). Thus with a memory clock frequency of 100 MHz, DDR2 SDRAM gives a maximum transfer rate of 3200 MB/s. to notebook computers DDR-SDRAM is also called SDRAM II. Complementary Metal Oxide Semiconductor Memory (CMOS) This memory is used to store the system configuration, date, time and other important data. When computer is switched on, BIOS matches the information available in CMOS with peripheral devices and displays errors in case of mismatching. Cache Memory A special very high-speed memory is some times used to increase the speeds of processing by making current programs and data available to CPU at a rapid rate. As we are aware that the speed of CPU is quite high as compared to the access times of main memory. In many situations the performance of the processors are limited due to the slow speed of main memory.
Page 6 of 18
The technique used to companionate for the mismatch in the operating speeds to employ an extremely fast, small memory between CPU and the main memory whose access times comes close to the processing times of CPU. This type of memory is called a high-speed buffer or Cache Memory. It is used to store the segments of program currently being executed and/or temporary data frequently needed in present calculations. The main purpose of Cache memory is to look ahead currently needed information. It makes main memory appear to be faster and larger than it really is. It is very expansive hence the size the normally very small. The most important factor about this memory is in improving memory transfer rates and thus raising the processor speed. Moving data between RAM and the CPUs registers is one of the most time-consuming operations a CPU must perform, simply because RAM is much slower than the CPU. A partial solution to this is to include a cache memory in the CPU. Cache memory is similar to RAM, except that it is extremely fast compared to normal memory and it is used in a different way. When a program is running and the CPU needs to read data or program instructions from RAM, the CPU checks first to see whether the data is in cache memory. If the data is not there, the CPU reads the data from RAM into its registers, but it also loads a copy of the data into cache memory. The next time the CPU needs the same data, it finds it in the cache memory and saves the time needed to load the data from RAM. Types of Cache 1. Level-1 Cache Cache memory is built into most CPUs. This CPU resident cache is often called Level-1 cache. Today most CPUs have 256 KB of memory. 2. Level-2 Cache Cache is also added to the motherboard of the PC, This mother board resident cache is called Level-2 cache. These days systems are having 2 MB of cache memory and to provide the CPU with
Page 7 of 18
Factors Affecting the Processing Speed The design of a CPU determines the speed of the computer, but some other factors also can also be responsible for a computer to work faster. These factors are Cache Memory, the Clock Speed, and the Data Bus. Memory and Computing Power The amount of RAM in a computer can have a profound effect on the computing power of the computer. More RAM means the computer can use bigger, more powerful programs, and those programs can access bigger data files. With a bigger RAM a large program can fit into it at a glance and enables the computer to work faster. When the computer needs access to other parts of a program or data on the disk, it can unload, or swap out, nonessential parts from ram to the hard disk. Then again the computer can load, or swap in, in the program code or data it needs. While it is an effective method for managing a limited amount of memory (RAM), but the computers system performance is slower because the CPU, RAM, and Disk are continuously occupied with the swapping process. Computers generally come with at least 1 GB RAM, although 2 GB is rapidly becoming the standard, minimum for PCs. RAM chips usually are grouped together on small circuit boards called Single In Line Memory Modules (SIMMs) or Dual In Line Memory Modules (DIMMs). The main difference between SIMM and DIMM is the arrangement of the pins. The Computers Internal Clock Every microcomputer has a system clock, but keeping the time of day is not the clocks primary purpose. When electricity is applied, the molecules in the crystal vibrate millions of times per second, at a rate that never changes. The speed of the vibrations is determined by the thickness of the crystal. The computer uses the vibrations of the quartz in the system clock to time its processing operations. The computers operating speed is tied to the speed of the system clock. If a computers clock speed is 800 MHz, it ticks 800 million times per second. A clock cycle is a single tick,
Page 8 of 18
or the time it takes to turn a transistor off and back on again. A processor can execute an instruction in a given number of clock cycles. As the systems clock speed increases, so does the number of instruction it can carry out each second. Clock speeds up to 3 GHz and higher are now common, and processor speeds are increasing rapidly. The Bus A bus is a path between the components of a computer. There are two main buses in a computer: the Internal (or System) bus and the External (or Expansion) bus. The system bus resides on the motherboard. An expansion bus connects external devices, such as the keyboard, mouse, modem, printer, and so on, to the CPU. Cables from disk drives and other internal devices are plugged into the bus. The System Bus has two parts: the Data Bus and the Address Bus and the External Bus has a Control Bus. The Data Bus The data bus is an electric path that connects the CPU, memory, and the other hardware devices on the motherboard. The bus is a group of parallel wires. The number of wires in the bus affects the speed at which data can travel between hardware components, just as the number of lanes on a highway affects how long it takes people to reach their destinations. Because each wire can transfer 1 bit of data at a time, an 8 wire bus can move 8 bits at a time, which is a full byte. A 16 bit bus can transfer 2 bytes, and a 32 bit bus can transfer 4 bytes at a time. Newer model computers have a 64 bit data bus, which transfers 8 bytes at a time. The buss speed is also measured in MHz because it has its own clock speed. The faster a buss clock speed, the faster it can transfer data between parts of the computer. The majority of the computers today have a bus speed of either 100 MHz or 133 MHz.
Page 9 of 18
The Address Bus It is a set of wires similar to the data bus. The address bus connects only the CPU and RAM and carries only memory addresses. Each byte in RAM is associated with a number, which is its memory address. Traditionally, the number of bits they could transfer at one time measured the performance of computer buses. Buses now are also being measured according to their data transfer rates the amount of data they can transfer in a second. This type of performance usually is measured in megabits per second (Mbps) or megabytes per second (MBps). The Control Bus A control bus is a computer bus, used by CPUs for communicating with other devices within the computer. While the Address Bus carries the information on which device the CPU is communicating with and the Data Bus carries the actual data being processed, the Control Bus carries commands from the CPU and returns status signals from the devices, for example if the data is being read or written to the device then the appropriate line (read or write) will have to be active.
Page 10 of 18
Math Co-Processor It is also known as a numeric coprocessor or a floating point coprocessor. the math coprocessor is an optional processor add-on for the Intel 80386 and 80486 processors that allowed a computer to perform mathematical calculations more efficiently and faster, increasing the overall speed of a computer in many places. Today all computer processors released have the math coprocessor incorporated onto the processor. Most of the older computers (pre-486) were sold without coprocessors. So the CPU had to process all the computer's hardware and software functions, handle all interrupt requests (we'll talk later), and direct all information and data, as well as performing all floating point calculations. This required a lot of the processor's time.
Page 11 of 18
By having a second processor, or 'coprocessor', to take over the number crunching, it can free up a lot of the CPU's precious time. This would allow the Central Processing Unit to focus all of its resources on the other functions it has to perform, thus increasing the overall speed and performance of the entire system. It's not like this was a great revelation that came over the scientific community in the midst of home computer development. The absence of a math coprocessor in early home computer systems was a matter of keeping production costs down. The advantage was recognized right from the beginning, and most of these motherboards had an empty slot for the aftermarket addition of a coprocessor. The number (or name) of the math coprocessor followed the CPU's numbering sequence, only the last digit would be a '7', not a '6'. If you had an 8086 CPU then you could add an 8087 coprocessor. For an 80286 you would install an 80287, etc. CPU Registers There is a movement of information between the various units of the computer system. In order to handle this process properly, and to speed up the rate of information transfer, the computer uses a number of special memory units, called registers. These registers are used to hold information on a temporary basis, and are part of the CPU. The length of he register is the number of bits it can store. Hence, a register that can hold 8 bits is referred to as 8 bit register. The size of the register is also called word size. The bigger the word size, the faster the computer can process a data. The number of registers varies from computer to computer; there are some registers, which are common to all computers. The functions of these registers are as follows: 1. Memory address registers (MAR) It holds the address of the active memory location. It is loaded from the program control register, when an instruction is read from memory. 2. Memory Buffer register (MBR) It holds the contents of the memory word read from, or written in memory. An instruction word placed in this register is transferred to the instruction register. A data word placed in this register is accessible for operation with the accumulator register, or for transfer to the I/O register. A word to be stored
Page 12 of 18
in a memory location must first be transferred to MBR, from where it is written in the memory. 3. Program Control Register (PC) It holds the next instruction to be executed. The instructions of a program are stored in consecutive memory locations, and read and executed in sequence, unless a branch instruction is encountered. A branch instruction is an operation, which calls for a transfer to a non consecutive instruction. The address part of a branch instruction is transferred to the PC register, to become the address of the next instruction. 4. Accumulator Register (A) It holds the data to be operated upon, the intermediate results, and the result of processing. It is used during the execution of most instructions. The results of the arithmetic operations are returned to the accumulator register, for transfer to main memory, through the memory buffer register. 5. Instruction Register (I) It holds the current instruction being executed. As soon as the instruction is stored in this register, the operation part and the address part of the instruction are separated. The address part is sent to the MAR, while its operation part is sent to the control unit, where it is decoded and interpreted, and ultimately command signals are generated to carry out the task specified by the instruction. 6. Input/Output Register (I/O) It is used to communicate with the I/O devices. All input information such as instruction and data, are transferred to this register by an input device. Similarly all output information to be transferred to an output device, are found in this register. Expansion Slots and Boards An opening in a computer where a circuit board can be inserted to add new capabilities to the computer. Nearly all personal computers except portables contain expansion slots for adding more memory, graphics capabilities, and support for special devices. The boards inserted into the expansion slots are called expansion boards, expansion cards , cards , addins , and add-ons. Expansion slots for PCs come in two basic sizes: half- and full-size. Half-size slots are also called 8-bit slots because they can transfer 8 bits at a time. Full-size slots are sometimes
Page 13 of 18
called 16-bit slots. In addition, modern PCs include PCI slots for expansion boards that connect directly to the PCI bus. The expansion slots on the mother board are used for three purposes: 1. To give built-in devices: such as hard disks and diskette drives. 2. To provide I/O ports on the back of the computer for external devices such as monitors, external modems, printers and game controllers. 3. To give special purpose devices access to the computer. Ex. A computer can be enhanced with an accelerator card, a self contained device that enhances processing speed through access to computers CPU and memory by way of bus. Newer bus technologies such as Universal Serial Bus (USB) and IEEE 1394 enable many devices to be connected to one port. Small Computer System Interface (SCSI) is an older standard for extending the bus to multiple devices through a single port. The main types of IBM compatible expansion slots found are ISA, EISA, VESA, PCI, AGP, AMR, and CNR. 1. Industry Standard Architecture (ISA) ISA is a standard of computer bus. The original form of ISA was a simple and slow 8-bit bus used on IBM PCs. Eventually, the ISA connector was stretched to allow 16-bits of data to pass through each clock cycle, bringing its speed to between 8 and 10 MHz. 2. Extended Industry Standard Architecture (EISA) EISA also known as Extended ISA is a standard developed in 1988 for IBM and IBM compatible computers. The EISA BUS is found on Intel 80386, 80486 and early Pentium computers. This allows for 32-bit data transfers, while maintaining support for 8- and 16-bit expansion boards. EISA is not widely used, due to its high cost and complicated nature. 3. Video Electronics Standard Association (VESA) VESA is a group of monitor and video card manufactures that set various display standards. 4. Peripheral Component Interconnect (PCI) PCI was originally developed by Intel as an expansion to the ISA bus. This type of internal bus is the most commonly used in today's systems. It is a 32-bit bus that supports rates of 33 MHz; newer specs allow for
Page 14 of 18
64-bit transfers at 66 MHz. Many modern expansion boards are connected to PCI slots. 5. Accelerated Graphics Port (AGP) AGP is an advanced port designed for Video cards and 3D accelerators. Designed by Intel. AGP introduces a dedicated point-topoint channel so that the graphics controller can directly access the system memory. AGP is geared towards data-intensive graphics cards, such as 3D accelerators. 6. Audio/Modem Riser (AMR) It allows to create one card that has the functionality of either Modem or Audio or both Audio and Modem on one card. This new specification allows for the motherboard to be manufactured at a lower cost and free up industry standard expansion slots in the system for other additional plug-in peripherals. 7. Communication and Network Riser (CNR) It is a new specification that supports audio, modem USB and Local Area Networking interfaces of core logic chipsets. 8. USB (Universal Serial Bus) A new type of external bus contending to replace serial and parallel ports. Many devices can be connected to USB ports, which support Plugand-Play and hot-swapping. USB transfers data at speeds of 12 Mbps (megabits per second). 9. Serial Port A type of interface in which only 1 bit of data is transferred at a time. Mice and modems are usually connected to serial ports, which are also referred to as COM ports. 10. Parallel Port A type of interface that allows more than 1 bit of data to be processed at once. Printers are the most common peripheral devices connected to parallel ports. 11. PS/2 Another type of port (or interface) that can be used to connect mice and keyboards to the computer. The PS/2 port is sometimes called the mouse port. 12. PC Cards It is a type of an expansion card. It is a small device about the size of a credit card. It was initially designed for use in notebook computers and other computers that are too small to accept a standard expansion card. A PC card fits into a slot on the back or side of the computer. PC card adapters are also available for desktop computers, enabling them to accept PC cards. Some types of digital cameras
Page 15 of 18
also accept PC cards that store digital photographs. There are three categories of PC Card Technologies: Type I Type II, Type III. Type I cards usually contain memory. They are the thinnest available cards and have the fewest uses. Type II cards are used for network adapters. Type III cards usually house tiny hard drives. They are the thickest ones and they enable developers to fit disk storage devices into the card size shell. 13. Small Computer Systems Interface (SCSI) An intelligent peripheral I/O interface that allows many different peripheral devices to be attached to the host's SCSI port. It allows up to 8, 16 or 32 addresses on the bus depending on the width of the bus. Devices can include multiple hosts and peripheral devices (targets) but must include a minimum of one of each. SCSI interfaces provide for faster data transmission rates (up to 80 megabytes per second) than standard serial and parallel ports. In addition, you can attach many devices to a single SCSI port, so that SCSI is really an I/O bus rather than simply an interface. You can attach SCSI devices to a PC by inserting a SCSI board in one of the expansion slots. Many high-end new PCs come with SCSI built in. SCSI is used to attach devices such as disk drives and printers. The following varieties of SCSI are currently implemented: SCSI-1: Uses an 8-bit bus, and supports data rates of 4 MBps SCSI-2: Same as SCSI-1, but uses a 50-pin connector instead of a 25-pin connector, and supports multiple devices. This is what most people mean when they refer to plain SCSI. Wide SCSI: Uses a wider cable (168 cable lines to 68 pins) to support 16-bit transfers. Fast SCSI: Uses an 8-bit bus, but doubles the clock rate to support data rates of 10 MBps. Fast Wide SCSI: Uses a 16-bit bus and supports data rates of 20 MBps. Ultra SCSI: Uses an 8-bit bus, and supports data rates of 20 MBps.
Page 16 of 18
SCSI-3: Uses a 16-bit bus and supports data rates of 40 MBps. Also called Ultra Wide SCSI. It can support 127 devices. Ultra2 SCSI: Uses an 8-bit bus and supports data rates of 40 MBps. Plug and Play The plug and play standard makes it easier to install H/W via an existing port or expansion slot. Using H/W that complies with Windows Plug and Play standard, the operating system can detect a new component automatically, checks for existing driver programs that will run the new device, and load necessary files. In some cases Windows will prompt you to install the needed files from a disk. This process may require restarting the system for the new hardwares settings to take effect. This process is much simpler than the one required prior to Plug and Play technology, which force the users to manually resolve conflicts between the new hardware and other components. Machine Cycles The computer can only do one thing at a time. Each action must be broken down into the most basic steps. One round of steps from getting an instruction back to getting the next instruction is called the Machine Cycle. The machine cycle includes two smaller cycles: During the Instruction Cycle, the CPU "Fetches" a command or data from memory and "Decodes" it for the CPU.
Page 17 of 18
Steps of Execution of an Instruction by CPU 1. The CU takes the address of the next program instruction to be executed from the program control register, and reads the instruction from the corresponding memory address, into the instruction register of the CU. 2. The CU then sends the operation part and the address part of the instruction, to the decoder and the MAR. 3. The decoder interprets the instruction, and accordingly the CU sends signal to the appropriate unit, which needs to be involved in carrying out task specified in the instruction. The CU also ensures that the data corresponding to the address part of the instruction is loaded in a suitable register in the ALU, before the signal is sent to the ALU. The ALU performs necessary operation on data, and signals the control unit as soon as it has finished. 4. As each instruction is executed, the address of the next instruction to be executed automatically loaded into the PC register.
Page 18 of 18
Machine Languages
In the earliest days of computer the only programming language available were the machine languages. Machine languages were made up of streams of 0s and 1s, because the internal circuits of computer were made up of switches, transistors, gates and other electronic devices that can be in one of two states: ON or OFF. The ON state is represented by 1 and OFF state is represented by 0.
Example of Machine Language Instructions 00000001 01010001 01010000011111100 10101010 11100101 11011110101000111 11001010 10000000 00000101011111010
Symbolic Languages
In early 1950s, Grace Hopper, a mathematician and US Navy admiral, developed the concept of a special computer program that would convert programs in to machine language. Some symbols / mnemonics were developed like ADD for addition, SUB for subtraction, PUSH, CALL, RET, MOVE, JSB etc. The special program, called an Assembler, translates symbolic codes in to machine language. Because symbolic languages had to be assembled in to machine language, they soon became known as Assembly Language.
Page 1 of 8
Machine Language Operation Binary Codes Addition 00000000 Subtraction 00000010 Multiplication 00000011 Division 00000100 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 Human Instruction Machine Language Instruction 4 ADD 6 0100 00000000 0110 2 MULTIPLY 3 0010 00000011 0011 Symbolic Language Operation Mnemonic Codes Addition ADD Subtraction SUB Multiplication MUL Division (Remainder) MOD Division (Quotient) DIV Logical AND AND Logical OR OR Logical NOT NOT Push Operation PUSH Call Function CALL 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 Human Instruction Symbolic Language Instruction Addition of 4,6 0100 ADD 0110 Multiplication of 4,6 0100 MUL 0110
Natural Languages
Ideally, we could use our natural languages (such as English, French or Chinese) and the computer would understand it and it executes our requests immediately. Considerable work on natural language processing is being done in labs today. So far, it is used in industry but its scope is still quite limited.
Page 2 of 8
Machine Languages
1940s
1950s
1960s
1970s
1980s
1990s
Assembler Prepares
Assembler
Higher Level Language Programs
Compiler Prepares
Object Code
Linker Prepares
Interpreter
Page 3 of 8
Later on this executable code is loaded from secondary memory to main memory (RAM) by system's Loader for execution. Where as an Interpreter is a computer program that executes the instructions written in a programming language by converting these in to machine language. It is different from a Compiler in away that it checks the lines of code one by one where as a Complier reads all the lines of source code one at a time and prepares an error list.
Programming Approaches
There are 3 programming approaches since the advent of high-level languages. These are 1 Unstructured [Non Modular] approach 2 Structured [Modular] approach 3 Object oriented approach
Page 4 of 8
//To find Armstrong numbers between 1 to 1000 clrscr(); int i,d,w,sum; printf("\nThe Armstrong numbers between 1 to 1000 are :\n"); for (i=1;i<=1000;i++) { w=i; sum=0; while (w!=0) { d=w%10; sum=sum+pow(d,3); w=w/10; } if(i==sum) printf("%d,\t",i); } getch(); //To Convert Time in Seconds To HH:MM:SS format clrscr(); int i1,h,m,s,tem; printf("\nEnter Time In Seconds: "); scanf("%d",&i1); h = i1 / 3600; tem = i1 % 3600; m = tem / 60; s = tem % 60; printf("\n%d seconds = hh:%d mm:%d ss:%d",i1,h,m,s); getch(); // To Convert lowercase characters to uppercase clrscr(); char ch,z; printf("\nEnter a Lowercase character: "); fflush(stdin); scanf("%c",&ch); z =( ch < 97 ) ? ch : ( ch - 32 ); printf("\nThe Equivalent Uppercase Character of %c is %c",ch,z); getch(); }
Page 5 of 8
//Module To find Armstrong numbers between 1 to 1000 void Armstrong(void) { clrscr(); int i,d,w,sum; printf("\nThe Armstrong numbers between 1 to 1000 are :\n"); for (i=1;i<=1000;i++) { w=i; sum=0; while (w!=0) { d=w%10; sum=sum+pow(d,3); w=w/10; } if(i==sum) printf("%d,\t",i); } getch(); return; }
Page 6 of 8
//Module To Convert Seconds To HH:MM:SS Format void Time(int i1) { clrscr(); int h,m,s,tem; h = i1 / 3600; tem = i1 % 3600; m = tem / 60; s = tem % 60; printf("\n%d seconds = hh:%d mm:%d ss:%d",i1,h,m,s); getch(); return; }
// Module To Convert lowercase characters to uppercase void LowerToUpper(char ch) { clrscr(); char z; z = ( ch < 97 ) ? ch : ( ch - 32 ); printf("\nThe Equivalent Uppercse Character of %c is %c",ch,z); getch(); return; }
This approach also has a drawback that the data in it is not safe. If a data is to be shared by all the functions in this program then it can be declared as a global variable. If some function modifies this data then the modified value would be used by the remaining functions. Hence data is not safe in this approach. Therefore this drawback was further rectified by the object-oriented approach. At this level going in the details of this new approach is beyond the scope of the syllabus.
Page 7 of 8
Test and Debug Compare With Other Programs Properly Documented Efficient
**********
Page 8 of 8
Text Editor
Pre-processor
Compiler
Translator
System Library
01010110 10001010
Object Code Temp.obj
Linker
e) The translator reads the translation unit and writes the resulting object module (preprocessed code converted to machine language) to a file that can be combined with other precompiled units to form a final object code (machine language code). This object code is yet not executable because it has not received the machine codes for library functions (printf( ), scanf( ), getch( ) etc) used in the program. f) The object code along with support routines from standard library and any other separately complied functions are linked together by the linker in to an executable code. g) The executable code can be run using the systems loader (loads the executable program in to systems primary memory). ***********
Page 2 of 2
Algorithms
A sequence of instructions designed in such a way that if the instructions are executed in a specific order, the desired result will be obtained. The instruction of a program must have following characteristics. 1. It should be precise. 2. It should be unambiguous. 3. It should not be repeated infinitely.
Example Problem 1
You are supposed to make an algorithm for calculating the simple interest. The inputs supplied to the program are Principle Amount, Time and Rate of Interest. Algorithm for above Example Statement 1 Step 1 Initialize I = 0.0 (Interest), P = 0.0 (Principle), T = 0 (Time in Months), R = 0.0 (Rate of Interest) Step 2 Prompt the user for three inputs. Step 3 Read in three input values in corresponding variables. Step 4 Calculate I = (P*R*T)/(12*100) Step 5 Print Interest I. Step 6 Stop the Program.
Example Problem 2
Make decision table for a problem in which you are continuously inputting the data of different students and you are supposed to count the total number of girls getting second division (Percentage >= 45% and < 60%). All students have Ten subjects in all. Input data for the system is Sex-Code, Name, Roll No, and Marks in Ten different subjects. The system stops taking data from the user if user enters Sex-Code = Z instead of M or F. Algorithm for above Example Statement 2 Step 1 Initialize a variable Count for calculating total girls with second division. Step 2 Read the data for first / next student. Step 3 If user has not entered Sex-Code = Z then repeat steps up to Step 6(b) else go to Step 7. Step 4 Check the data inputted, Is it for a girl? If it is then do Step 5 else Step2. Step 5 Calculate the percentage of this girl. Step 6 (a) Check for the percentage, it should be between >=45% and < 60%. If it then write details of this particular girl (b) Increment the variable Count. Step 7 Write Count i.e. total girl who secured second division. Step 8 Stop.
Flowcharts
It is pictorial representation of an algorithm. It uses different boxes of different shapes to denote different type of instructions. Actual instruction is written in box in a concise way. Boxes are connected using solid lines having arrow marks. Arrow marks shows flow of operation. Logical errors can easily be sorted out if a flow chart is made properly.
Initially flowchart is made and then it is expressed in some programming language. Page 1 of 8
Yes
No
Decision Box
A
Connector
Flow Lines
Denotes Starting, Ending or Halting point in a program. Denotes function of I/O. Denotes Arithmetic and data Movement steps Denotes flow of operation Depending upon a decision control may branch to one or more alternative points. When flowchart becomes too large to it in a page then connectors are used to show the flow control between pages. A letter or a digit is used in a small circle to indicate the link.
Flowcharting Rules
ANSI (American National Standards Institute) has given some flowcharting rules. Some of these are as under. 1. First chart the main line of logic then incorporate details. 2. Maintain a consistent level of detail for a given flowchart. 3. Do not chart every detail or the flowchart will only be a graphic representation step by step of the program. 4. Words in the flowchart symbols should be common statements and easy to understand. 5. Be consistent in using the names and variables in the flowchart. 6. Go from the left to right and top to bottom in constructing flowcharts. 7. Keep the flowchart as simple as possible. 8. The crossings of flow lines should be avoided. 9. If a new flowcharting page is required, it is recommended that the flowchart be broken at an input or output point and properly labelled connectors should be used.
2. Effective Analysis (Macro Flow Chart for major steps, Micro Flow chart for internal details of each step) 3. Effective Synthesis (In large project handling) 4. Proper Documentation 5. Efficient Coding 6. Systematic Debugging 7. Systematic testing
Limitations of Flowcharts
1. Time Consuming 2. Depth of Flow Chart is not defined. 3. A change in flowchart sometimes requires building them from first step. Flowchart for above Example Problem 1 Start
Read P = ?, R = ?, T = ?
I = (P * R * T)/(12 * 100)
Print I
Stop
Page 3 of 8
Start 2
Count =0
Write Count 1
Read Input Data Yes
Stop Is Sex-Code =Z
No No
Is Sex-Code =F
Yes
Percentage = Total/10
No
Is
Percentage
>= 45
Yes No Is
Percentage
< 60 Yes
Add 1 To Count 1
Page 4 of 8
Decision Tables
Program documentation tool to define clearly and concisely the word statement of a problem in a tabular form. A decision table reveal what decisions or actions the computer is to take as a result of input data. These are useful if computer has to take large number of decisions or if there are a large number of different branches with in a program.
Action Stub
Action Entries
1
N Y Y Y
2
N Y Y N
Rules 3
N Y N ---
4
N N -----
5
Y -------
Actions Taken
Calculate Percentage Write Output Data Add 1 to Count Read Next Student Record Write Count Stop Page 5 of 8
Pseudo-Code
It is also a program documentation tool used for program analysis. Pseudo means Imitation or False. Code means Instruction written in programming language. It is therefore an imitation of actual programming statements. Pseudo-Code uses a structure that resembles computer instructions. It emphasizes the design of program, therefore also called Program Design Language (PDL). It is made up of three basic logic structures (Sequence, Selection (If. Then Else, Case) and Iteration (Do. While, For, Repeat Until). Most Important feature of Pseudo-Code is indentation; its sole purpose is to clarify the logical structure of the program.
2. Selection Structures
If Condition Then Process 1 Else Process 2 End If
3. Iteration Structure
Do While Condition Process 1 Process n End Do Repeat Process 1 Process 2 Until Condition Page 6 of 8
Advantages of Pseudo-Code
1. Converting a Pseudo-Code to programming language is easier than from flowcharts or Decision Tables. 2. As compared to a flowchart, it is easier to modify the Pseudo-Code.
Limitations of Pseudo-Code
1. Graphic representation of the program is not available. 2. For a beginner it is difficult to write a Pseudo-Code. Pseudo-Code for above Example Statement 1 SET I, P, R TO 0.0 SET T TO 0 Prompt the user for three inputs. READ in three input values in their corresponding variables. COMPUTE I as (P*R*T)/(12*100) WRITE I. STOP Pseudo-Code for above Example Statement 2 SET Count TO Zero READ first Student Record DO WHILE Sex-Code is NOT EQUAL TO Z IF Sex-Code = F Then CALCULATE Percentage IF Percentage => 45 THEN IF Percentage < 60 THEN WRITE output data ADD 1 to Count END IF END IF END IF READ next Student Record END DO WRITE Count STOP
Page 7 of 8
The design phase determines how the system will be built. In this phase, the functions of individual programs that will make up the system are determined and the design of the files and/or databases is completed. In the coding phase we write the actual computer programs, compile, execute and test them. Now the life cycle proceeds to the system-testing phase. In this phase all the programs are tested together to ensure that the system works as a whole. The final phase is the maintenance phase, keeps the system working once it has been put in to production.
System Requirement
Analysis
Design
Coding
System Test
Maintenance
************
Page 8 of 8