Unit 1
Unit 1
CS-201
Unit 1
Computer is a device that transforms data into meaningful information. It processes the input
according to the set of instructions provided to it by the user and gives the desired output
quickly. A Computer can perform the following set of functions:
Accept data
Store data
Process data as desired
Retrieve the stored data as and when required
Print the result in desired format.
Data and Information: Data: It is the term used for raw facts and figures fed into the
computer and along with the set of instructions which enables the computer to convert this
raw data into the refined and useful information. Information: Data represented in useful and
meaningful form is information.
Input Unit :The input unit consists of input devices that are attached to the computer.
These devices take input and convert it into binary language that the computer
understands. Some of the common input devices are keyboard, mouse, joystick, scanner
etc.
Central Processing Unit (CPU) : Once the information is entered into the computer by
the input device, the processor processes it. The CPU is called the brain of the computer
because it is the control center of the computer. It first fetches instructions from memory
and then interprets them so as to know what is to be done. If required, data is fetched
from memory or input device. Thereafter CPU executes or performs the required
computation and then either stores the output or displays on the output device. The CPU
has three main components which are responsible for different functions – Arithmetic
Logic Unit (ALU), Control Unit (CU) and Memory registers
Arithmetic and Logic Unit (ALU) : The ALU, as its name suggests performs
mathematical calculations and takes logical decisions. Arithmetic calculations include
addition, subtraction, multiplication and division. Logical decisions involve comparison
of two data items to see which one is larger or smaller or equal.
Control Unit : The Control unit coordinates and controls the data flow in and out of CPU
and also controls all the operations of ALU, memory registers and also input/output units.
It is also responsible for carrying out all the instructions stored in the program. It decodes
the fetched instruction, interprets it and sends control signals to input/output devices until
the required operation is done properly by ALU and memory.
Memory Registers : A register is a temporary unit of memory in the CPU. These are
used to store the data which is directly used by the processor. Registers can be of different
sizes(16 bit, 32 bit, 64 bit and so on) and each register inside the CPU has a specific
function like storing data, storing an instruction, storing address of a location in memory
etc. The user registers can be used by an assembly language programmer for storing
operands, intermediate results etc. Accumulator (ACC) is the main register in the ALU
and contains one of the operands of an operation to be performed in the ALU.
Memory : Memory attached to the CPU is used for storage of data and instructions and
is called internal memory The internal memory is divided into many storage locations,
each of which can store data or instructions. Each memory location is of the same size
and has an address. With the help of the address, the computer can read any memory
location easily without having to search the entire memory. when a program is executed,
it’s data is copied to the internal memory and is stored in the memory till the end of the
execution. The internal memory is also called the Primary memory or Main memory. This
memory is also called as RAM, i.e. Random Access Memory. The time of access of data
is independent of its location in memory, therefore this memory is also called Random
Access memory (RAM).
Output Unit : The output unit consists of output devices that are attached with the
computer. It converts the binary data coming from CPU to human understandable form.
The common output devices are monitor, printer, plotter etc.
Classification of Computers: Computers can be classified based on the technology being
used and the way they are designed to perform the various tasks. Computers can be
categorized into Digital, Analog and Hybrid based on their design and working:
Digital Computers : These are the modern computers which are capable of processing
information in discrete form. In digital technology data which can be in the form of letters,
symbols or numbers is represented in binary form i.e. 0s and 1s. The digital computers
are used in industrial, business and scientific applications. They are quite suitable for
large volume data processing.
Analog Computers : These computers are used to process data generated by ongoing
physical processes. A thermometer is an example of an analog computer since it measures
the change in mercury level continuously. Analog computers are well suited to simulating
systems. A simulator helps to conduct experiments repeatedly in real time environment.
Some of the common examples are simulations in aircrafts, nuclear power plants,
hydraulic and electronic networks.
Hybrid Computers : These use both analog and digital technology. It has the speed of
analog computer and the accuracy of a digital computer. It may accept digital or analog
signals but an extensive conversion of data from digital to analog and analog to digital
has to be done. Hybrid Computers are used as a cost effective means for complex
simulations.
Micro Computers: These are also known as Personal Computers. These type of digital
computer uses a microprocessor (a CPU on a single chip) and include both desktops and
laptops. These computers can work on small volume of data, are very versatile and can
handle variety of applications. These computers are being used as work stations, CAD,
multimedia and advertising applications. Example: portable computers such as PDAs
(Personal Digital Assistants) and tablets.
Mini Computers: These computers can support multiple users working simultaneously
on the same machine. These are mainly used in an organization where computers installed
in various departments are interconnected. These computers are useful for small business
organizations.
Main Frames: These computers are large and very powerful computers with very high
memory capacity. These can process huge databases such as census at extremely fast rate.
They are suitable for big organizations, banks, industries etc. and can support hundreds
of users simultaneously on the network.
Super Computers: These are fastest and very expensive computers. They can execute
billions of instructions per second. These are multiprocessor, parallel systems suitable for
specialized complex scientific applications involving huge amounts of mathematical
applications such as weather forecasting.
Operating System
An operating system (OS) manages all other applications and programs in a computer, and it
is loaded into the computer by a boot program. It enables applications to interact with a
computer’s hardware. Through a designated application programme interface, the application
programmes request services from the operating system (API). The kernel is the software that
contains the operating system’s core components. To run other programmes, every computer
has to have at least one operating system installed.
Windows, Linux, and Android are examples of operating systems that enable the user to use
programs like MS Office, Notepad, and games on the computer or mobile phone. It is necessary
to have at least one operating system installed in the computer to run basic programs like
browsers.
The first computer, Z1, was made in 1936 – 1938. Unfortunately, this computer ran
without an operating system.
Twenty years later, the first-ever operating system was made in 1956.
In the 1960s, bell labs started working on building UNIX, the first multitasking
operating system.
In 1977 the apple series came into existence. Apple Dos 3.3 was the first disk operating
system.
In 1981, Microsoft built the first operating system called DOS by purchasing 86 – DOS
software from a Seattle company.
The most famous Microsoft windows came into existence in 1985 when MS-DOS was
paired with GUI, a graphics environment.
Device Management: There are various input and output devices. An OS controls the
working of these input-output devices. It receives the requests from these devices,
performs a specific task, and communicates back to the requesting process.
Security: The operating system provides various techniques which assure the integrity
and confidentiality of user data. Following security measures are used to protect user
data:
Protection against unauthorized access through login.
Protection against intrusion by keeping Firefall active.
Protecting the system memory against malicious access.
Displaying messages related to system vulnerabilities.
Error Detection: From time to time, the operating system checks the system for any
external threat or malicious software activity. It also checks the hardware for any type
of damage. This process displays several alerts to the user so that the appropriate action
can be taken against any damage caused to the system.
Now to perform the functions mentioned above, the operating system has two components:
Shell
Kernel
Shell handles user interactions. It is the outermost layer of the OS and manages the interaction
between user and operating system by:
For an in-depth understanding of this topic, check out this free operating system course.
There are several different types of operating systems present. In this section, we will discuss
the advantages and disadvantages of these types of OS.
Batch OS
Distributed OS
Multitasking OS
Network OS
Real-OS
Mobile OS
Batch OS
Batch OS is the first operating system for second-generation computers. This OS does not
directly interact with the computer. Instead, an operator takes up similar jobs and groups them
together into a batch, and then these batches are executed one by one based on the first-come,
first, serve principle.
Advantages of Batch OS
Disadvantages of OS
Examples of Batch OS: payroll system, bank statements, data entry, etc.
Distributed OS
Advantages of Distributed OS
Failure of one system will not affect the other systems because all the computers are
independent of each other.
The load on the host system is reduced.
The size of the network is easily scalable as many computers can be added to the
network.
As the workload and resources are shared therefore the calculations are performed at a
higher speed.
Data exchange speed is increased with the help of electronic mail.
Disadvantages of Distributed OS
Multitasking OS
The multitasking OS is also known as the time-sharing operating system as each task is given
some time so that all the tasks work efficiently. This system provides access to a large number
of users, and each user gets the time of CPU as they get in a single system. The tasks performed
are given by a single user or by different users. The time allotted to execute one task is called
a quantum, and as soon as the time to execute one task is completed, the system switches over
to another task.
Advantages of Multitasking OS
Each task gets equal time for execution.
The idle time for the CPU will be the lowest.
There are very few chances for the duplication of the software.
Disadvantages of Multitasking OS
Processes with higher priority cannot be executed first as equal priority is given to each
process or task.
Various user data is needed to be taken care of from unauthorized access.
Sometimes there is a data communication problem.
Network OS
Network operating systems are the systems that run on a server and manage all the networking
functions. They allow sharing of various files, applications, printers, security, and other
networking functions over a small network of computers like LAN or any other private
network. In the network OS, all the users are aware of the configurations of every other user
within the network, which is why network operating systems are also known as tightly coupled
systems.
Advantages of Network OS
Disadvantages of Network OS
Real-Time operating systems serve real-time systems. These operating systems are useful when
many events occur in a short time or within certain deadlines, such as real-time simulations.
Hard real-time OS
The hard real-time OS is the operating system for mainly the applications in which the slightest
delay is also unacceptable. The time constraints of such applications are very strict. Such
systems are built for life-saving equipment like parachutes and airbags, which immediately
need to be in action if an accident happens.
Soft real-time OS
The soft real-time OS is the operating system for applications where time constraint is not very
strict.
In a soft real-time system, an important task is prioritized over less important tasks, and this
priority remains active until the completion of the task. Furthermore, a time limit is always set
for a specific job, enabling short time delays for future tasks, which is acceptable. For Example,
virtual reality, reservation systems, etc.
Advantages of Real-Time OS
It provides more output from all the resources as there is maximum utilization of
systems.
It provides the best management of memory allocation.
These systems are always error-free.
These operating systems focus more on running applications than those in the queue.
Shifting from one task to another takes very little time.
Disadvantages of Real-Time OS
Advantages of Mobile OS
Disadvantages of Mobile OS
Examples of Mobile OS: Android OS, ios, Symbian OS, and Windows mobile OS.
1. MS-DOS:
Features:
It is a single user operating system meaning only one user can operate at a time.
It is a light weight operating system allowing users to have direct access to the BIOS and
its underlying hardware.
Loads data and programs from external sources and bring them into the internal memory
so they can be used on the computer.
Enables the computer to perform input and output operations such as taking commands
from keyboard, printing information on the screen.
It is very helpful in making file management like creating, editing, deleting files, etc.
It also controls and manages other external devices such as the printer, keyboard or
external hard drive using various drive utilities.
Drawbacks:
Features:
It is designed to run on any standard x86 Intel and AMD hence most of the hardware
vendors make drivers for windows like Dell, HP, etc.
It supports enhanced performance by utilizing multi-core processors.
It comes preloaded with many productivity tools which helps to complete all types of
everyday tasks on your computer.
Windows has a very large user base so there is a much larger selection of available
software programs, utilities.
Windows is backward compatible meaning old programs can run on newer versions.
Hardware is automatically detected eliminating need of manually installing any device
drivers.
Drawbacks:
Windows can be expensive since the OS is paid license and majority of its applications
are paid products.
Windows has high computer resource requirement like it should have high ram capacity,
a lot of hard drive space and good graphics card.
Windows slows and hangs up if the user loads up many programs at the same time.
Windows includes network sharing that can be useful if user has a network with many
PCs.
Windows is vulnerable to virus attacks since it has a huge user base and users have to
update OS to keep up-to-date with security patches.
Features:
Linux is free can be downloaded from the Internet or redistribute it under GNU licenses
and has the best community support.
Linux OS is easily portable which means it can be installed on various types of devices
like mobile, tablet computers.
It is a multi-user, multitasking operating system.
BASH is the Linux interpreter program which can be used to execute commands.
Linux provides multiple levels of file structures i.e. hierarchical structure in which all the
files required by the system and those that are created by the user are arranged.
Linux provides user security using authentication features and also threat detection and
solution is very fast because Linux is mainly community driven.
Drawbacks:
There’s no standard edition of Linux hence confusing for users and also becoming
familiar with the Linux may be a problem for new users.
More difficult to find applications to support user needs since Linux does not dominate
the market.
Since some applications are developed specifically for Windows and Mac, those might
not be compatible with linux and sometimes users might not have much of a choice to
choose between different applications like in Windows or Mac since most apps are
developed for operating systems that have a huge user base.
Some hardware may not be incompatible with Linux since it has patchier support for
drivers which may result in malfunction.
There are plenty of forums to resolve Linux issues, but it may not always match the user’s
own level of technical understanding.
3. Android Mobile Operating System:
Android is a Google’s Linux based operating system it is designed primarily for touch
screen mobile devices such as smart phones and tablet computers. The hardware which
can be used to support android is based on three architectures namely ARM, Intel and
MIPS design lets users manipulate the mobile devices intuitively, with finger movements
that mirror common motions, such as pinching, swiping, and tapping making these
applications comfortable for the users.
Features:
The android operating system is an open source operating system means that it’s free and
any one can use it.
Android offers optimized 2D and 3D graphics, multimedia, GSM connectivity, multi-
tasking.
Android OS is known for its friendly user interface and exceptional customizable
according to the user’s taste.
Huge choice of applications for its users since Playstore offer over one million apps.
Software developers who want to create applications for the Android OS can download
the Android Software Development Kit(SDK) to easily develop apps for android.
Android would consume very little power but deliver extreme performance since its
hardware is based on ARM architecture.
Drawbacks:
The design and coding of intuitive modern user experiences and interfaces poses a
difficulty because of its dependency on Java.
Most apps tend to run in the background even when closed by the user draining the
battery.
Performance is bound to take a hit as multiple programs run simultaneously in the
background at any given time.
Android phones overheat especially when indulged in hardcore productivity tasks or
heavy graphics.
Apps have lower security profiles and make users more susceptible to data breaches.
Number Systems:
The number system is something we use every day to complete our tasks and routine activities.
For this, we have a system in place with unique symbols and specific values. This system
becomes what we call a number system helping us calculate everything.
The basic features of a number system are – unique symbols, consistency, comparable value
results and are easy to reproduce. The Decimal system remains the most basic system used by
humans with a base power of 10 but the same things can’t go for machines as well.
Number system with base value 10 is termed as Decimal number system. It uses 10 digits i.e.
0-9 for the creation of numbers. Here, each digit in the number is at a specific place with
place value a product of different powers of 10. Here, the place value is termed from right to
left as first place value called units, second to the left as Tens, so on Hundreds, Thousands,
etc. Here, units has the place value as 10 0, tens has the place value as 10 1, hundreds as 102,
thousands as 103, and so on.
For example: 10285 has place values as
(1 × 104) + (0 × 103) + (2 × 102) + (8 × 101) + (5 × 100)
1 × 10000 + 0 × 1000 + 2 × 100 + 8 × 10 + 5 × 1
10000 + 0 + 200 + 80 + 5
10285
Number System with base value 2 is termed as Binary number system. It uses 2 digits i.e. 0
and 1 for the creation of numbers. The numbers formed using these two digits are termed as
Binary Numbers. Binary number system is very useful in electronic devices and computer
systems because it can be easily performed using just two states ON and OFF i.e. 0 and 1.
Decimal Numbers 0-9 are represented in binary as: 0, 1, 10, 11, 100, 101, 110, 111, 1000,
and 1001
Examples:
14 can be written as 1110
19 can be written as 10011
50 can be written as 110010
3. Octal Number System
Octal Number System is one in which the base value is 8. It uses 8 digits i.e. 0-7 for creation
of Octal Numbers. Octal Numbers can be converted to Decimal value by multiplying each
digit with the place value and then adding the result. Here the place values are 80, 81, and 82.
Octal Numbers are useful for the representation of UTF8 Numbers.
Example:
(135)10 can be written as (207)8
(215)10 can be written as (327)8
Number System with base value 16 is termed as Hexadecimal Number System. It uses 16
digits for the creation of its numbers. Digits from 0-9 are taken like the digits in the decimal
number system but the digits from 10-15 are represented as A-F i.e. 10 is represented as A,
11 as B, 12 as C, 13 as D, 14 as E, and 15 as F. Hexadecimal Numbers are useful for handling
memory address locations.
Examples:
(255)10 can be written as (FF)16
(1096)10 can be written as (448)16
(4090)10 can be written as (FFA)16
Conversion between numbers systems is quite an easy task. Any number from any number
system can be converted to other number systems with the help of certain methods that will
be discussed below:
Decimal Numbers are represented with digits 0-9 and with base 10. Conversion of a number
system means conversion from one base to another. Following are the conversion of the
Decimal Number System to other Number Systems:
A. Decimal to Binary Conversion:
Decimal numbers are represented in base 10, but the binary numbers are of base 2. Hence, to
convert a decimal number to binary number, the base of that number is to be changed. Follow
the steps given below:
Step 1: Divide the Decimal Number with the base of the number system to be converted
to. Here the conversion is to binary, hence the divisor will be 2.
Step 2: The remainder obtained from the division will become the least significant digit
of the new number.
Step 3: The quotient obtained from the division will become the next dividend and will
be divided by base i.e. 2.
Step 4: The remainder obtained will become the second least significant digit i.e. it will
be added in the left of the previously obtained digit.
Now, the steps 3 and 4 are repeated until the quotient obtained becomes 0, and the remainders
obtained after each iteration are added to the left of the existing digits.
After all the iterations are over, the last obtained remainder will be termed as the Most
Significant digit.
Octal Numbers are represented in base 8. Hence, to convert a decimal number to octal
number, the base of that number is to be changed. Follow the steps given below:
Step 1: Divide the Decimal Number with the base of the number system to be converted
to. Here the conversion is to octal, hence the divisor will be 8.
Step 2: The remainder obtained from the division will become the least significant digit
of the new number.
Step 3: The quotient obtained from the division will become the next dividend and will
be divided by base i.e. 8.
Step 4: The remainder obtained will become the second least significant digit i.e. it will
be added in the left of the previously obtained digit.
Now, the steps 3 and 4 are repeated until the quotient obtained becomes 0, and the remainders
obtained after each iteration are added to the left of the existing digits.
C. Decimal to Hexadecimal Conversion:
Hexadecimal Numbers are represented in base 16. Hence, to convert a decimal number to
hexadecimal number, the base of that number is to be changed. Follow the steps given below:
Step 1: Divide the Decimal Number with the base of the number system to be converted
to. Here the conversion is to Hex hence the divisor will be 16.
Step 2: The remainder obtained from the division will become the least significant digit
of the new number.
Step 3: The quotient obtained from the division will become the next dividend and will
be divided by base i.e. 16.
Step 4: The remainder obtained will become the second least significant digit i.e. it will
be added in the left of the previously obtained digit.
Now, the steps 3 and 4 are repeated until the quotient obtained becomes 0, and the remainders
obtained after each iteration are added to the left of the existing digits.
2. Conversion from Binary Number System to Other Number Systems
Binary Numbers are represented with digits 0 and 1 and with base 2. Conversion of a number
system means conversion from one base to another. Following are the conversion of the
Binary Number System to other Number Systems:
A. Binary to Decimal Conversion:
Binary numbers are represented in base 2 but the decimal numbers are of base 10. Hence, to
convert the binary number into a decimal number, the base of that number is to be changed.
Follow the steps given below:
Step 1: Multiply each digit of the Binary number with the place value of that digit,
starting from right to left i.e. from LSB to MSB.
Step 2: Add the result of this multiplication and the decimal number will be formed.
Example: To convert (11101011)2 into a decimal number
Octal Numbers are represented with digits 0-7 and with base 8. Conversion of a number
system means conversion from one base to another. Following are the conversions of the
Octal Number System to other Number Systems:
A. Octal to Decimal Conversion:
Octal numbers are represented in base 8, but the decimal numbers are of base 10. Hence, to
convert an octal number to a decimal number, the base of that number is to be changed.
Follow the steps given below:
Step 1: Multiply each digit of the Octal number with the place value of that digit, starting
from right to left i.e. from LSB to MSB.
Step 2: Add the result of this multiplication and the decimal number will be formed.
Example:
Hex Numbers are represented with digits 0-9 and with letters A-F and with base 16.
Conversion of a number system means conversion from one base to another. Following are
the conversions of the Hexadecimal Number System to other Number Systems:
A. Hexadecimal to Decimal Conversion:
Hexadecimal numbers are represented in base 16 but the decimal numbers are of base 10.
Hence, to convert a hexadecimal number to a decimal number, the base of that number is to
be changed. Follow the steps given below:
Step 1: Write the decimal values of the symbols used in the Hex number i.e. from A-F
Step 2: Multiply each digit of the Hex number with its place value. starting from right to
left i.e. LSB to MSB.
Step 3: Add the result of multiplications and the final sum will be the decimal number.
Example: To convert (8EB4)16 into a decimal value
B. Hexadecimal to Binary Conversion:
Hex numbers are represented in base 16, but the binary numbers are of base 2. Hence, to
convert a hexadecimal number to a binary number, the base of that number is to be changed.
Follow the steps given below:
Step 1: Convert the Hex symbols into its equivalent decimal values.
Step 2: Write each digit of the Hexadecimal number separately.
Step 3: Convert each digit into an equivalent group of four binary digits.
Step 4: Combine these groups to form the whole binary number.
Example: (B2E)16 is to be converted to binary
What is an Algorithm?
The word Algorithm means “a process or set of rules to be followed in calculations or other
problem-solving operations”. Therefore Algorithm refers to a set of rules/instructions that
step-by-step define how a work is to be executed in order to get the expected results. Let’s
take a look at an example for a better understanding. As a programmer, we are all aware of
the Linear Search program. (Linear Search)
What are the Characteristics of an Algorithm?
As one would not follow any written instructions to cook the recipe, but only the standard
one. Similarly, not all written instructions for programming is an algorithms. In order for
some instructions to be an algorithm, it must have the following characteristics:
Clear and Unambiguous: The algorithm should be clear and unambiguous. Each of its
steps should be clear in all aspects and must lead to only one meaning.
Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined
inputs. It may or may not take input.
Well-Defined Outputs: The algorithm must clearly define what output will be yielded
and it should be well-defined as well. It should produce at least 1 output.
Finite-ness: The algorithm must be finite, i.e. it should terminate after a finite time.
Feasible: The algorithm must be simple, generic, and practical, such that it can be
executed with the available resources. It must not contain some future technology or
anything.
Language Independent: The Algorithm designed must be language-independent, i.e. it
must be just plain instructions that can be implemented in any language, and yet the
output will be the same, as expected.
Properties of Algorithm:
It should terminate after a finite time.
It should produce at least one output.
It should take zero or more input.
It should be deterministic means giving the same output for the same input case.
Every step in the algorithm must be effective i.e. every step should do some work.
Flowchart
A flowchart is a graphical representation of an algorithm. Programmers often use it as a
program-planning tool to solve a problem. It makes use of symbols that are connected among
them to indicate the flow of information and processing. The process of drawing a flowchart
for an algorithm is known as “flowcharting”. Example: Draw a flowchart to input two
numbers from the user and display the largest of two numbers
Types of boxes used to make a flowchart
There are different types of boxes that are used to make flowcharts. All the different kinds of
boxes are connected to one another by arrow lines. Arrow lines is used to display the flow of
control. Let’s learn about each box in detail.
1. Terminal
This box is of an oval shape which is used to indicate the start or end of the program. Every
flowchart diagram has this oval shape that depicts the start of an algorithm and another oval
shape that depicts the end of an algorithm. For example:
2. Data
This is a parallelogram-shaped box inside which the inputs or outputs are written. This
basically depicts the information that is entering the system or algorithm and the information
that is leaving the system or algorithm. For example: if the user wants to input a from the
user and display it, the flowchart for this would be:
3. Process
This is a rectangular box inside which a programmer writes the main course of action of the
algorithm or the main logic of the program. This is the crux of the flowchart as the main
processing codes is written inside this box. For example: if the programmer wants to add 1
to the input given by the user, he/she would make the following flowchart:
4. Decision
This is a rhombus-shaped box, control statements like if, or condition like a > 0, etc are
written inside this box. There are 2 paths from this one which is “yes” and the other one is
“no”. Like every decision has either yes or no as an option, similarly, this box to have these
as options. For example: if the user wants to add 1 to an even number and subtract 1 if the
number is odd, the flowchart would be:
5. Flow
This arrow line represents the flow of the algorithm or process. It represents the direction of
the process flow. in all the previous examples, we included arrows in every step to display
the flow of the program. arrow increases the readability of the program.
6. On-Page Reference
This circular figure is used to depict that the flowchart is in continuation with the further
steps. This figure comes into use when the space is less and the flowchart is long. Any
numerical symbol is present inside this circle and that same numerical symbol will be
depicted before the continuation to make the user understand the continuation. Below is a
simple example depicting the use of On-Page Reference
Advantages of Flowchart
The algorithm is the pseudo-code forA flowchart is just a graphical representation of that
7. the program. logic.
High-level language:
It is a machine-independent language. It enables a user to write a program in a language
that resembles English words and familiar mathematical symbols, COBOL was the first
high-level language. Examples of high-level language are python,c#, etc.
3. Assembly Level language: It is the more than low level and less than high-level language
so it is intermediary language. Assembly languages use numbers, symbols, and abbreviations
instead of 0s and 1s.For example: For addition, subtraction and multiplications it uses
symbols likes Add, sub and Mul, etc.
ASSEMBLY LEVEL
LANGUAGE HIGH-LEVEL LANGUAGE
Modifications and error fixing cannot be Modifications and error fixing can be
done in machine language. done in assembly language.
Compiler:
The language processor that reads the complete source program written in high-level
language as a whole in one go and translates it into an equivalent program in machine
language is called a Compiler. Example: C, C++, C#, Java.
In a compiler, the source code is translated to object code successfully if it is free of errors.
The compiler specifies the errors at the end of the compilation with line numbers when there
are any errors in the source code. The errors must be removed before the compiler can
successfully recompile the source code again
Assembler:
The Assembler is used to translate the program written in Assembly language into machine
code. The source program is an input of an assembler that contains assembly language
instructions. The output generated by the assembler is the object code or machine code
understandable by the computer. Assembler is basically the 1st interface that is able to
communicate humans with the machine. We need an Assembler to fill the gap between
human and machine so that they can communicate with each other. code written in assembly
language is some sort of mnemonics(instructions) like ADD, MUL, MUX, SUB, DIV, MOV
and so on. and the assembler is basically able to convert these mnemonics in Binary code.
Here, these mnemonics also depend upon the architecture of the machine.
For example, the architecture of intel 8085 and intel 8086 are different.
Interpreter:
The translation of a single statement of the source program into machine code is done by a
language processor and executes immediately before moving on to the next line is called
an interpreter. If there is an error in the statement, the interpreter terminates its translating
process at that statement and displays an error message. The interpreter moves on to the next
line for execution only after the removal of the error. An Interpreter directly executes
instructions written in a programming or scripting language without previously converting
them to an object code or machine code.
Example: Perl, Python and Matlab.
Linker
Linker is a computer program that links and merges various object files together in order to
make an executable file. All these files might have been compiled by separate assemblers. The
major task of a linker is to search and locate referenced module/routines in a program and to
determine the memory location where these codes will be loaded, making the program
instruction to have absolute references.
Loader
Loader is a part of operating system and is responsible for loading executable files into memory
and execute them. It calculates the size of a program (instructions and data) and creates memory
space for it. It initializes various registers to initiate execution.