[go: up one dir, main page]

0% found this document useful (0 votes)
52 views38 pages

Unit 1 Theory

Uploaded by

keshavbansal039
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views38 pages

Unit 1 Theory

Uploaded by

keshavbansal039
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Introduction to Computers:

Computer is an electronic machine that performs tasks or computations according to a set of instructions
called programs.

1. A computer, in general, is capable of

2. Receiving the data and instructions in various forms,

3. Storing the data and instructions in its memory,

4. Retrieving the data already stored on secondary storage,

5. Performing arithmetic and logical operations, according to the specified instructions, with very
high speed and greater accuracy,

6. Producing the results in many forms, and Communicating with other computers.

A computer is a combination of hardware and software. Hardware represents physical


components of a computer like motherboard, memory devices, monitor, keyboard etc., while
software represents a set of programs or instructions. Both hardware and software together make
the computer system function. Every task given to a computer follows an Input-process-Output
Cycle (IPO cycle). It needs certain input, processes that input and produces the desired output.
The input unit takes the input, the central processing unit does the processing of data and the
output unit produces the output. The memory unit holds the data and instructions during the
processing.

Let us have a look at the functional components of a computer one-by-one.

Input Unit

The input unit consists of various input devices that can be connected to a computer, such as
keyboard, mouse, light pen, microphone, etc. The standard input device is keyboard, which will
come with every new computer. At any time, more than one input device can be connected to a
computer. The purpose of the input unit is to receive information from the outside world, convert
it into binary form, and then transfer it to the main memory (RAM). It may consist of entering
data to be processed by some program, recording of speech, capturing of a scene or photograph,
or selecting some Objects on the display.

Output Unit

The output unit consists of various output devices that can be connected to a computer, such as
visual display unit (VDU) or simply known as monitor, printers, plotters, audio systems etc, the
standard output device is a monitor, which will come with every new computer. At any time, like
input devices, more than one Output device can be connected to a computer.
The purpose of the output unit is to receive the information, in binary form, from the main
memory unit, convert it into human understandable form, and then output it. It may consist Of
displaying, printing, or plotting the results Of some computer program or even playing some
music or movie.

Memory Unit

The memory unit acts as the warehouse of a computer, where executing programs, input data,
intermediate and final results of computations are stored. Information entered into a computer
is first stored in the memory unit. Similarly, the data or results to be output are taken from the
memory unit. The memory unit represents a volatile memory (RAM), which means that the
stored information will be lost when power is switched off.

Fig: Memory Chips

Arithmetic and Logic Unit

The arithmetic and logic unit (ALU), as its name implies, performs arithmetic and logical
operations. Arithmetic operations include addition, subtraction, multiplication, and division.
Logical operations are used to compare two data items, and include operations such as less than
(<), less than or equal to (<=), greater than (>), greater than or equal to (>=), equal to (=), and not
equal to.

Control Unit

The control unit co-ordinates and controls all the other parts of computer system. Under the
direction of a program, the control unit performs four basic operations:

• Fetch - getting the next program instruction from the computer's memory.

• Decode - figuring out what the program is telling the computer to do?

• Execute - performing the requested action, such as adding two numbers or deciding
whether one of them is larger.

• Write-Back - writing the results back to memory.

This four-step process is called a machine cycle, or a processing cycle, and consists Of two
phases: the instruction cycle (fetch and decode) and the execution cycle (execute and write-
back).

Secondary Storage unit

The secondary storage unit provides long-term storage for important data for future use. The data
is transferred from the memory unit (RAM) to the secondary storage unit. In order to process the
data residing in secondary storage, it is transferred to the memory. Please remember that data
stored in secondary storage cannot be processed directly in secondary storage itself. The data can
only be processed if it is in the memory.
Formally, a microprocessor, commonly referred as processor, is a general-purpose
programmable device, which can receive information in binary form, process it and transmit the
results, it can be programmed to solve a wide variety of problems using instructions that it
understands. Set of all the instructions that a processor can understand is known as the
instruction set.

Hardware

Hardware refers to the parts of a computer that you can see and touch, including the case and
everything inside it. Various components of the computer system that constitutes its hardware
include system unit (which houses major hardware components such as motherboard, power
supply, hard disk, etc.), input/ output devices as well as storage devices.

Software

Software, in its most general sense, is a set of instructions or programs that tell the hardware
what to do. Software can be difficult to describe because it is virtual and not physical like
computer hardware. Instead, software consists of lines of code (instructions) written by computer
programmers that have been compiled into a computer program. Software programs are stored as
binary data that is copied to a computer's hard drive, when it is installed. Since software is virtual
and does not take up any physical space, it is much easier (and often cheaper) to upgrade than
computer hardware.

The most important example of software is an operating system (OS) that manages the resources
of a computer system, and provides an interface using which the user can interact with computer
to perform various tasks.

It is important to remember that hardware and software are integral parts of computer system
hardware is of no use without software and software cannot be used without hardware. It is the
software that drives hardware, i.e., it is the software that gives hardware its capability. Software
can be broadly categorized as:

• System software: It is a type of software that is designed to run a compute/s hardware


and application programs. If we think of a computer system as a layered model, the
system software is the Interface between the hardware and user applications. The
operating system and language translators (assembler, compiler and interpreter), linker
and loader are examples of system software.

• Application software: It is a type of software that is designed for a specific purpose and
is used by end users. Word processor, database software, spreadsheet software,
entertainment software, reservation software, inventory management software, etc., are
examples of application software.

