Fundamental Building Blocks of Computer: Unit: 1
Fundamental Building Blocks of Computer: Unit: 1
Fundamental Building Blocks of Computer: Unit: 1
Unit: 1:
Fundamental building blocks of Computer
Main Memory
Memory enables a computer to store, at least temporarily, data and programs
Output Device
The results that are stored in the memory can be transformed into a form that can be understood by users
of a computer system by means of an output device. Some common output devices are monitor,
printer, speaker etc.
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Control Unit:
Control unit (CU) Coordinates and controls the operations of a computer system. It controls the activities
between memory and ALU and between CPU and input/output devices.
Memory Unit:
A memory unit (MU) is also called primary memory or main memory or RAM (random access
memory). It holds data for processing, instructions for processing data (program), and information
(processed data). The contents of main memory are lost when the computer is turned off.
An operating system is software that manages computer hardware. The hardware must provide appropriate
mechanisms to ensure the correct operation of the computer system and to prevent user programs from
interfering with the proper operation of the system.
• A more common definition is that the operating system is the one program running at all times on
the computer (usually called the kernel), with all else being application programs.
• An operating system is concerned with the allocation of resources and services, such as memory,
processors, devices, and information. The operating system correspondingly includes programs to
manage these resources, such as a traffic controller, a scheduler, a memory management module,
I/O programs, and a file system.
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Major Functionalities of Operating System:
• Resource Management: When parallel accessing happens in the OS means when multiple users
are accessing the system the OS works as Resource Manager, Its responsibility is to provide
hardware to the user. It decreases the load in the system.
• Process Management: It includes various tasks like scheduling, termination of the process. OS
manages various tasks at a time. Here CPU Scheduling happens means all the tasks would be done
by the many algorithms that use for scheduling.
• Storage Management: The file system mechanism used for the management of the storage. NIFS,
CFS, CIFS, NFS, etc. are some file systems. All the data stores in various tracks of Hard disks that
all managed by the storage manager. It included Hard Disk.
• Memory Management: Refers to the management of primary memory. The operating system has
to keep track, how much memory has been used and by whom. It has to decide which process needs
memory space and how much. OS also has to allocate and deallocate the memory space.
• Security/Privacy Management: Privacy is also provided by the Operating system by means of
passwords so that unauthorized applications can’t access programs or data. For example, Windows
uses Kerberos authentication to prevent unauthorized access to data.
1. User
2. System and application programs
3. Operating system
4. Hardware
Every general-purpose computer consists of the hardware, operating system, system programs, and
application programs. The hardware consists of memory, CPU, ALU, and I/O devices, peripheral devices,
and storage devices. System program consists of compilers, loaders, editors, OS, etc. The application
program consists of business programs, database programs.
Every computer must have an operating system to run other programs. The operating system coordinates the
use of the hardware among the various system programs and application programs for various users. It
simply provides an environment within which other programs can do useful work.
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
The operating system is a set of special programs that run on a computer system that allows it to work
properly. It performs basic tasks such as recognizing input from the keyboard, keeping track of files and
directories on the disk, sending output to the display screen, and controlling peripheral-devices.
1. It controls the allocation and use of the computing System’s resources among the various user and
tasks.
2. It provides an interface between the computer hardware and the programmer that simplifies and
makes it feasible for coding, creation, debugging of application programs.
The Operating system must support the following tasks. The tasks are:
1. Provides the facilities to create, modification of programs and data files using an editor.
2. Access to the compiler for translating the user program from high-level language to machine
language.
3. Provide a loader program to move the compiled program code to the computer’s memory for
execution.
4. Provide routines that handle the details of I/O programming.
The module that keeps track of the status of devices is called the I/O traffic controller. Each I/O device has a
device handler that resides in a separate process associated with that device. The I/O subsystem consists of
Assembler –
The input to an assembler is an assembly language program. The output is an object program plus
information that enables the loader to prepare the object program for execution. At one time, the computer
programmer had at his disposal a basic machine that interpreted, through hardware, certain fundamental
instructions. He would program this computer by writing a series of ones and Zeros (Machine language),
place them into the memory of the machine.
Compiler –
The High-level languages- examples are FORTRAN, COBOL, ALGOL, and PL/I are processed by
compilers and interpreters. A compiler is a program that accepts a source program in a “high-level language
“and produces a corresponding object program. An interpreter is a program that appears to execute a source
program as if it was machine language. The same name (FORTRAN, COBOL, etc.) is often used to
designate both a compiler and its associated language.
Loader –
A Loader is a routine that loads an object program and prepares it for execution. There are various loading
schemes: absolute, relocating, and direct-linking. In general, the loader must load, relocate and link the
object program. The loader is a program that places programs into memory and prepares them for
execution. In a simple loading scheme, the assembler outputs the machine language translation of a program
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
on a secondary device and a loader places it in the core. The loader places into memory the machine
language version of the user’s program and transfers control to it. Since the loader program is much smaller
than the assembler, those make more core available to the user’s program.
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Above is the diagram of types of software. Now we will briefly describe each type and its subtypes:
System Software
System software is software that directly operates the computer hardware and provides the basic
functionality to the users as well as to the other software to operate smoothly. Or in other words, system
software basically controls a computer’s internal functioning and also controls hardware devices such as
monitors, printers, and storage devices, etc. It is like an interface between hardware and user applications, it
helps them to communicate with each other because hardware understands machine language(i.e. 1 or 0)
whereas user applications are work in human-readable languages like English, Hindi, German, etc. so
system software converts the human-readable language into machine language and vice versa.
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
1. Operating System: It is the main program of a computer system. When the computer system ON it
is the first software that loads into the computer’s memory. Basically, it manages all the resources
such as memory, CPU, printer, hard disk, etc., and provides an interface to the user, which helps the
user to interact with the computer system. It also provides various services to other computer
software. Examples of operating systems are Linux, Apple macOS, Microsoft Windows, etc.
2. Language Processor: As we know that system software converts the human-readable language
into a machine language and vice versa. So, the conversion is done by the language processor. It
converts programs written in high-level programming languages like Java, C, C++, Python,
etc(known as source code), into sets of instructions that are easily readable by machines(known as
object code or machine code).
3. Device Driver: A device driver is a program or software that controls a device and helps that
device to perform its functions. Every device like a printer, mouse, modem, etc. needs a driver to
connect with the computer system eternally. So, when you connect a new device with your
computer system, first you need to install the driver of that device so that your operating system
knows how to control or manage that device.
Application Software
Software that performs special functions or provides functions that are much more than the basic operation
of the computer is known as application software. Or in other words, application software is designed to
perform a specific task for end-users. It is a product or a program that is designed only to fulfill end-users’
requirements. It includes word processors, spreadsheets, database management, inventory, payroll
programs, etc.
1. An important feature of application software is it performs more specialized tasks like word
processing, spreadsheets, email, etc.
2. Mostly, the size of the software is big, so it requires more storage space.
3. Application software is more interactive for the users, so it is easy to use and design.
4. The application software is easy to design and understand.
5. Application software is written in a high-level language in general.
1. General Purpose Software: This type of application software is used for a variety of tasks and it is
not limited to performing a specific task only. For example, MS-Word, MS-Excel, PowerPoint, etc.
2. Customized Software: This type of application software is used or designed to perform specific
tasks or functions or designed for specific organizations. For example, railway reservation system,
airline reservation system, invoices management system, etc.
3. Utility Software: This type of application software is used to support the computer infrastructure. It
is designed to analyze, configure, optimize and maintains the system, and take care of its
requirements as well. For example, antivirus, disk fragmenter, memory tester, disk repair, disk
cleaners, registry cleaners, disk space analyzer, etc.
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Difference between system software and application software
Now, let us discuss some difference between system software and application software:
Less interactive for the users More interactive for the users
System software plays vital role for the effective Application software is not so important for the
functioning of a system. functioning of the system, as it is task specific.
The word “algorithm” relates to the name of the mathematician Al-khowarizmi, which means a
procedure or a technique. Software Engineer commonly uses an algorithm for planning and solving
the problems. An algorithm is a sequence of steps to solve a particular problem or algorithm is an
ordered set of unambiguous steps that produces a result and terminates in a finite time
The algorithm and flowchart include following three types of control structures.
1. Sequence: In the sequence structure, statements are placed one after the other and the
execution takes place starting from up to down.
2. Branching (Selection): In branch control, there is a condition and according to a condition, a
decision of either TRUE or FALSE is achieved. In the case of TRUE, one of the two branches
is explored; but in the case of FALSE condition, the other alternative is taken. Generally, the
‘IF-THEN’ is used to represent branch control.
3. Loop (Repetition): The Loop or Repetition allows a statement(s) to be executed repeatedly
based on certain loop condition e.g. WHILE, FOR loops.
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Advantages of algorithm
Step 1 Define your algorithms input: Many algorithms take in data to be processed, e.g. to
calculate the area of rectangle input may be the rectangle height and rectangle width.
Step 2 Define the variables: Algorithm's variables allow you to use it for more than one place. We
can define two variables for rectangle height and rectangle width as HEIGHT and WIDTH (or H &
W). We should use meaningful variable name e.g. instead of using H & W use HEIGHT and WIDTH
as variable name.
Step 3 Outline the algorithm's operations: Use input variable for computation purpose,
e.g. to find area of rectangle multiply the HEIGHT and WIDTH variable and store the value in new
variable (say) AREA. An algorithm's operations can take the form of multiple steps and even branch,
depending on the value of the input variables.
Step 4 Output the results of your algorithm's operations: In case of area of rectangle output will be
the value stored in variable AREA. if the input variables described a rectangle with a HEIGHT of 2
and a WIDTH of 3, the algorithm would output the value of 6.
FLOWCHART:
The first design of flowchart goes back to 1945 which was designed by John Von Neumann. Unlike
an algorithm, Flowchart uses different symbols to design a solution to a problem. It is another
commonly used programming tool. By looking at a Flowchartone can understand the operations and
sequence of operations performed in a system. Flowchart is often considered as a blueprint of a design
used for solving a specific problem.
Advantages of flowchart:
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Predefined Process
/Function Used to represent a
group of statements
performing one processing
task.
Preprocessor
|
--------- | Comments
|
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
The language used to write algorithm is simple and similar to day-to-day life language. The variable
names are used to store the values. The value store in variable can change in the solution steps. In
addition some special symbols are used as below
or
HEIGHT = 5
The symbol ‘=’ is used in most of the programming language as an assignment symbol, the same has
been used in all the algorithms and flowcharts in the manual.
The statement C = A + B means that add the value stored in variable A and variable B then
assign/store the value in variable C.
The statement R = R + 1 means that add I to the value stored in variable R and then assign/store the
new value in variable R, in other words increase the value of variable R by 1
Mathematical Operators:
Relational Operators
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Logical Operators
GO TO statement also called unconditional transfer of control statement is used to transfer control
of execution to another step/statement. . e.g. the statement GOTO n will transfer control to
step/statement n.
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Note: We can use keyword INPUT or READ or GET to accept input(s) /value(s) and keywords
PRINT or WRITE or DISPLAY to output the result(s).
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Algorithm
Step-1 Start
OR
Algorithm
Step-1 Start
Step-5 Stop
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
C : temperature in Celsius F :
temperature Fahrenheit
Algorithm
Step-1 Start
C : temperature in Celsius F :
temperature Fahrenheit
Algorithm
Step-1 Start
Step-5 Stop
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Algorithm
Step-1 Start
L : Length of Rectangle B
: Breadth of Rectangle
AREA : Area of Rectangle PERIMETER
: Perimeter of Rectangle
Algorithm
Step-1 Start
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
R : Radius of Circle
AREA : Area of Circle Start
Input Value
of R
Algorithm
AREA = 22.0/7.0
Step-1 Start
xRxR
Stop
Algorithm
Step-1 Start
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
P : Principle Amount N
: Time in Years
R : % Annual Rate of Interest SI :
Simple Interest
Algorithm
Step-1 Start
P : Principle Amount N
: Time in Years
R : % Annual Rate of Interest CI :
Compound Interest
Algorithm
Step-1 Start
Step-6 Stop
..
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Algorithm
Step-1 Start
Algorithm & Flowchart to Swap Two Numbers without using temporary variable
Algorithm
Step-1 Start
Step-8 Stop
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Algorithm
Step-1 Start
Algorithm
Start
Step-1 Start
Stop
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Algorithm
Step-1 Start
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Algorithm & Flowchart to find the largest of three numbers (an another way)
Algorithm
Step-1 Start
BIG = B
ENDIF
Step-5 IF C >BIG THEN
BIG = C
ENDIF
Step-6 Write BIG
Step-7 Stop
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Algorithm
Step-1 Start
Step-2 I=1
Step-3 IF (I >50) THEN
GO TO Step-7
ENDIF
Step-4 IF ( (I % 2) =0) THEN
Display I
ENDIF
Step-5 I=I+1
Step-6 GO TO Step--3
Step-7 Stop
Algorithm & Flowchart to find Odd numbers between 1 to n where n is a positive Integer
Algorithm
Step-1 Start
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
..
Algorithm
Step-1 Start
Algorithm & Flowchart to find sum of series 1+3+5+…..+N, Where N is positive odd Integer
Algorithm
Algorithm
Step-1 Start
Step-2 Input Value of N
Step-3 I = 1, SUM=0
Step-4 IF (I >N) THEN
GO TO step 8
ENDIF
Step-5 SUM = SUM + I
Step-6 I=I+2
Step-7 Go to step-4
Step-8 Display value of SUM
Step-9 Stop
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
..
Algorithm
Step-1 Start
Algorithm
Step-1 Start
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
..
Algorithm
Step-1 Start
Step-8 A=B
Step-9 B=NEXT
Step-10 COUNT=COUNT + 1
Step-11 Go to step-4
Step-12 Stop
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Algorithm & Flowchart to find sum and average of given series of numbers
Algorithm
Step-1 Start
Step-2 COUNT=0
Step-3 SUM=0
Step-4 Input NUM (next number in series)
Step-5 SUM= SUM +NUM
Step-6 COUNT=COUNT+1
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Algorithm
Step-1 Start
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Algorithm
Step-1 Start
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Algorithm
Step-1 Start
Step-2 Read two number A, B
Step-3 IF (A > B) THEN
N =A
D=B
ELSE
N=B
D=A
ENDIF
Step-4 r=N/D
Step-5 WHILE (r != 0)
DO
N=D
D=r
r =N%D
DONE
Step-6 gcd=d
Step-7 lcm = (a*b)/gcd
Step-8 Display gcd, lcm
Step-9 Stop
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
…
Algorithm
Step-1 Start
Algorithm
Step-1 Start
Step-2 Read number N
Step-3 D=1
Step-4 WHILE (D< N)
DO
IF ( N % D ==0) THEN PRINT
D
ENDIF
D=D+1
DONE
Step-5 Stop
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Generally coding is done in high level language or low level language (assembly language). For the
computer to understand these languages, they must be translated into machine level language. The
translation process is carried out by a compiler/interpreter (for high level language) or an assembler (for
assembly language program). The machine language code thus created can be saved and run immediately
or later on.
In an interpreted program, each program statement is converted into machine code before program is
executed. The execution occurs immediately one statement at a time sequentially. BASIC is one of the
frequently used interpreted language. In contrast to interpreter, a compiler converts a given source code
into object code. Once an object code is obtained, the compiled programs can be faster and more efficient
than interpreted programs.
Compilation Process
A source code must go through several steps before it becomes an executable program. In the first step
the source code is checked for any syntax errors. After the syntax errors are traced out a source file is
passed through a compiler which first translates high level language into object code (A machine code not
ready to be executed). A linker then links the object code with pre-compiled library functions, thus
creating an executable program. This executable program is then loaded into the memory for execution.
General compilation process is shown in Figure below:
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Difference between Linker and Loader
In execution of the program, major role is played by two utility programs known as Linker and Loader.
1. Linker :
A linker is special program that combines the object files, generated by compiler/assembler, and other
pieces of codes to originate an executable file have. exe extension. In the object file, linker searches and
appends all libraries needed for execution of file. It regulates the memory space that will hold the code
from each module. It also merges two or more separate object programs and establishes link among them.
Generally, linkers are of two types :
1. Linkage Editor
2. Dynamic Linker
2. Loader:
The loader is special program that takes input of executable files from linker, loads it to main memory,
and prepares this code for execution by computer. Loader allocates memory space to program. Even it
settles down symbolic reference between objects. It is in charge of loading programs and libraries in
operating system. The embedded computer systems don’t have loaders. In them, code is executed through
ROM. There are following various loading schemes:
1. Absolute Loaders
2. Relocating Loaders
3. Direct Linking Loaders
4. Bootstrap Loaders
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Editors & its Types
Editors are basically computer programs that are utilised to edit files on a computer. The provide
environment to a programmer to create, edit, update, format a document in any order he/she wants to.
In system programming or programming, editors are software or tools that are used to edit the
program. These are basically text editors of special type that have integrated functionality to edit code.
Some common program editors are notepad++, visual code, sublime. Also there are some edits that
provide things used to do more than just editing the code. They are the integrated development
environment (IDE) which can help you edit, debug and run your program in the same software.
Back to editors which have evolved so long and have been around, since the evolution of modern
computers has begun.
GRAPHICAL EDITOR− A special editor which is used to edit a graphical file or a photo. These work
based on the fact that pixels of a photo can be edited and changed.
TEXT EDITOR− This editor edits text files and updates their characters and format.
LINE EDITOR− This code editor edits the file line by line. You cannot work on a stream of lines using
the line editor. Example of a line editor is teleprinter.
STREAM EDITOR− This code editor edits the file by treating them as a sequence of characters to work
on instead of treating it as a single line. Using a stream editor, you can work on paragraphs. Example of a
stream editor is Sed Editor.
SCREEN EDITOR− This editor is able to edit any character on screen. Editor can update the content by
clicking on it using the cursor and then update the content in any way required.
WORD PROCESSOR− This is an advanced editor, one which you might have worked on (currently).
The word processor editing software is used to perform all editing tasks and also perform special
operations like editing fonts, adding styles, size features and adding multimedia to it like inserting
images, files, videos.
STRUCTURE EDITOR− This editor is specially used to edit programs that need structuring of code. It
provides features of writing and editing source code and provides an environment.
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
Types of Compilers
A compiler transforms and translates a high-end language to machine (low level) understandable
language. The compiling process does basic translation mechanisms and also error detection. The front
end compilation includes lexical, syntax, and semantic analysis. And at the back end, the compilation
does the code generation and optimization. So there are many compilers in C like BDS, Clang, GCC,
Interactive C, Lattice, Portable C Compiler, Visual Express, etc. Let’s get to know more about a few of
them.
Explanations to C Compilers
1) Borland Turbo C
Turbo C is one of the basic and popular compilers for the C programming language. This was first
introduced in 1987; it was popular for its small size, compilation speed, and low price. Once Turbo C++
got released in 1990, both the compilers are merged and the name Turbo C got discontinued. In 2006,
Embarcadero Technologies had re-released Turbo C as freeware. Do you remember this blue screen?
2) Tiny C Compiler
The Tiny C Compiler is designed to work on slow computers with little disk space. This is an ARM
processor C compiler. This compiler started its support to Windows from 2005. Some of its features are
mentioned below.
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
1. Its file size is small and according to the owner of this compiler (Fabrice Bellard). The fastness of
this compiler is around nine times faster than GCC. The compilation, assembling and linking of
code were the main attributes considered for measuring the fastness of this compiler.
2. This compiler had included many compiler-specific features to boost up the optional memory,
bound checker and had greater code stability.
3. This compiler allows automatic execution of programs during the compile-time only using
command line arguments. This way, programs are executed under UNIX, using shell scripts. The
latest version was released on December 2017.
3) Portable C Compiler
The Portable C Compiler (PCC) was a very early used and established compiler for the C programming
language that is almost around mid-1970. This compiler had a long life span. This was prevalent during a
period in such a way that many of the C compilers were based on it. The advantages of PCC depended on
its capabilities and probability predictions. PCC compiler was made such that source files were machine-
dependent, not all but only a few of them. It can detect syntax errors and can perform perfect validity
checks. A new version of PCC was released on 10 December 2014.
4) GCC
GNU Compiler Collection is the compiler produced by the GNU Project. This supports many
programming languages and it is a free software foundation under the General Public License. This
compiler was first released in 1987 and it supported only C- Programming language during the start.
Slowly it expanded to C++, Java, Android, and IOS. Here, each of the different language compilers has
its own program that reads the code written and sends the machine code as the output. All of these have a
common internal structure. When a high-level language is written, as per the language it is written, the
compiler parses the code in that language and produces an abstract syntax tree. GCC uses LALR parsers,
but slowly switched to recursive-descent parsers for C in 2006. Coming to the optimization part, as
already known this can occur during any phase of the compilation. However, here the bulk optimizations
are performed before the code generation and after the syntax, semantic analysis. Below are a few of the
optimizations performed by GCC.
In GCC back end is specified by preprocessor macros and functions specific to a particular architecture.
This code is generally built by first calling a small snippet code which is associated with each pattern and
generate instructions from the instruction set. It is done using registers, offsets, and addresses that are
chosen during the re-load phase. The current version of GCC is 9.2, which was released on August 12,
2019.
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
5) Clang
1. Clang; including C, is also a compiler for C++, Objective-C, and objective-C++ programming
languages. This compiler uses LLVM for the back end code related compilations. This compiler
has been designed to act as a replacement for the GCC by supporting many of its compilation
flags and language extensions.
2. Clang has many contributors including Apple, Microsoft, Google, Sony, and Intel. It is open-
source software. LLVM was first used by GCC for the front end compilation, but GCC had
caused some problems for developers at Apple, as the source code is large and difficult to use. So,
they had come up with Clang.
3. One of the major goals for Clang is to provide library-based architecture. It is designed to keep
more information during the compilation process than GCC. This also helps to preserve the
overall shape of the original code.
4. The error report generated by Clang during compilation is always in a detailed and specific in a
machine-readable format. Clang had always aimed to reduce the over usage of memory space and
increase the compilation speed as compared with GCC, and due to these qualities, it had become
one of the fastest-growing used compilers during a point of time. But over a period the
performance of Clang started to come down. The reports told the performance had lagged with
almost large differences as compared with GCC and started to have slower performance. The
most recent comparisons indicate that both the compilers had come up and increased their
performance and once again creating great competition between them. Yet, GCC remains to top
the list.
Flow of C Program
The C program follows many steps in execution. To understand the flow of C program well, let
us see a simple program first.
File: simple.c
1. #include <stdio.h>
2. int main(){
3. printf("Hello C Language");
4. return 0;
5. }
Let's try to understand the flow of above program by the figure given below.
1) C program (source code) is sent to preprocessor first. The preprocessor is responsible to
convert preprocessor directives into their respective values. The preprocessor generates an
expanded source code.
2) Expanded source code is sent to compiler which compiles the code and converts it into
assembly code.
3) The assembly code is sent to assembler which assembles the code and converts it into object
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
code. Now a simple.obj file is generated.
4) The object code is sent to linker which links it to the library such as header files. Then it is
converted into executable code. A simple.exe file is generated.
5) The executable code is sent to loader which loads it into memory and then it is executed.
After execution, output is sent to console.
Execution Flow
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)
ICCPL (Introduction to Computing and C- Programming language) : Notes
By, Dr. Amit Gadekar & Mritunjay Kr. Ranjan. (SOET-Sandip University, Nashik.)