ALL SIR NOTES HAVE BEEN UPLOADED HERE.
PCE Programming for Problem Solving (Unit-I) 1FY3-06
Subject Teacher: Bhagirath Singh Chauhan # 9829275869
The word computer is derived from the word compute. Compute means to calculate. The computer was originally defined as a superfast calculator. It had the capacity to solve complex arithmetic and scientific problems at very high speed. But nowadays in addition to handling complex arithmetic computations, computers perform many other tasks like accepting, sorting, selecting, moving, comparing various types of information. They also perform arithmetic and logical operations on alphabetic, numeric and other types of information.
The set of instructions given to the computer to perform various operations is called as the computer program. The process of converting the input data into the required output form with the help of the computer program is called as data processing. The computers are therefore also referred to as data processors.
The terms hardware and software are almost always used in connection with the computer.
The Hardware
The term hardware refers to all of the physical devices, or components, that a computer is made of. The hardware is the machinery itself. It is made up of the physical parts or devices of the computer system like the electronic Integrated Circuits (ICs), magnetic storage media and other mechanical devices like input devices, output devices etc. All these various hardware are linked together to form an effective functional unit. The various types of hardware used in the computers, has evolved from vacuum tubes of the first generation to Ultra Large Scale Integrated Circuits of the present generation.
The Software
The computer hardware itself is not capable of doing anything on its own. It has to be given explicit instructions to perform the specific task. The computer program is the one which controls the processing activities of the computer. The computer thus functions according to the instructions written in the program. Software mainly consists of these computer programs, procedures and other documentation used in the operation of a computer system. Software is a collection of programs which utilize and enhance the capability of the hardware.
The computers of today are vastly different in appearance and performance as compared to the computers of earlier days. To fully understand the impact of computers on today’s world and the promises they hold for the future, it is important to understand the evolution of computers.
The First Generation
The first generation computers made use of:
Vacuum tube technology,
Punched cards for data input,
Punched cards and paper tape for output,
Machine Language for writing programs,
Magnetic tapes and drums for external storage.
Charles Babbage a British mathematician at Cambridge University invented the first analytical engine or difference engine. For his contributions in this field Charles Babbage is known as ‘the father of modern digital computer.
The Second Generation
In the second generation computers:
Vacuum tube technology was replaced by transistorized technology,
Size of the computers started reducing,
Assembly language started being used in place of machine language,
Concept of stored program emerged,
High level languages were invented.
The Third Generation
The third generation computers were characterized by:
Use of Integrated circuits,
Phenomenal increase in computation speed,
Substantial reduction in size and power consumption of the machines,
Use of magnetic tapes and drums for external storage,
Design-of Operating systems and new higher level languages,
Commercial production of computers.
The Fourth Generation
The general features of the fourth generation computers were:
Use of Very Large Scale Integration,
Invention of microcomputers,
Introduction of Personal Computers,
Networking,
Fourth Generation Languages.
The Fifth Generation
Defining the fifth generation computers is somewhat difficult because the field is still in its infancy. The computers of tomorrow would be characterized by Artificial Intelligence (AI). Computers could be developed which could think and reason in much the same way as humans. Computers would be able to accept spoken words as input (voice recognition).
Von Neumann architecture was first published by John von Neumann in 1945. Von Neumann architecture is based on the stored-program computer concept, where instruction data and program data are stored in the same memory. His computer architecture design consists of a Control Unit, Arithmetic and Logic Unit (ALU), Memory Unit, Registers and Inputs/Outputs. This novel idea meant that a computer built with this architecture would be much easier to reprogram.
This design is still used in most computers produced today. The Von Neumann architecture is also known as the Princeton architecture. The key elements of von Neumann architecture are:
Data and instructions are both stored as binary digits
Data and instructions are both stored in primary storage
Instructions are fetched from memory one at a time and in order (serially)
The processor decodes and executes an instruction, before cycling around to fetch the next instruction
The cycle continues until no more instructions are available.
The basic parts of computer system are:
Input Unit
The Central Processing Unit
Output Unit
Thus the functions of the input unit are:
Accept information (data) and programs.
Convert the data in a form which the computer can accept.
Provide this converted data to the computer for further processing.
When a computer is performing the tasks that a program tells it to do, we say that the computer is running or executing the program. The central processing unit, or CPU, is the part of a computer that actually runs programs. The CPU is the most important component in a computer because without it, the computer could not run software. This is the brain of any computer system. In the earliest computers, CPUs were huge devices made of electrical and mechanical components such as vacuum tubes and switches. The central processing unit or CPU is made of three parts:
The control unit.
The arithmetic logic unit
The primary storage unit
The Control Unit
The Control Unit controls the operations of the entire computer system. The control unit gets the instructions from the programs stored in primary storage unit interprets these instruction and subsequently directs the other units to execute the instructions. Thus it manages and coordinates the entire computer system.
The Arithmetic Logic Unit
The Arithmetic Logic Unit (ALU) actually executes the instructions and performs all the calculations and decisions. The data is held in the primary storage unit and transferred to the ALU whenever needed.
The Primary Storage Unit
Stores data and programs during actual processing
Stores temporary results of intermediate processing
Stores results of execution temporarily
Output Unit
The output devices give the results of the process and computations to the outside world. The output units accept the results produced by the computer, convert them into a human readable form and supply them to the users.
The devices which are a means of communication between the computer and the outside world are called as peripheral devices.
Those peripheral devices which supply information i.e. data and programs from the outside world to the computer are the input devices. Those peripheral devices which give information from the computer to the user or store them in secondary storage devices, like floppy disks or tapes for future use are called output devices.
INPUT DEVICES
Punch Cards: Data is recorded onto punch cards or punch tapes using standard codes, like the Hollerith code. The pattern of these holes is interpreted by a card reader device and converted into machine readable form.
Keyboard: The keyboard is one of the most commonly used input device. The computer keyboard is similar to a typewriter keyboard. The keyboard has keys made up of letters, numbers, symbols and special function keys.
Mouse: The mouse is a pointing device. The mouse is used to control and manipulate cursor movement on the monitor.
Light Pen: The light pen is a picking device. The light pen is especially useful in Computer Aided Design (CAD) applications.
Joy Stick: The position and speed with which the joystick is moved is converted into digital signals by the use of a lever. The joystick is mainly used in video games applications.
Touch screen: A touch panel is a transparent plate which is fitted over the CRT. Input is registered when a finger or any other object comes in contact with the plate.
Scanner
Scanner is able to directly enter text and images into the computer memory.
The Optical Mark Reader (OMR): This is capable of reading pre specified marks made by pencils or pens with the help of light. These types of scanners are normally used where the data is preprinted for applications.
Optical Character Reader: The Optical Character Reader (OCR) can read alphabets, characters and numbers printed on paper.
Bar code reader: Bar code reader is a device which reads bar coded data. Bar code reader uses a laser beam to read the series of thick and thin lines which represent the bar code number.
Magnetic Ink Character Recognition (MICR): A special type of input device, this mainly finds application in banking areas. The bottom of every cheque there is a unique 9 digit numbers code (usually in numbers only), which is called MICR code. A magnetic ink is used to encode the characters to be read. This ink contains iron oxide particles.
Voice Recognition Systems: The Voice Recognition System consists of a microphone or telephone into which the operator speaks. The speech is converted into electrical signals.
OUTPUT DEVICES
The output device allows the compute to communicate with the outside world by accepting data from the computer and transforming it into user readable form. The various types of output devices are:
Printers
A printer produces the output from the computer on the paper. It is the most commonly used output device. Printers are classified as:
Impact Printer
Non-Impact Printer
Impact Printer
Their functioning is relatively easy
Multiple copies can be produced at the same time with the help of carbon paper.
Impact printers are noisy in operation and are subject to wear and tear of mechanical parts. Types of impact printers are:
Dot Matrix Printers: Dot matrix printer prints each character as a pattern of dots. The printer has a printer head with a matrix of pins (needles).
Daisy Wheel Printer: These printers are also called as letter quality printers. These printers have a daisy wheel with a number of petals. A character is embossed on each wheel. There is a motor which spins the wheel at a fast rate.
Line Printer: Line printers are very fast printers which print at speed of 200-2500 lines per minute. Two types of line printers are: Drum printers and Chain printers.
Non-Impact Printer
They use thermal, chemical, electrostatic and inkjet technologies for printing as against the hammer mechanism of impact printers.
Ink Jet Printer: It prints characters by spraying ink from tiny nozzles onto the paper. A special type of ink which has a high iron content is used.
Laser Printers: These printers are used where a very superior quality output is desired. The biggest advantage of these printers is that no mechanical movement is involved, therefore they are noiseless in operation. However there are comparatively expensive.
Plotter: A plotter is an output device used in applications where printouts of graphs and drawings are required.
Video Display Terminal
CRT: (Cathode Ray Tube) An electron beam is moved across a phosphor coated screen to produce the image.
Flat Panel Display: The most common flat panel display is the Liquid Crystal Display (LCD). This does not have a picture tube. The other type of display is the gas plasma screen.
Storage Unit: A storage unit is that part of the computer system which is used to store the data and instructions to be processed. There are two types of storage:
1. Primary Storage
2. Secondary Storage
Primary memory is also known as internal memory. This is a section of the CPU which holds program instructions, input data and intermediate results. Primary memory is also known as main memory. You can think of main memory as the computer’s work area. This is where the computer stores a program while the program is running, as well as the data that the program is working with.
Secondary storage is a type of memory that can hold data for long periods of time, even when there is no power to the computer. Programs are normally stored in secondary memory and loaded into main memory as needed. Important data, such as word processing documents, payroll data, and inventory records, is saved to secondary storage as well.
Characteristics of Storage units
The storage units have special characteristics which decide the:
Speed of operation of the computer,
Its efficiency,
Cost and
The amount of data which the computer can store.
The storage unit of the computer is graded according to the following characteristics (whether primary or secondary):
Access time: This is the time required to locate and retrieve a particular data from the storage unit. A fast access to data and programs always yields higher efficiency.
Storage Capacity: Storage capacity is the amount of data that can be stored by a storage unit. The smallest unit of data which the computer understands is the bit. A group of 8 bits forms a byte. The storage capacity of a computer system is defined in terms of bytes or words. Storage capacities of primary and secondary units are measured in Kilobytes, megabytes, gigabytes.
Cost: Low cost storage media are always desirable.
Thus, storage units with faster access time, higher storage capacity and low costs are the ones which are considered to be of a superior nature.
Word Length
The word length of the processor in a computer refers to the maximum number of bits it can take as input. "Word size" refers to the number of bits processed by a computer's CPU in one go (these days, typically 32 bits or 64 bits). Data bus size, instruction size, address size are usually multiples of the word size. The length of the important registers in the ALU (Arithmetic and Logic Unit) like “Program counter’, “Accumulator” are defined by the word size. 16 bit word size means the register can store 16 ones and zeros in it, and the biggest number is the decimal equivalent of that binary number. (2 raised to 16).
PCE Programming for Problem Solving (Unit-I) 1FY3-06
Subject Teacher: Bhagirath Singh Chauhan # 9829275869 Page No.: 8
PRIMARY STORAGE
Primary storage is characterized by faster access time, less storage capacity and higher costs as compared to secondary storage units. Primary storage or main memory is that part of the computer system which stores the programs, data and intermediate results during the program execution.
The primary storage is volatile. Whenever the power is turned off the data is lost. Primary storage is also called Random Access Memory (RAM). RAM means it is possible to randomly select and use any storage location for storage and retrieval of data. RAM is also called a read/write memory because data can both be read from and written onto these units. When the power is switched off the data stored in the RAM is lost.
Primary Memory
RAM ROM
DRAM SRAM PROM
(DDR Generation) (Cache) EPROM
EEPROM
Flash
There are two types of RAM
DRAM: DRAM (Dynamic Random-Access Memory) is a type of RAM that is used for the dynamic storage of data in RAM. In DRAM, each cell carries one-bit information. The cell is made up of two parts: a capacitor and a transistor. DRAM chip can hold more data than an SRAM chip of the same size. However, the capacitor needs to be continuously refreshed to retain information because DRAM is volatile.
SRAM: SRAM (Static Random-Access Memory) is a type of RAM used to store static data in the memory. It means to store data in SRAM remains active as long as the computer system has a power supply.
Difference between SRAM and DRAM
S.No. SRAM DRAM
1
Flip-flop are used to store each bit of information in SRAM.
Capacitors are used to store data in DRAM.
2
Capacitors are not used hence no refreshing is required.
To store information for a longer time, contents of the capacitor needs to be refreshed periodically.
3
SRAM is faster as compared to DRAM.
DRAM provides slow access speeds.
4
These are expensive.
These are cheaper.
5
These are used in cache memories.
These are used in main memories.
6
It requires low power consumption.
It requires more power consumption.
7
It has a complex structure.
Its structure is simple.
ROM
ROM is Read Only Memory. In this type of memory the data is permanently stored. The information can only be read and new data cannot be written onto this memory. However the contents of the ROM are not lost even when the power is turned off i.e. this memory is non-volatile.
PROM: PROM is Programmable Read Only Memory. These are ROMs which can be programmed. Once the chip has been programmed, information on the PROM cannot be altered.
EPROM: Another type of memory is the Erasable Programmable Read Only Memory. It is possible to erase the data which has been previously stored on an EPROM and write new data onto the chip.
Flash ROM: Flash memory is a non-volatile storage memory chip that can be programmed in small units called Block or Sector. Flash Memory is an EEPROM form of computer memory, and the data cannot be lost when the power source is turned off.
Cache Memory
This is a very special type of high speed memory. This memory cannot be accessed by the user. The main function of this cache memory is to make the programs and data available to the CPU very fast. Access time of memory is generally very high as compared to the execution time of the GPU. Therefore a cache, which is a very small but fast memory, is used between the CPU and the main memory.
A cache stores those segments of programs and data which are frequently needed. It makes available this data to the CPU at a very fast rate thus increasing the efficiency.
Registers
Registers are used to retain information temporarily. These are special memory units which are not actual parts of the main memory, but allow efficient movement of information between the various units of the computer system. The registers receive information, hold it temporarily and make it available as and when required.
A computer uses a number of registers, where each register performs a specific function. Some of the common registers are:
Memory Address Register (MAR): The function of this register is to hold the address of the current or active memory location.
Memory Buffer Register (MBR): This register holds the contents of the address from which data is read or to which data has been written.
Program Control Register: It holds the address of the next instruction to be executed.
Accumulator Register: It holds the initial data, the intermediate results and the final data of the program under execution.
Instruction Register: This register holds the current instruction being executed.
Input/output Register: The function of this register is to communicate with the Input/output devices.
Difference between RAM and ROM
RAM ROM
It is a temporary memory of the computer.
It is the permanent memory of the computer.
It is a read-write memory. The data can be written and read.
It is a read only memory. The data can only be read.
Stores the files as long as the computer is on and working.
Stores the files even when the power is turned off, such as game cartridge and BIOS programs stored in the memory of a computer, etc.
Data stored in RAM can be retrieved and altered.
We can only read the data stored in ROM. It cannot be altered.
It is faster than ROM as it is a high speed memory.
It is slower than the RAM.
The data stored in RAM is used by the CPU in real-time to run the computer.
The data stored in ROM is used by CPU only when it is transferred to RAM.
It temporarily stores the files and data that the CPU needs to process the current instructions or work.
It stores the BIOS program on the motherboard of a computer, which is needed to bootstrap the computer.
It is costlier than ROM.
It is cheaper than RAM.
Examples: It is used as CPU cache, primary memory in a computer.
Examples: It is used as Firmware by micro-controllers.
Types: DRAM, SRAM
Types: PROM, EPROM, EEPROM etc.
SECONDARY STORAGE DEVICES
Information stored on secondary storage devices can be accessed in following ways: (Access Methods)
Sequential Access
Random Access and
Direct Access
Sequential Access Devices
In sequential access data can be accessed only in the sequence in which it has been stored. The time to access data in this type of method depends on the location of the data. Typical sequential access storage device is the magnetic tape. These types of devices are useful in applications like pay slip printing where the data is to be accessed one after the other.
Punch Paper Tape: Punched paper tapes were the early devices of data storage. Data is coded onto a paper tape as a combination of punched holes across the width of the tape. Each row on the tape represents one character.
Magnetic Tape: A magnetic tape is a ribbon of Mylar which is coated with a thin layer of iron oxide material on one side. A magnetic tape drive is used to read data from the tape or write information to the tape. The tape drive has a read/write head to access or store information respectively.
Random Access Method
In random access method, data from any location of the memory can be accessed randomly. The access to any location is not related with its physical location and is independent of other locations. There is a separate access mechanism for each location. In Random Access Each record or addressable location in memory has a unique address. So any location can be selected at random and directly accessed and addressed. Example: Main Memory and Cache memory.
Direct Access
Direct access method can be seen as combination of sequential access method and random access method. Magnetic hard disks contain many rotating storage tracks. Here each track has its own read or write head and the tracks can be accessed randomly. But access within each track is sequential. In this method, individual blocks or records have a unique address based on physical location. The access time depends on both the memory organization and characteristics of storage technology. The access is semi-random or direct. Example: Magnetic hard disks, Optical Disks etc.
Optical Disk: An optical disk is made up of a rotating disk which is coated with a thin reflective metal. To record data on the optical disk, a laser beam is focused on the surface of the spinning disk. The laser beam is turned on and off at varying rates! Due to this, tiny holes (pits) are burnt into the metal coating along the tracks. When data stored on the optical disk is to be read, a less powerful laser beam is focused on the disk surface.
The drawback of the optical disk is that data once written cannot be erased. Therefore it is a read only storage medium.
Difference between Primary and Secondary Memory
S. No. Primary Memory Secondary Memory 1
It is also known as temporary memory.
.It is also known as a permanent memory. 2
Data can be access directly.
Data cannot be accessed directly by the by the processor or CPU. 3
Stored data can be a volatile or non-volatile memory.
The nature of secondary memory is always non-volatile. 4
It is more costly than secondary memory.
It is less costly than primary memory. 5
It is a faster memory.
It is a slower memory. 6
It has limited storage capacity.
It has a large storage capacity. 7
It required the power to retain the data in primary memory, ROM, Registers, and EPROM.
It does not require power to retain the data in secondary memory. 8
Examples of primary memory are RAM, PROM and cache memory
Examples of secondary memory are CD, DVD, HDD, magnetic, flash disks, pen drive, etc.
PCE Programming for Problem Solving (Unit-I) 1FY3-06
Subject Teacher: Bhagirath Singh Chauhan # 9829275869 Page No.: 12
Accessing data on the disk requires the following:
Seek Time: The read/write head is positioned to the desired track where the data is to be read from or written to. The time taken to move the read/write head to the desired track is called the seek time.
Latency Time: Once the read/write head is at the right track, then the head waits for right sector to come under it (disk is moving at high speed). The time taken for desired sector of the track to come under read/write head is called the latency time.
Data Transfer Rate: Once the read/write head is positioned at the right track and sector, the data has to be written to disk or read from disk. The rate at which data is written to disk or read from disk is called Data Transfer Rate.
Access Time: The sum of seek time, latency time and time for data transfer is the access time of the disk.
How Computers Store Data
A computer’s memory is divided into tiny storage locations known as bytes. One byte is only enough memory to store a letter of the alphabet or a small number. In order to do anything meaningful, a computer has to have lots of bytes. Each byte is divided into eight smaller storage locations known as bits. The term bit stands for binary digit. In most computer systems, bits are tiny electrical components that can hold either a positive or a negative charge. Computer scientists think of a positive charge as a switch in the on position, and a negative charge as a switch in the off position. When a piece of data is stored in a byte, the computer sets the eight bits to an on/off pattern that represents the data.
Storing Characters
Any piece of data that is stored in a computer’s memory must be stored as a binary number. That includes characters, such as letters and punctuation marks. When a character is stored in memory, it is first converted to a numeric code. The numeric code is then stored in memory as a binary number.
Over the years, different coding schemes have been developed to represent characters in computer memory. Historically, the most important of these coding schemes is ASCII, which stands for the American Standard Code for Information Interchange. ASCII is a set of 128 numeric codes that represent the English letters, various punctuation marks, and other characters.
ASCII is limited because it defines codes for only 128 characters. To remedy this, the Unicode character set was developed in the early 1990s. Unicode is an extensive encoding scheme that is compatible with ASCII, but can also represent characters for many of the languages in the world. Today, Unicode is quickly becoming the standard character set used in the computer industry.
Advanced Number Storage
Negative numbers and real numbers (such as 3.14159) cannot be represented using the simple binary numbering technique we discussed. Computers are able to store negative numbers and real numbers in memory, but to do so they use encoding schemes along with the binary numbering system. Negative numbers are encoded using a technique known as two’s complement, and real numbers are encoded in floating-point notation.