• Utility software: It is a type of software that is designed to help analyze, configure.


optimize or maintain a computer. It is used to support the computer infrastructure.
Antivirus software. compression tools, disk management tools, etc., are examples of
utility software.

Operating System

The most important program on any computer is the Operating System or simply OS. It is a large
program made up of many smaller programs. It acts as a resource manager of the computer
system and provides an interface between the users and the hardware.

The resources of a computer system include processor, memories and I/O devices, users, etc. As
a manager it coordinates the activities of various resources so as to provide the users with the
required information.
Commonly used Operating Systems for PCs/Laptops include:

✓ Unix
✓ Linux
✓ Windows
✓ Solans
✓ BOSS (Bharat Operating System Solutions)
Computer Hardware: Printers, Keyboard and Mouse, Storage Devices

Input devices are electromechanical devices that are used to provide data to a computer for
storing and further processing, if necessary. They act as an interface between the computer and
the user. The basic task of an input device is to take the input from the user, translate it into the
machinereadable form and then present it to the processing unit of the computer for execution. In
effect, the input devices provide a means of communication between the computer and the outer
world. The input may be in different forms, such as numeric data, text commands, graphics,
video and audio.

We can provide the input to a computer in two ways, either manually through devices such as
keyboard and mouse, or directly from documents using devices such as scanners. Depending
upon the type or method of input, the input device may belong to one of the following
categories:
✓ Keyboard
✓ Pointing devices such as Mouse
✓ Scanning devices
✓ Optical recognition devices
✓ Digital camera

KEYBOARD
Keyboard is the most commonly used input device. We can use a keyboard to type data and text
and execute commands. It allows the user to input alphabets, numbers, and other characters. It
provides keys for additional functions. It detects the key being pressed and generates the
corresponding ASCII code which can be recognised by the computer. A standard computer
keyboard typically has 104 keys though this can vary slightly depending on the exact keyboard
layout and any additional function keys or special keys it may include. A standard keyboard, as
shown below consists of the following groups of keys:
Alphanumeric keys: The alphanumeric keys include the number keys (0-9), alphabet keys (A-
Z) and other characters (!, @, #, $, etc.). These keys are arranged in the same style as in the
normal typewriters, popularly known as QWERTY layout.

Function keys (F1 – F12, PrtScr Scroll Lock): The function keys are arranged in a row on the
top of the keyboard. These keys help perform specific tasks, such as searching a file or refreshing
a web page.

Navigation keys: These include the arrow keys (up, down, left, right), Home, End, Page Up,
Page Down, Insert, and Delete keys. They are used for navigation within documents or text.

Modifier keys: These include Shift, Ctrl (Control), Alt (Alternate), and sometimes the Windows
key (on Windows keyboards) or Command key (on Mac keyboards). These keys modify the
function of other keys when pressed in combination.

Numeric keypad: The numeric keypad is located on the right side of the keyboard. This looks
like a calculator’s keypad with its 10 digits and mathematical operators.

Special purpose keys: The special purpose keys help perform a certain kind of operation, like
exiting a program or deleting some characters in a document. The various special purpose keys
in a keyboard are Escape, Insert, Delete, Print Screen, Pause, Tab, Spacebar, etc.

Keyboards are attached to the computer system with the help of a cable. Each key of the
keyboard, when pressed, sends a different signal to the processor. However, today wireless
keyboards are also available that work with the help of batteries. We can also classify the
keyboards on the basis of additional keys present in them. For example, multimedia keyboard
and gaming keyboard are the keyboards, which are classified on the basis of the additional keys
present in them.

MOUSE
Mouse is a small hand-held pointing device that basically controls the two-dimensional
movement of the cursor on the displayed screen. It is an important part of the Graphical User
Interface (GUI) based Operating Systems (OS) as it helps in selecting a portion of the screen and
copying and pasting the text. The mouse, on moving, also moves the pointer appearing on the
display device. The most commonly used types of mouse are as follows:

• Mechanical mouse: A mechanical mouse consists of three buttons: left button, right
button and scroll button. Inside the plastic coating of the mouse, there is a ball, which is
rolled over a flat surface corresponding to which the cursor moves on the display screen.
The left button on the mouse is the most frequently used button as it helps in selecting the
icons, folders and text on the display screen. The right button on the mouse helps in
displaying the short cut menu, whereas the scroll button helps in moving the cursor up
and down on the screen by scrolling it. Figure 4.2 shows the upper and the lower portion
of the mechanical mouse.
• Optical mouse: An optical mouse is a pointing input device in which the reflected light
determines the movement of the cursor on the displayed screen. The upper portion of the
optical mouse is similar to that of the mechanical mouse. The lower portion of the optical
mouse consists of a ball having Light Emitting Diodes (LEDs), an optical sensor and a
Digital Signal Processor (DSP). Below image shows the lower portion of the optical
mouse.

Ball mouse works on the principle of the movement of the ball, whereas optical mouse uses LED
and laser mouse uses laser beams for sensing the movement. Laser mouse has more precise
movement when compared to other types of mouse. Wired mouse uses serial, PS/2, and USB
ports, to communicate, whereas a wireless mouse communicates with the computer via radio
waves.

PRINTERS
Output devices are essential part of a computer system. They receive the processed data
(information) from the CPU and present it to the user in a desired form. They act as an interface
between the computer and the user. The main task of an output device is to convert the
machinereadable information into human-readable form which may be in the form of text,
graphics, audio or video. Depending upon the form of output required, the output device
may belong to one of the following categories:

• Display monitors
• Printers
• Plotters
• Voice output systems
• Projectors

While the printers and plotters provide the physical form of output known as hard copy, the
display monitors, voice output systems and projectors provide temporary output known as soft
copy. Unlike hard copy, soft copy is not a permanent form of output.

Printers are the most widely used output devices in real life applications. A printer is a computer
hardware that generates the hard copy of the information processed by a computer system. The
hard copy produced by the printer can be in the form of a paper or any other physical printing
medium. To produce a hard copy, first the printer is connected to a computer with the help of a
cable and then the print command is given by the user through the user interface of the computer.
The output on the hard copy produced by a printer can be preserved for a long time as compared
to the output displayed on the display monitors. Based on the features, such as colour, resolution,
memory and speed possessed by the printers, they are classified into many types. Some printers
have a very high printing speed, whereas others have a slow printing speed. Moreover, all
computers cannot produce multicoloured printouts. Some of them produce single colour
printouts only.

On the basis of their working principles printers can be classified into two major categories:

• Impact,
• Non-impact printers

Impact Printers:
Impact printers are those printers in which there exists a mechanical contact between print head
and paper. Print head is the part of the printer that resembles a hammer and is responsible for
transferring the ink to the paper in the form of required characters. Impact printer contains an
individual print head for each character. The print head of a character strikes the ink ribbon, and
the ink ribbon in turn strikes the paper, leaving an impression of that particular character on the
paper. Some of the most popular impact printers are as follows:

✓ Dot matrix printers


✓ Daisy wheel printers
✓ Drum printers
Dot Matrix Printer:

A dot matrix printer is an impact printer in which a character is printed on the paper by the back
and forth movement of a print head against the ribbon drenched in ink. In dot matrix printer, the
characters are formed out of a matrix containing dots as shown in the below Fig. 5.4. Each dot is
produced with the help of a metal pin brought forward by a small electromagnet. A small plate
guides the pins to the ribbon and the pins strike the ribbon to form an impression of a dot on the
paper.

Dot matrix printer is capable of printing a complete line of characters at a time. It is very durable
as it does not wear out quickly; however, the circular channels on the guide plate get damaged
due to frequent striking of pins. This damage in the shape of circular channels makes the guide
plate less accurate because of which the printed characters become hazy.

The dot matrix printers are also capable of producing carbon copies. They ensure reliable
printing and are best suitable for the fields where the content of the printed data is more
important than the quality of printing. There is no need of providing individual single sheets to
these printers again and again as they take continuous papers.

Below Figure 5.5 shows a dot matrix printer.


Dot matrix printers are cheap to use as the cost of printing per page is very less. If the printer has
not been in use for a long time, even then, the ink ribbon remains preserved for the future use
and does not dry quickly. Besides advantages, these printers have some disadvantages. They
produce a lot of noise while printing and have low printing speed as well as printing quality.
These printers support limited colours and need a lot of maintenance as the damage to the pins
may cause printing of improper text. Although dot matrix printers are not commonly used at
homes, they are still widely used in business and industries as they are cheap and can produce
carbon copies.

Daisy wheel printers


A daisy wheel printer is an impact printer that produces printouts of good quality characters. It
contains a metal or a plastic disk on which the characters reside on the outer edge of the petals.
Figure 5.6 shows a daisy wheel printer.

The disk in the daisy wheel printer is rotated until the petal, containing the character to be
printed, faces the paper. Once the required character is positioned towards the paper, the disk is
struck by a hammer, which acts as print head. The striking of hammer on the disk forces the disk
to hit the ink-soaked ribbon and the ribbon leaves an impression of the character on the paper.

Below Figure 5.7 shows the disk of a daisy wheel printer.

The only advantage of daisy wheel printers is that they allow the printing of characters in
different fonts. The daisy wheel printers are capable of printing text only and not graphics. They
are very noisy as well as very slow and can print approximately 10 to 75 characters per second.

Drum Printer
Drum printers are the impact printers in which the characters are engraved on a cylindrical drum,
which is rotated around print head hammer. The paper and the ink ribbon lie between the
hammer and the drum. When a character is to be printed, the hammer strikes the paper and forces
it to hit the ribbon. The ribbon in turn hits the character on the drum and the impression of the
character is formed on the paper. The advantages of the drum printers are low cost, higher speed
as compared to other impact printers; and it requires no feeding of paper again and again. The
disadvantages of these printers include poor quality of printing and large noise production.

Figure 5.8 shows the internal components of a drum printer.


NON-IMPACT PRINTERS
Non-impact printers are the printers in which there exists no mechanical contact between the
print head and paper. These printers spray ink on the paper with the help of a nozzle. Non-impact
printers do not produce much noise and are fast as compared to impact printers. The reason for
the production of less noise is the absence of mechanical moving parts in the printer.

The most popular non-impact printers are:


1. Ink-jet printers
2. Laser printers

Ink-jet Printer:
Ink-jet printers are the non-impact printers that produce an image by spraying small droplets of
ink on the paper with the help of a nozzle. A magnetised plate guides the sprayed ink to form the
particular shape of a character or a symbol on the paper. The ink-jet printers offer a resolution of
300 dots per inch and produce high quality printouts, such as graphics and images. They are
cheaper and portable as compared to the other non-impact printers. The slow speed and the
requirement of a special ink, which is suitable for the inexpensive papers, are the two drawbacks
of the inkjet printers. The printouts taken from an ink-jet printer also require some time to dry.

Figure 5.9 shows an ink-jet printer.


Laser Printers:
Laser printers are the non-impact printers that produce images with the help of a laser beam. It
works on the same technology as the one used in a copier machine. The laser beam electrically
charges the drum coated with selenium and then transfers the entire document, which is to be
printed to it. The charged drum is then allowed to roll into the dry powder ink known as toner.
The toner sticks to the charged images on the drum and is then transferred to the paper with the
help of heat and pressure.

The electrical charges and the remaining toner automatically get removed from the drum after
the printing of the document. Laser printers are capable of printing both black and coloured text
but as colour laser printers are very costly so generally single colour laser printers are used.
Laser printers have a high speed and resolution. They produce high quality printing in various
fonts and that too, without producing any noise.

Figure 5.10 shows a laser printer.


Special Purpose Printers: Although most applications use ink-jet or laser printers, there are
some high quality printers that are primarily used by publishers and print shops to create high
quality colour images. These printers include:

✓ Photo printers
✓ Thermal-wax printers
✓ Dye-sublimation printers

These printers are very slow and expensive.


Storage Devices

A computer system needs memory to store the data and instructions for processing. Whenever
we talk about the ‘memory’ of a computer system, we usually talk about the main or primary
memory (Example RAM). The secondary memory (also called storage device, such as SSD,
Hard Disk) is used to store data, instructions and results permanently for future use.

A computer system uses binary numbers to store and process data. The binary digits 0 and 1,
which are the basic units of memory, are called bits. Further, these bits are grouped together
to form words. A 4-bit word is called a Nibble. Examples of nibble are 1001, 1010, 0010, etc. A
two nibble word, i.e., 8-bit word is called a byte, for example, 01000110, 01111100, 10000001,
etc.

Computers are used not only for processing of data for immediate use, but also for storing of
large volume of data for future use. In order to meet these two specific requirements, computers
use two types of storage locations –
One for storing the data that are being currently handled by the CPU, and
The other is for storing the results and the data for future use.

The storage location where the data are held temporarily is referred to as the primary memory
while the storage location where the programs and data are stored permanently for future use is
referred to as the secondary memory.

The primary memory is generally known as “memory” and the secondary memory as
“storage”.

The data and instructions stored in the primary memory can be directly accessed by the CPU
using the data and address buses. However, the information stored in the secondary memory is
not directly accessible to CPU. Firstly, the information has to be transferred to the primary
memory using I/O channels and then, to the CPU.
Computers also use a third type of storage location known as Cache Memory. This memory is
placed either inside the CPU or near the CPU (connected through special fast bus). Figure 3.1
illustrates all the three categories of computer memory and their relative speed, storage capacity
and cost.

Or Cache Memory

Primary memory (also known as main memory) includes two types, namely, Random
Access Memory (RAM) and Read Only Memory (ROM). The data stored in RAM are lost
when the power is switched off and therefore, it is known as volatile memory. However, the data
stored in ROM stay permanently even after the power is switched off and therefore ROM is a
non-volatile memory.

Secondary memory (also known as auxiliary memory) includes primarily magnetic disks and
magnetic tapes. These storage devices have much larger storage capacity than the primary
memory. Information stored on such devices remains permanent (until we remove it).

Internal process memory usually includes cache memory and registers both of which store data
temporarily and are accessible directly by the CPU. This memory is placed inside or near the
CPU for the fast access of data.
We can think of memory as a “bunch” of bytes or cells into which we can place data. Each cell,
known as a data item, is assigned a unique number known as address (which is like the index in
an array). The CPU can identify each cell by its address as shown in Fig. 3.2.

RANDOM ACCESS MEMORY:


Random Access Memory (RAM) is a volatile memory and loses all its data when the power is
switched off. It is the main memory of the computer system that stores the data temporarily and
allows the data to be accessed in any order. As compared to the secondary storage, the data can
be accessed at a faster speed in RAM because it is the internal memory of the computer. Figure
3.3 shows RAM with ICs.

RAM is made up of different ICs, which are mounted on a printed circuit board. RAM stores the
application programs and the data on which the user is currently working so that the processor
can easily access the required application program and data in a less amount of time. RAM is
also known as read/write memory because it can perform both read as well as write operations.
The speed of RAM is faster than the other memory devices, such as hard disk, floppy disk, etc.
The programs, which are being currently executed by the computer system, are stored in RAM.
RAM is volatile and, therefore, the programs and the data stored in the RAM get lost when the
power supply is switched off. The storage capacity of RAM is usually less than the secondary
storage devices. RAM can be categorized into two main types, namely, Static RAM (SRAM) and
Dynamic RAM (DRAM), which can be further divided into various types for storing data. Figure
3.4 shows the hierarchy of RAM memory.

Static RAM (SRAM):


Static RAM (SRAM) is a type of RAM in which data is stored till the power of the computer
system is switched on. SRAM uses a number of transistors to store a single bit of digital
information. Figure 3.5 shows the organization of data in a cell of SRAM. In the figure, b1 and
b2 represent the two bit lines and Wx represent the word line. In the memory, the data is stored in
the form of a twodimensional array, containing rows and columns. The row can be accessed
globally by a line (known as word line) and the column can be accessed individually by a line
(known as bit line). Depending on the function performed by SRAM, it can be divided into the
following three types:

1. Asynchronous SRAM (ASRAM): ASRAM performs its operations without the use of
system clock. It makes use of three signals for working, namely, Chip Select (CS), Write
Enable (WE) and Output Enable (OE). The CS signal enables the processor to select the
memory for performing read and write operations. If the value of CS signal equals zero,
then the memory is enabled to perform the operations. On the other hand, if the value of
the CS signal equals one, then the memory is disabled and operations—such as reading
and writing in ASRAM—cannot be performed. The signal WE makes the decisions
related to data, i.e., whether it should be read from or write to the memory. If the value of
WE signal equals zero, then no data can be read from or written to the memory. The
signal OE is an active low signal that enables the processor to give the output for the data.
If the value of OE signal equals zero, then only it will output the data.
2. Burst SRAM (BSRAM): BSRAM works in association with the system clock and is also
known as synchronous SRAM. BSRAM is most commonly used with high-speed
applications because the read and write cycles are synchronised with the clock cycles of
the processor. The access-waiting time gets reduced after the read and write cycles are
synchronised with the clock cycles. The speed and the cost of BSRAM increases or
decreases simultaneously.
3. Pipeline Burst SRAM (PBSRAM): PBSRAM makes use of the pipeline technology in
which a large amount of data is broken up in the form of different packets containing
data. These packets are arranged in a sequential manner in the pipeline and are sent to the
memory simultaneously. PBSRAM can handle a large amount of data at a very high
speed. It is the fastest type of SRAM because it can operate at bus rates as high as 66
MHz.

Dynamic RAM:
DRAM is the RAM in which data is stored in a storage cell, consisting of a transistor and a
capacitor. The capacitor can hold an electrical charge, which represents a binary value (0 or 1). A
charged capacitor represents a binary 1, while a discharged (or uncharged) capacitor represents a
binary 0.

The charge in the capacitor tends to leak away over time, causing the stored data to be lost if not
refreshed periodically.

Unlike SRAM, the DRAM needs to be continuously refreshed with power supply because the
capacitor has the tendency to get discharged. DRAM retains the data for a very short span of
time, even after the power supply is switched off. Figure 3.6 shows the organisation of data in a
cell of DRAM.

In Fig. 3.6, b1 represents a bit line and Wx represents a word line.

The DRAM can be divided into the following types:


1. Synchronous DRAM (SDRAM): SDRAM performs its operations in the synchronous
mode, i.e., in association with the clock cycle of the processor bus. It consists of two
internal memory banks such that if the address lines are sent from the fi rst bank, then the
address can be read by using the second bank. The internal banks are used because the
row and the column address lines need to be charged for reading an address. SDRAM
provides a synchronous interface in which it waits for a clock signal before responding to
a control input. Generally, it is used with the processors for storing the data in a
continuous manner. The continuous form of data storage helps in processing more
number of instructions per unit time that increases the speed of data access.
2. Rambus DRAM (RDRAM): RDRAM designed by Rambus Inc. works at a faster speed,
as compared to SDRRAM. It is compact in size and uses 16-bit address bus. It provides
the facility to transfer data at a maximum speed of 800 MHz. It contains multiple address
and data lines that help in increasing the speed of data access. These multiple address and
data lines help in performing different read and write operations simultaneously. It is not
popular among the users because of its high cost and low compatibility.
3. Extended Data Out DRAM (EDODRAM): EDODRAM can access more than one bit
of data at one time which helps in achieving faster data access rates. It provides the
facility to perform various operations at one time such as reading, writing, etc. It starts
accepting the next bit of data immediately after getting the first bit of data for performing
read or write operation.
4. Fast Page Mode DRAM (FPMDRAM): FPMDRAM makes use of paging in which
read or write operation is performed by selecting the address of the data from the rows
and the columns of a matrix. Once the data is read, the address of the particular column is
incremented, so that the user can read the next part of the data. The use of paging concept
in FPDRAM does not allow to work with the buses at the memory speed more than 66
MHz. As a result, a lot of time is consumed in reading and writing the data from the
matrix

READ ONLY MEMORY (ROM)


ROM is the memory that stores the data permanently, i.e., it can retain the data even when the
power of the computer system is switched off. The data can be easily read from this type of
memory but cannot be changed. ROM is most commonly used in devices such as calculators,
laser printers, etc.

ROM does not allow the random access of data rather it allows sequential access of data. It is
less expensive as compared to RAM and other storage devices, such as magnetic disk, etc. ROM
is divided into four types, which are as follows:

✓ Programmable ROM (PROM)


✓ Erasable PROM (EPROM)
✓ Electrically Erasable PROM (EEPROM)
✓ Flash ROM

1. Programmable ROM Programmable ROM (PROM) is a memory chip on which the


write operation of data can be performed only once. The data is stored on this chip
permanently, i.e., once a program is written on the PROM, it cannot be erased or
destroyed. To write the data on the PROM chip, a device known as PROM programmer
or PROM burner is required. The method of writing data on the chip is known as burning
the PROM. PROM is reliable and stores the data permanently without making any
change in it. It is mostly used in video games and electronic dictionaries.

2. Erasable PROM Erasable PROM (EPROM) is a type of ROM in which data can be
erased or destroyed using Ultraviolet Light (UL). Erasable ROM provides the facility of
changing the contents of the data, i.e., it can be reprogrammed. It contains the fl oating
gate transistors, which have the capability to hold an electric charge, even when the
power of the computer system is switched off. It also facilitates the storage of data for a
longer period of time.

3. Electrically Erasable PROM Electrically Erasable PROM (EEPROM) is a type of


ROM in which data can be erased or destroyed by exposing it to an electric charge. It has
the ability to retain the data stored in it, even if the power of the computer system is
switched off. It stores the data permanently but allows us to make changes in the data by
erasing it with the help of electric charges. In this type of memory, the data can be written
or erased only one byte at a time because of which it works very slowly.

4. Flash ROM: Flash ROM is a type of EEPROM that stores the information using
floating-gate transistors, which can store electric charge for a longer period of time as
compared to the normal transistors. This memory is mainly used in the memory cards of
mobile phones, digital cameras and ipods for storing data. The data stored in fl ash ROM
memory can be easily transferred using transmission mediums such as data cable,
bluetooth and infrared technology. For example, we can transfer the data stored in fl ash
ROM memory of mobile phone to the memory of a computer using data cable. We can
easily erase the data stored in fl ash ROM memory and reprogram this type of memory.
Flash ROM has faster speed of reading data, as compared to any other type of ROM. It
uses continuous memory cells for storing data.

5. The memory cells of fl ash ROM are made up of floating-gate transistors. A Single-level
Cell (SLC) can store only one bit of data, whereas Multi-level Cell (MLC) provides the
facility of storing more than one byte. The two types of flash ROM memory are as
follows:

NAND flash: In NAND fl ash or NAND gate flash memory, each cell behaves like a
Metal Oxide Semiconductor Field Effect Transistor (MOSFET), which has two gates for
amplifying an electric signal.

NOR flash: NOR gate flash or NOR flash memory provides the facility to write data or
information, with the help of tunnel injection. It can be defined as the process of inserting
electrons to an electric conductor using a layer of electric insulator. It also provides the
facility to erase the instructions using tunnel release.

Table: RAM vs ROM

STORAGE SYSTEM:
Storage systems are the devices—such as hard disks, optical disks and magnetic disks—used for
data storage. The main objective of the storage system is to permanently store data—which can
be of any type, such as images, videos and text—for future use. The storage systems provide the
facility to use the data at any time. Different storage systems have varying storage capacities. For
example, the normal storage capacity of Compact Disk (CD) is 700 Megabytes (MB). The
storage systems can be classified as shown in Fig. 3.7.
Magnetic Disks:
Magnetic disk is a flat disk that is covered with magnetic coating for holding information. It is a
type of secondary memory device that is used to store different programs and files. It is used to
store digital information in the form of small and magnetised needles. These needles help in
encoding a single bit of information by getting polarized in one direction represented by 1, and
opposite direction represented by 0.

Magnetic disk can store a large amount of data and is less expensive as compared to RAM. As it
takes more time to read the information from a specified location, its data access rate is slow
compared to the main memory. It allows the random access of data and provides the facility of
erasing and re-recording the data as many times as required. Figure 3.9 shows a magnetic disk
with sectors and tracks.
Tracks are the concentric circles on the magnetic disk, having a common centre and containing a
block of recorded data. The thickness between two tracks affects the storage capacity of a
magnetic disk. If the thickness between the two tracks is less, then the magnetic disk can store a
large amount of data.

On the other hand, if the thickness between the two tracks is more then less amount of data can
be stored in the magnetic disk. The data is stored in a magnetic disk in the form of tiny dots on
the tracks, which are known as spots. The size of these spots should be small, in order to hold
large amount of data and information.
The broken-up units of tracks are known as sectors. The data stored on the sectors is in the form
of very small unit, which can be read or written. The size of a sector in a magnetic disk is 512
bytes. There are two popular types of magnetic disks:
✓ Hard disks
✓ Floppy disk

A hard disk, also known as a fixed disk, can hold a large volume of data and is used with large
computers. A floppy disk, a removable disk with relatively less storage capacity, is commonly
used with personal computers.

A set of numerous disks are stacked one above the other with a cylindrical spindle in-between
(Fig. 1.12). The data is recorded electromagnetically in the form of concentric circles called
tracks. The tracks are further divided into blocks as shown in the figure. In the hard disk drive,
there is a Read/Write head mounted on the arm placed next to the stacked disks. This head
moves horizontally and vertically to read or write data on the disks.

Major advantages of magnetic disks are:


✓ High storage capacity
✓ Easy, direct access to data
✓ Easily moveable from one place to another
✓ Better data transfer rate as compared to magnetic tapes
✓ Low cost compared to RAM
✓ Less prone to corruption of data as compared to tapes

The disadvantages of magnetic disks are:


✓ More expensive as compared to magnetic tapes.
✓ When used on-line, they are more susceptible to data corruption and data theft.
✓ Not ideally suitable, when the data files are to be read sequentially.
✓ Require dust-free environment

Magnetic Tape
Magnetic tapes are the plastic tapes with magnetic coating that are used for storing the data, such
as text, audio or video. Magnetic tapes are similar to the normal recording tapes, which are used
for audio and video recording. The data stored on the magnetic tapes can be accessed using the
sequential access method. The magnetic tape could be compared with a cassette in which, in
order to listen to the third song, we have to go pass the first two songs first. Similarly, in the
magnetic tape, we cannot directly jump over to the third song. Therefore, magnetic tapes are
used in the cases where a large amount of data needs to be stored, but performance is not a major
issue. Magnetic tapes are best suited as the backup devices for storing a large amount of the data.

Major advantages of magnetic tapes are:


✓ Low cost
✓ Large storage capacity
✓ Easily transportable
✓ Easy to handle and store

Major disadvantages of using magnetic tapes are:


✓ Low data transmission speed due to sequential access.
✓ Not suitable for random access.
✓ Require protected environment for storage.
✓ Updating, such as insertion or deletion is difficult.
✓ Fast wear-out

Introduction to programming language

A programming language is a language used to write instructions that a computer can execute to
perform various tasks.

Just as hardware is classified into generations based on technology, computer languages also
have a generation classification based on the level of interaction with the machine.

First generation language (1GL)—machine language


Second generation language (2GL)—assembly language
Third generation language (3GL)—high-level language
Machine Language (low level language):

Low-Level language is the only language which can be understood by the computer. Low-level
language is also known as Machine Language. The machine language contains only two symbols
1 & 0. All the instructions of machine language are written in the form of binary numbers 1's &
0's. A computer can directly understand the machine language.

Following are the limitations of using machine language in writing programs:

1. Difficult to use and error prone: It is difficult to understand and develop a program
using machine language. Because it is hard to understand and remember the various
combinations of 1’s and 0’s representing data and instructions.

2. Machine independent: As the internal design of the computer is different across types,
(which in turn is determined by the actual design or construction of the ALU, CU, and
size of the word of the memory unit), the machine language also varies from one type of
computer to another. hence, it is important to note that after becoming proficient in the
machine code of a particular computer, the programmer may be required to learn a new
machine code and would have to write all the existing programs again in case the
computer system is changed.

Assembly Language (middle level language)

Middle-level language is a computer language in which the instructions are created using
symbols such as letters, digits and special characters. Assembly language is an example of
middle-level language. In assembly language, we use predefined words called mnemonics (such
as ADD, SUB, MUL, LDA, STA, JC, JNC, JZ, etc.). Binary code instructions in low-level
language are replaced with mnemonics and operands in middle-level language. But the computer
cannot understand mnemonics, so we use a translator called Assembler to translate mnemonics
into machine language.
For example, a typical statement in assembler to command the processor to move the
hexadecimal number 0x80 into processor register r2 might be:

MOV R2, 080H

Assembler is a translator which takes assembly code as input and produces machine code as
output. That means, the computer cannot understand middle-level language, so it needs to be
translated into a low-level language to make it understandable by the computer. Assembler is
used to translate middle-level language into low-level language.

An assembly language is a low-level programming language for microprocessors (CPU) and


other programmable devices.

Assembly language has several disadvantages:

1. It is machine dependent. Assembly language is specific to the internal architecture of a


particular model of a processor and the programmer should know all about the internal
architecture of the processor. A program written in assembly language for one processor
will not work on a different processor if it is architecturally different.

2. Though mnemonic codes are easier to be remembered than binary codes, programming
with assembly language is still difficult and time-consuming.

High Level Language

High-level language is a computer language which can be understood by the users. The high-
level language is very similar to human languages and has a set of grammar rules that are used to
make instructions more easily. Every high-level language has a set of predefined words known
as Keywords and a set of rules known as Syntax to create instructions. The high-level language
is easier to understand for the users but the computer can not understand it. High-level language
needs to be converted into the low-level language to make it understandable by the computer.
We use Compiler or interpreter to convert high-level language to low-level language.

Languages like FORTRAN, C, C++, JAVA, Python, etc., are examples of high-level languages.
All these programming languages use human-understandable language like English to write
program instructions. These instructions are converted to low-level language by the compiler or
interpreter so that it can be understood by the computer.

Advantages of high-level programming languages are as follow:

1. Readability: Programs written in these languages are more readable than those written in
assembly and machine languages.
2. Portability: High-level programming languages can be run on different machines with
little or no change. It is, therefore, possible to exchange software, leading to creation of
program libraries.

3. Easy debugging: Errors can be easily detected and removed.

4. Ease in the development of software: Since the instructions or statements of these


programming languages are closer to the English language, software can be developed
with ease. The time and cost of creating machine and assembly language programs were
quite high. This motivated the development of high-level languages.

Introduction to Compiler, Interpreter, Debugger, Linker, Loader, Assembler


There are mainly three steps in developing a program in C:

1. Writing the C program


2. Compiling the program
3. Executing the program

For writing C program, we use some integrated development environment, or IDE (such as
CodeBlocks which we used in out C programming Lab).

Such an editor offers a complete environment for writing, developing, modifying, deploying,
testing, and debugging the programs.

Many IDEs have a Build option, which compiles and links a program in one step.

compiling the program


Compiling involves preprocessing, compilation, assembly, and linking.

Preprocessing: It is the first phase of C compilation. It processes include-files, conditional


compilation instructions, and macros. The C preprocessor is used to modify the program
according to the preprocessor directives in the source code. A preprocessor directive is a
statement (such as #define) that gives the preprocessor specific instructions on how to modify the
source code. The preprocessor is invoked as the first part of the compiler program’s compilation
step. It is usually hidden from the programmer because it is run automatically by the compiler.

Consider the following C code


#include <stdio.h>
#define PI 3.14

int main()
{
printf("Value of PI: %f\n", PI);
}

During preprocessing, the following transformations occur:

1. The #include <stdio.h> directive is replaced with the contents of the standard
input/output library header file (stdio.h).
2. The #define PI 3.14 directive defines a macro named PI with a value of 3.14.
Whenever PI appears in the code, it is replaced with 3.14.

So, the preprocessed version of the code might look like this:

/* contents of stdio.h are included here */

int main()
{
printf("Value of PI: %f\n", 3.14);
}

Compilation: It is the second step of the compiling process. It takes the output of the
preprocessor and the source code, and generates assembler source code. The compiler examines
each program statement contained in the source program and checks it to ensure that it conforms
to the syntax and semantics of the language. If mistakes are discovered by the compiler during
this phase, they are reported to the user. The errors then have to be corrected in the source
program (with the use of an editor), and the program has to be recompiled.

Assembly: It is the third stage of compilation. During this stage, an assembler is used to translate
the assembly instructions to object code or actual machine instructions. The output consists of
actual instructions to be run by the target processor. The assembler output is stored in an object
file. On most systems, the assembler is executed automatically as part of the compilation
process. The assembler takes each assembly language statement and converts it into a binary
format known as object code, which is then written into another file on the system. This file
typically has the same name as the source file, with the last letter an ‘o’ (for object) instead of a
‘c’.
Linking: It is the final stage of compilation. After the program has been translated into object
code, it is ready to be linked. The purpose of the linking phase is to get the program into a final
form for execution on the computer.

When you write a C program, you may have multiple source files (e.g., main.c, helper.c). When
source code is compiled, each source file (e.g., main.c, helper.c) is transformed into an object file
(e.g., main.o, helper.o). Object files contain machine code, which is the binary representation of
the instructions that the CPU can execute.

A program often consists of multiple source files. Functions and variables defined in one source
file may be used in another. For example, main.c might call a function helperFunction defined in
helper.c.

When the compiler processes a single source file, it generates an object file that may contain
calls to functions or accesses to variables that are defined in other source files.

The linker’s job is to resolve these references. The linker examines all the object files
generated from the source code. It identifies where each function or variable reference in one
object file is defined in another object file. In the example, the linker would link the reference to
helperFunction in main.o with its actual definition in helper.o

The linker also includes code from these libraries as needed. If main.o references printf, the
linker finds the definition of printf in the standard library and includes it in the final executable.

The process of compiling and linking a program is often called building. The final linked file,
which is in an executable object code format, is stored in another file on the system ready to be
run or executed. Under Windows, the executable file usually has the same name as the source
file, with the .c extension replaced by an exe extension.
Debugging: Removing errors from a program is called debugging. Any type of error in a
program is known as a bug. During debugging, an attempt is made to remove all the known
problems or bugs from the program. By tracing the program step-by-step, keeping track of each
variable, the programmer monitors the program state. The program state is simply the set of
values of all the variables at a given point in program execution. It is a snapshot of the current
state of computation.

A debugger is a program that enables the programmer to run another program step-by-step and
examine the value of that program’s variables. Debuggers come in various levels of ease of use
and sophistication. The more advanced debuggers show which line of source code is being
executed.
Loader: Loading is the process of bringing a program from secondary memory into main
memory so it can run. The system software (example, windows 11 operating system) responsible
for it is known as loader.

The simplest type of loader is absolute loader which places the program into memory at the
location prescribed by the assembler.

Boot strap loader is an absolute loader which is executed when computer is switched on or
restarted to load the operating system.

In most of the cases, when a compiler translates a source code program into object code, it has no
idea where the code will be placed in main memory at the time of its execution. In fact, each
time it is executed, it would likely be assigned a different area of main memory depending on the
availability of primary storage area at the time of loading. That is why, compilers create a special
type of object code which can be loaded into any location of the main memory.

Compiler vs Interpreter:

Till this time, we are aware with the concept of a translator which translates code written in one
form into another form. There are three types of translators, namely:
✓ Assembler
✓ Compiler, and
✓ Interpreter

Depending on its implementation, a high-level language employs a compiler or an interpreter or


both for translation.

Both compiler and interpreter translate a program written in high-level language into machine
language but in different fashion.

Compiler translates the entire source program into object program at once and then the object
files are linked to produce a single executable file. Unlike compiler, an interpreter translates one
line of source code at a time—then executes it—before translating the next one and it does this
every time the program executes.

Translation using an interpreter is slower than that using a compiler. The interpreter translates
each line of source code to machine code each time the program is executed. With respect to
debugging, an interpreted language is better than the compiled language. In an interpreter, syntax
error is brought to the attention of the programmer immediately so that the programmer can
make necessary corrections during program development.

S. No. Compiler Interpreter


1 The compiler examines the entire program The interpreter only converts one statement
and converts it all at once into machine at a time into machine code.
code.
2 Because the compiler reads the code all at Errors in the interpreter are displayed line by
once, any errors (if any) are displayed at the line since it reads code one line at a time.
conclusion.
3 Generally faster due to direct execution of Slower execution speed owing to on-the-fly
machine code interpretation and execution.
4 Java, Scala, C#, C, and C++ use Compilers. Perl, Ruby, Python, and PHP have used
Interpreters.
5 The Compilers generate intermediate The Interpreters never generate any
machine codes. intermediate machine codes.
6 It works best for the Production It works the best for the programming and
Environment. development environment.
7 Generates machine code stored as an Translated instructions are temporarily
executable file on disk. stored in RAM, without creating a separate
executable.
8 Can perform extensive compile-time Limited optimization opportunities due to
optimizations for enhanced performance. runtime translation, affecting performance.
Limited optimization
opportunities due to runtime translation,
affecting performance.
9 More memory-efficient as unnecessary Less memory-efficient due to the need to
code can be optimized out during keep the entire program in memory during
compilation. interpretation.

You might also like