You are on page 1of 88

Amity School of Engineering & Technology

Amity School of Engineering & Technology


Programming for Problem Solving (CSE 104)
Credit Units: 03
Mr. VIVEK PARASHAR
Assistant Professor CSE

1
Amity School of Engineering & Technology

Schools ASET
Program & Semester CSE I semester

Course Title Programming for Problem Solving

Course Code CSE 104

Credit Unit 03
Faculty Name
Mr. Vivek Parashar
Email Vparahsar@gwa.amity.edu

Contact no. +918878644486

2
Amity School of Engineering & Technology

About Myself

• I am Vivek Parashar Assistant Professor (ASET)


• B.Tech (2002) and M.Tech (2006) from NIT Raipur
• Having more than 17 years of Teaching and Training
experience
• I was a corporate trainer at Wipro Technologies.

3
Amity School of Engineering & Technology

My Promise to you
• I will treat you with respect
• I will be available for questions (after class, during
office hours)
• I will arrive prepared to teach
• I will try to be engaging and helpful
• I will grade you fairly and objectively

4
Amity School of Engineering & Technology

University Expectations
• Come to class on-time (especially during exams)
• Turn in work on-time
• Do all work independently (except group work)
• Follow Rules of Conduct and Academic Behavior
Standards as detailed in the Student Regulations.
• Take responsibility for your own learning!

5
Amity School of Engineering & Technology

My Expectations

• Treat each other with respect


• Work hard
• Keep silence in class room
• Ask if you have questions!

6
Amity School of Engineering & Technology

Course Objectives
• The objective of this course is to acquaint the students with the
basics of computers system, its components.
• To make the student learn a programming language.
• To learn problem solving techniques.
• To teach the student to write programs in C and to solve the
problems.
Amity School of Engineering & Technology

Learning Outcomes
• After Completion of this course the student would be able to
• Read, understand and trace the execution of programs written in C
language.
• Write the C code for a given algorithm.
• Implement Programs with pointers and arrays, perform pointer
arithmetic, and use the pre-processor.
• Write programs that perform operations using derived data types.
Amity School of Engineering & Technology

Syllabus
Module 1: Introduction to Programming:
Introduction to components of a computer system (disks, memory,
processor, where a program is stored and executed, operating system,
compilers etc.) Idea of Algorithm: steps to solve logical and numerical
problems. Representation of Algorithm: Flowchart/ Pseudocode with
examples. From algorithms to programs; source code, variables (with
data types) variables and memory locations, Syntax and Logical Errors
in compilation, object and executable code.
Amity School of Engineering & Technology

Module 2: Programming Essential:


Arithmetic expressions and precedence, Conditional Branching and
Loop, Writing and evaluation of conditionals and consequent
branching , Iteration and loops.

Module 3: Arrays:
Arrays (1-D, 2-D), Character arrays and Strings.

Module 4: Basic Algorithms:


Searching, Basic Sorting Algorithms (Bubble, Insertion and
Selection), Finding roots of equations, notion of order of
complexity through example programs (no formal definition
required)C
Amity School of Engineering & Technology

Module 5: Function:
Functions (including using built in libraries), Parameter passing in
functions, call by value, Passing arrays to functions: idea of call by
reference

Module 6: Recursion:
Recursion, as a different way of solving problems. Example
programs, such as Finding Factorial, Fibonacci series, Ackerman
function etc. Quick sort or Merge sort.

Module 7: Structure:
Structures, Defining structures and Array of Structures.
Amity School of Engineering & Technology

Module8: Pointers:
Idea of pointers, Defining pointers, Use of Pointers in self-referential
structures, notion of linked list (no implementation)
 
Module 9: File handling:
Basics of file Handling.
Amity School of Engineering & Technology

Text & References: Books

•Let us C by Yashavant Kanetkar


•The complete reference by Herbert Schild
•Programming in ANSI C by E. Balaguruswamy
•Head first C by David Griffiths
•C-How to Program by Paul and Harvey Deitel
Amity School of Engineering & Technology

Computer
Amity School of Engineering & Technology

Data Processing
The activity of processing data using a computer is called
data processing
Data

Capture Data

Manipulate Data

Output Results

Information
Data is raw material used as input and information
is processed data obtained as output of data
processing
Amity School of Engineering & Technology
Amity School of Engineering & Technology

The characteristics of the computer system are


as follows −
Amity School of Engineering & Technology
Amity School of Engineering & Technology
Amity School of Engineering & Technology

(Continued on next
slide)
Amity School of Engineering & Technology

• At around 600 BC ABACUS was invented which was qualified


as Digital Computer
Amity School of Engineering & Technology

Evolution of Computers
 Blaise Pascal invented the first mechanical adding
machine” Pascaline” in 1642-44
Amity School of Engineering & Technology

 Baron Gottfried Wilhelm von Leibniz


invented the first calculator for
multiplication in 1671
Amity School of Engineering & Technology
Amity School of Engineering & Technology

• During the late 1700s, Joseph Marie Jacquard developed


the Jacquard Loom that was later expanded upon in the late
1800s and early 1900s by Herman Hollerith with his keypunch
inventions.

Herman Hollerith punchcards 

Jacquard Loom 
Amity School of Engineering & Technology

• Charles Babbage is
considered to be
the father of modern digital
computers

• He designed “Difference
Engine” in 1833

• He designed a fully automatic


analytical engine in 1842 for
performing basic arithmetic
functions which was completed
in 1910 after his death in 1871.

• His efforts established a


number of principles that are
fundamental to the design of
any digital computer
Amity School of Engineering & Technology

Some Well Known Early Computers

• Known as Automatic
Sequence Controlled
Calculator
• Fully automatic calculating
machine designed by
Howard A Aiken in
collaboration with IBM
• Design was based on
punched card machinery.
• It was complex in design
and huge in size.
• Uses 3000 electrically
actuated switches and was
50 ft long and 8 ft hig
Amity School of Engineering & Technology

• This electronic machine was developed by Dr. John attanasoff to


solve mathematical equations.
• It used 45 vacuum tubes for internal logic and capacitors storage
Amity School of Engineering & Technology

• The Electronic Discrete Variable Automatic Computer was designed J.


Presper Eckert and John Mauchly at the University of Pennsylvania on
the concept of stored program concept( in which the data and
instructions are stored inside the memory).Stored program concept
was given by Von Neumann which introduced the idea of storing both
instructions as well data in the binary form instead of decimal numbers
Amity School of Engineering & Technology

• Britishers developed the Electronic Delay Storage


automatic Calculator.In this machine addition operations
was accomplished in 1500 microseconds and multiplication
in 4000 microsecond
Amity School of Engineering & Technology

• This computer was a small experimental machine based in


the stored program concept
• Designed by scientists headed by M.H.A Newman
• Its storage capacity was 32 words and each of 31binary digits
Amity School of Engineering & Technology

• Universal Automatic Computer was the first digital computer. Many


UNIVAC machines were produced but first business use computer , a
UNIVAC I was used by General Electric Corporation in 1954In 1952 IBM
introduced the 701 commercial computer. In rapid succession,
improved models of the univac-I and other 70 series machines were
introduced
Amity School of Engineering & Technology

The first hard disk drive,


made by IBM on 14 sept
1956. It was called
the IBM Model 350 Disk.
It had 50 24-inch disks .
This hulk of a storage unit
could store a whopping
5MB of data. It could hold
3.75 Megabytes. And cost
$10,000 per megabyte and
a lease of $3,200 per
month. The weight was
250 KG
Amity School of Engineering & Technology

On September 9, 1947, the


world's first computer bug was
recorded. But this was no
ordinary 'software bug'. It was a
real-life moth that was causing
the issues with
the computer's hardware. This
“first actual case of bug being
found" was recorded
by computer scientist Grace
Hopper.
Amity School of Engineering & Technology

Ten Interesting Facts about computers


1. The first electronic computer ENIAC weighed more than 27
tons and took up 1800 square feet.
2. TYPEWRITER is the longest word that you can write using the
letters only on one row of the keyboard of your computer.
3. Doug Engelbart invented the first computer mouse in around
1964 which was made of wood.
4. There are more than 5000 new computer viruses released
every month.
5. If there was a computer as powerful as the human brain, it
would be able to do 38 thousand trillion operations per second
and hold more than 3580 terabytes of memory.
Amity School of Engineering & Technology

• C Language was not called C at the beginning. It has been


named as C after passing many stages of evolution. Evolution
of C:
• ALGO -> BCPL -> B -> Tradition C -> K&R C -> ANSI C ->
ANSI/ISO C -> C99.

• It was developed at Bell Laboratories in 1972 by Dennis Ritchie.


• Why it is named as C ? There is no such logic behind the
naming of C Language.
• It was developed to cover all the inabilities of B language
(simplified version of BCPL). So, it was just named C as it is
next to B in the English alphabets.
Amity School of Engineering & Technology

• C is the only programming language that exists for such a long


period and still it is widely used.
• C is the basis of many other programming languages like C++,
Java, JavaScript, Go, C#, PHP, Python, Perl, C-shell and many
more.
• Unix was one of the first operating system kernels implemented
in a language other than assembly and that was C.
• Previously, C was considered as the high level language but
today many programmers consider it as a low level language
as it supports only scalar operations.
• C18 is the latest version of C programming Language
published in June 2018.
Amity School of Engineering & Technology

1. The password for the computer controls of nuclear tipped


missiles of the U.S was 00000000 for eight years.
2. HP, Microsoft and Apple have one very interesting thing in
common – they were all started in a garage.
3. The first 1GB hard disk drive was announced in 1980 which
weighed about 550 pounds, and had a price tag of $40, 000.
4. The original name of windows was Interface Manager.
5. The first microprocessor created by Intel was the 4004. It was
designed for a calculator, and in that time nobody imagined
where it would lead.
Amity School of Engineering & Technology

Computer Generations
 “Generation” in computer talk is a step in technology. It
provides a framework for the growth of computer
industry

 Originally it was used to distinguish between various


hardware technologies, but now it has been extended
to include both hardware and software

 Till today, there are five computer generations

(Continued on next
slide)
Amity School of Engineering & Technology

Computer Generations
(Continued from previous slide..)

Some
Generation Key hardware Key software Key characteristics representative
(Period) technologies technologies systems

First  Vacuum tubes  Machine and  Bulky in size  ENIAC


(1942-1955)  Electromagnetic assembly  Highly unreliable  EDVAC
relay memory languages  Limited commercial  EDSAC
 Punched cards  Stored program use and costly  UNIVAC I
secondary storage concept  Difficult commercial  IBM 701
 Mostly scientific production
applications  Difficult to use

Second  Transistors  Batch operating Faster, smaller, more  Honeywell 400


(1955-1964)  Magnetic cores system reliable and easier to  IBM 7030
memory  High-level program than previous  CDC 1604
 Magnetic tapes programming generation systems
 UNIVAC LARC
 Disks for secondary languages Commercial production
storage  Scientific and was still difficult and
commercial costly
applications

(Continued on next
slide)
Amity School of Engineering & Technology

Computer Generations
(Continued from previous slide..)

Generation Key hardware Key software Key Some rep.


(Period) technologies technologies characteristics systems

Third  ICs with SSI and  Timesharing  Faster, smaller, more  IBM 360/370
(1964-1975) MSI technologies operating reliable, easier and PDP-8
 Larger magnetic system cheaper to produce PDP-11
cores memory  Standardization  Commercially, easier
 CDC 6600
 Larger capacity of high-level to use, and easier to
disks and programming upgrade than previous
magnetic tapes languages generation systems
secondary storage  Unbundling of  Scientific, commercial
 Minicomputers; software from and interactive on-
upward hardware line applications
compatible family
of computers

(Continued on next
slide)
Amity School of Engineering & Technology

Computer Generations
(Continued from previous slide..)

Generation Key hardware Key software Key Some rep.


(Period) Technologies technologies characteristics systems

Fourth (1975-  ICs with VLSI  Operating systems for  Small, affordable,  IBM PC and
1989) technology PCs with GUI and reliable, and easy its clones
 Microprocessors; multiple windows on a to use PCs  Apple II
semiconductor memory single terminal screen  More powerful  TRS-80
 Larger capacity hard  Multiprocessing OS with And reliable  VAX 9000
disks as in-built concurrent mainframe
 CRAY-1
secondary storage programming systems and
languages supercomputers  CRAY-2
 Magnetic tapes and
floppy disks as portable  UNIX operating system  Totally general  CRAY-X/MP
storage media with C programming purpose machines
 Personal computers language  Easier to produce
 Supercomputers based  Object-oriented design commercially
on parallel vector and programming  Easier to upgrade
processing and  PC, Network-based,  Rapid software
symmetric and supercomputing development
multiprocessing applications possible
technologies
 Spread of high-speed
computer networks

(Continued on next
slide)
Amity School of Engineering & Technology

Computer Generations
(Continued from previous slide..)

Generation Key hardware Key software Key Some rep.


(Period) technologies technologies characteristics systems

Fifth (1989-  ICs with ULSI  Micro-kernel based,  Portable computers  IBM notebooks
Present) technology multithreading,  Powerful, cheaper,  Pentium PCs
 Larger capacity distributed OS reliable, and easier  SUN Workstations
main memory, hard  Parallel to use desktop  IBM SP/2
disks with RAID programming machines
libraries like MPI &  SGI Origin 2000
support  Powerful
 Optical disks as PVM  PARAM 10000
supercomputers
portable read-only  JAVA  High uptime due to
storage media  World Wide Web hot-pluggable
 Notebooks,  Multimedia, Internet components
powerful desktop applications  Totally general
PCs and  More complex purpose machines
workstations supercomputing  Easier to produce
 Powerful servers, applications commercially, easier
supercomputers to upgrade
 Internet  Rapid software
 Cluster computing development
possible
Amity School of Engineering & Technology

Electronic Devices Used


in Computers of Different
Generations

(a) A Vacuum Tube (b) A Transistor (c) An IC Chip


Amity School of Engineering & Technology

Key Words/Phrases

 Computer  Integrated Circuit (IC)


 Computer generations  Large Scale Integration (VLSI)
 Computer Supported Cooperative  Medium Scale Integration (MSI)
Working (CSCW)  Microprocessor
 Data  Personal Computer (PC)
 Data processing  Second-generation computers
 Data processor  Small Scale Integration (SSI)
 First-generation computers  Stored program concept
 Fourth-generation computers  Third-generation computers
 Garbage-in-garbage-out (GIGO)  Transistor
 Graphical User Interface (GUI)  Ultra Large Scale Integration
 Groupware (ULSI)
 Information  Vacuum tubes
Amity School of Engineering & Technology

• Intel has recently launched 10th-generation, 10-nanometer silicon


processor, codenamed “Ice Lake”
• According to Intel the chip has been designed with AI in mind.
There’s a new “dedicated instruction set” for support of neural
networks on the CPU and a dedicated engine for background
workloads.
• The second improvement is in the graphics capability.A new graphic
architecture offers double the performance of the previous chip and
shows the biggest leap in graphics performance since the Skylake
microarchitecture launched back in 2015. Playing 1080p games and
editing 4K video should be faster, as should rendering content.
• Finally, the new chips will add support for the more efficient and
speedy Wi-Fi 6 standard.
Amity School of Engineering & Technology

• 11 variations of the chips, ranging from low-end Core i3's to quad-


core Core i7’s.
• Ryzen Pro 4000 series is the eight-core Ryzen 7 PRO 4750U, which
has a 1.7-gigahertz base frequency that can go all the way up to
4.2GHz. It’s capable of running up to 16 threads at once. AMD
claims that the CPU provides more than twice the performance of
Intel Corp.’s comparable Core i7-10510U for multithreaded use
cases, such as when a worker is running a complex professional
application or has multiple programs open. Single-thread
performance is about the same.
• Advanced Micro Devices unveiled a new 7-nanometer, 16-core
Ryzen 3 processor and a 7-nanometer Navi graphics processing unit
(GPU) that will challenge Intel in chips for gaming machines.
Amity School of Engineering & Technology

• The Ryzen 9 3950X has 16 cores, 32 threads, 4.7-GHz boost


frequency, 3.5 GHz base frequency, and 72 megabytes of cache
• Apple is coming with new ‘A14’ chip will be manufactured using
TSMC’s(Taiwan Semiconductor Manufacturing Company) new 5
nanometer production process, down from 7 nanometer fabrication
seen in the A12 and A13.
• Apple has launched 12-core CPU with eight high-performance
“Firestorm” cores and at least four energy-efficient “Icestorm” cores.
• Currently Apple has The A12Z chip used in iPad Pro has eight cores:
four high performance and four energy efficient.
Amity School of Engineering & Technology

Operating Systems
Amity School of Engineering & Technology

What is Operating Systems ?


Amity School of Engineering & Technology

Operating system is an interface between user and the


computer hardware. The hardware of the computer cannot
understand the human readable language as it works on
binaries i.e. 0’s and 1’s. Also it is very tough for humans to
understand the binary language, in such case we need an
interface which can translate human language to hardware
and vice−versa for effective communication.
Amity School of Engineering & Technology

Types of Operating System:

There are Three Types of Operating Systems. They are:


•Single User − Single Tasking Operating System
•Single User − Multitasking Operating System
•Multi User − Multitasking Operating System
Amity School of Engineering & Technology

Single User – Single Tasking Operating System


In this type of operating system only one user can log into system and can perform
only one task at a time.
E.g: MS- DOS

Single User − Multitasking Operating System


This type of Operating System supports only one user to log into the system but a user
can perform multiple tasks at a time, browsing internet while playing songs etc.
E.g: Windows

Multi User − Multitasking Operating System


This type of Operating System provides multiple users to log into the system and also
each user can perform various tasks at a time. In a broader term multiple users can
logged in to system and share the resources of the system at the same time.
E.g: UNIX, LINUX etc.
Amity School of Engineering & Technology
Amity School of Engineering & Technology

Know your Computer first ?

Multi-core: means it's a single processor (CPU, Central


Processing Unit) with multiple cores. Each core = two
threads. A thread, in the simplest sense, is the most basic
level of code execution, so two threads can be seen as two
things that each core can work on simultaneously. So an
Oct-core CPU (8 cores) can work on 16 things at once.
Ex: Your friends working on same problem with you.
Amity School of Engineering & Technology
Amity School of Engineering & Technology
Amity School of Engineering & Technology

Now a days computers are equipped with L1,L2,L3 Cache


Memory. In multicore processors, each core may have
dedicated L1 and L2 cache, but they can share an L3
cache Level 3 (L3) cache is specialized memory
developed to improve the performance of L1 and L2. L1 or
L2 can be significantly faster than L3.
Amity School of Engineering & Technology

Generation of Computers: It depends on the size of


transistors. In every one or two years the generation
changes means the size of transistors placed on chip
changes. The size also play a great role, ex 10 nM,12 nM ,
Smaller the size faster the processor. 10nM means the size
of transistors.

What is i3,i5, i7 & i9 ?

i3 Core i3 processors first appeared in 2010 and are the


entry-level Intel chipsets with 2 cores (processors). Core i3
have a slower clock speed then i5 without Turbo Boost.
Amity School of Engineering & Technology

i5 Core i5 processors first appeared in 2009, It may have


2-4 cores (processors) with turbo boost. Turbo Boost
allows faster speeds when the processor is under high
demand. Other advantages included better memory
support. Hyper-threading.

i7 Core i7 processors were introduced in 2008 and is


aimed at businesses and power users with 2-6 cores
(processors). As you might expect, the i7 features more
cache, more clock speed, and often more cores.
Amity School of Engineering & Technology

i9 Core i9 processors were introduced in 2017 and feature a


high number of cores, high power draw, high thermal output,
and high performance. They are intended to be used by
hardcore gamers and enthusiasts. They are also the most
expensive processors.
Amity School of Engineering & Technology

Stock Keeping Unit or part number: SKUs are generally


assigned in the order in which processors in that generation and
product line are developed. SKU numbers are not recommended
for comparison across different generations or product lines

Product Line Suffix: These remaining differences are indicated


by a letter-based product line suffix. For example, within the
Intel® Core™ series, U indicates a processor that has been
designed for power-efficient laptops or 2-in-1s. Meanwhile, XE
indicates an “extreme edition” processor for desktops designed
for maximum performance.
Amity School of Engineering & Technology

Suffix Meaning

G1-G7 Graphics level (processors with new integrated graphics technology only)

F Requires discrete graphics (Require graphic card seperately)

G Includes discrete graphics on package

H High performance optimized for mobile

HK High performance optimized for mobile, unlocked

HQ High performance optimized for mobile, quad core

K Unlocked (You can overclock)

S Special edition

T Power-optimized lifestyle

U Mobile power efficient


Amity School of Engineering & Technology

Processor
Product Launch Max Turbo
Status # of Cores Base Cache
Name Date Frequency
Frequency
Intel®
16 MB
Core™
Intel®
i9- Launched Q2'19 8 5.00 GHz 2.40 GHz
Smart
9980HK
Cache
Processor
Intel® 16 MB
Core™ Intel®
Launched Q2'19 8 4.80 GHz 2.30 GHz
i9-9880H Smart
Processor Cache
Intel® 16 MB
Core™ Intel®
Launched Q2'19 8 4.40 GHz 2.10 GHz
i9-9900T Smart
Processor Cache
Intel®
16 MB
Core™
Intel®
i9- Launched Q4'19 8 5.00 GHz 4.00 GHz
Smart
9900KS
Cache
Processor
Amity School of Engineering & Technology
Amity School of Engineering & Technology
Amity School of Engineering & Technology

A Process is a isolated memory structure which supports an


application in OS hardware and software. A Windows Process
contains 1 or more Threads

A Thread is a stream of sequential machine-code instructions


that the processor executes. With the exception of Interrupts,
Any time the CPU runs an Instruction on behalf of an
application, it does so because a thread contained it. Threads
within a process may access the processes memory (to the
extent that the specific operation on the memory element is
"thread-safe" and doesn't present
unreconciled concurrency issues when more than one thread is
run simultaneously). An Application may speed its operation by
using multiple threads, each performing an isolated task by
running their stream of instructions through a different
CPU Execution unit (CPU/core/virtual core) simultaneously.
Amity School of Engineering & Technology

A Handle is a logical association with a shared resource like a


file, Window, memory location, etc. When a thread opens a file, it
establishes a "handle" to the file, and internally it acts like a
"name" for that instance of the file. Handles are used to link to
transitory or environmental resources outside the processes
memory structure.
Handles represent system resources like files, registry keys,
and threads. Threads: The number of active threads in
a process.
Amity School of Engineering & Technology

Cache Memory
• The development of caches and caching is one of the most
significant events in the history of computing. Virtually every
modern CPU core from ultra-low power chips like the ARM Cortex-
A5 to the highest-end Intel Core i9 use caches.
Amity School of Engineering & Technology

How Caching Works


• CPU caches are small pools of memory that store information
the CPU is most likely to need next. Which information is loaded
into cache depends on sophisticated algorithms and certain
assumptions about programming code. The goal of the cache system
is to ensure that the CPU has the next bit of data it will need already
loaded into cache by the time it goes looking for it (also called a
cache hit).
• A cache miss, on the other hand, means the CPU has to go
scampering off to find the data elsewhere. This is where the L2
cache comes into play — while it’s slower, it’s also much larger.
Some processors use an inclusive cache design (meaning data stored
in the L1 cache is also duplicated in the L2 cache) while others are
exclusive (meaning the two caches never share data). If data can’t be
found in the L2 cache, the CPU continues down the chain to L3
(typically still on-die), then L4 (if it exists) and main memory
(DRAM).
Amity School of Engineering & Technology

How Cache Design Impacts Performance


• The performance impact of adding a CPU cache is directly related to
its efficiency or hit rate; repeated cache misses can have a
catastrophic impact on CPU performance. The following example is
vastly simplified but should serve to illustrate the point.

• Imagine that a CPU has to load data from the L1 cache 100 times in
a row. The L1 cache has a 1ns access latency and a 100 percent hit
rate. It, therefore, takes our CPU 100 nanoseconds to perform this
operation.
Amity School of Engineering & Technology

• Now, assume the cache has a 99 percent hit rate, but the data the CPU
actually needs for its 100th access is sitting in L2, with a 10-cycle
(10ns) access latency. That means it takes the CPU 99 nanoseconds to
perform the first 99 reads and 10 nanoseconds to perform the 100th. A 1
percent reduction in hit rate has just slowed the CPU down by 10
percent.
• In the real world, an L1 cache typically has a hit rate between 95 and 97
percent, but the performance impact of those two values in our simple
example isn’t 2 percent — it’s 14 percent. Keep in mind, we’re
assuming the missed data is always sitting in the L2 cache. If the data
has been evicted from the cache and is sitting in main memory, with an
access latency of 80-120ns, the performance difference between a 95
and 97 percent hit rate could nearly double the total time needed to
execute the code.
Amity School of Engineering & Technology

What Happens When You Turn On Your Computer?

When you power on a computer, it goes through a “boot up”


process– a term that comes from the word “bootstrap.” Here’s
what’s happening in the background—whether you’re using a
Windows PC, Mac, or Linux system.
Amity School of Engineering & Technology

When you press the power button, the computer supplies


power to its components—the motherboard, CPU, hard
disks, solid state drives, graphics processors, and
everything else in the computer.

In the past, the PC loaded something called a BIOS


(Basic Input/Output System.) On modern PCs, the CPU
loads UEFI (Unified Extensible Firmware
Interface) firmware instead. This is a modern
replacement for the old-style BIOS. But, to avoid
confusion, some PC manufacturers still call their UEFI
software “BIOS” anyway.
Amity School of Engineering & Technology

The CPU runs the UEFI or BIOS, which tests and initializes
your system’s hardware—including the CPU itself. For
example, if your computer doesn’t have any RAM, it will
beep and show you an error, stopping the boot process.
This is known as the POST (Power On Self Test) process.

You may see the PC manufacturer’s logo appear on your


screen during this process, and you can often press a
button to access your BIOS or UEFI settings screen from
here. However, many modern PCs fly through this process
so fast that they don’t bother displaying a logo and require
accessing their UEFI setting screen from the Windows Boot
Options menu (Advanced options).
Amity School of Engineering & Technology
Amity School of Engineering & Technology

The UEFI or BIOS looks for a “boot device” to boot your


operating system from. This is usually your computer’s hard disk
or solid-state drive, but may also be a CD, DVD, USB drive, or
network location. The boot device is configurable from within the
UEFI or BIOS setup screen. If you have multiple boot devices,
the UEFI or BIOS attempts to hand off the startup process to
them in the order they’re listed. So, for example, if you have a
bootable DVD in your optical drive, the system might try starting
from that before it tries starting from your hard drive.
Amity School of Engineering & Technology

Traditionally, a BIOS looked at the MBR (master boot


record), a special boot sector at the beginning of a disk. The
MBR contains code that loads the rest of the operating
system, known as a “bootloader.” The BIOS executes the
bootloader, which takes it from there and begins booting the
actual operating system—Windows or Linux, for example.

The bootloader is a small program that has the large task


of booting the rest of the operating system. Windows uses
a bootloader named Windows Boot Manager
(Bootmgr.exe), most Linux systems use GRUB, and Macs
use something called boot.efi.
Amity School of Engineering & Technology

The OS loader loads essential hardware drivers that are


required to run the kernel—the core part of the Windows
operating system—and then launches the kernel. The kernel
then loads the system Registry into memory and also loads
any additional hardware drivers that are marked with
“BOOT_START,” which means they should be loaded at boot.
The Windows kernel then launches the session manager
process (Smss.exe), which starts the system session and
loads additional drivers. This process continues, and
Windows loads background services as well as the welcome
screen, which lets you sign in.
Amity School of Engineering & Technology

Definition
 An Operating System, or OS,
is software that enables a
user and application software
to interact with a computer’s
hardware and the data and
other programs stored on the
computer.
 An OS performs basic tasks,
such as recognizing input
from the keyboard, sending
output to the display screen,
keeping track of files and
directories on the disk, and
controlling peripheral devices
such as printers.
Amity School of Engineering & Technology

What is operating System?


An operating system is the primary software that
manages all the hardware and other software on a
computer. The operating system, also known as an “OS,”
interfaces with the computer’s hardware and provides
services that applications can use.

What is operating System in technical terms?

Operating systems also include a lot of software—things


like common system services(Program execution I/O operations
,File System manipulation, Communication Error Detection),
libraries (like .dll(dynamic link libraries) files), and application
programming interfaces (APIs) (Win32 API
) that developers can use to write programs that run on the
operating system.
Amity School of Engineering & Technology

Need for an OS
• The primary need for the OS arises from the fact that
user needs to be provided with services and OS ought to
facilitate the provisioning of these services.
• The central part of a computer system is a processing
engine called CPU. A system should make it possible for
a user’s application to use the processing unit.
• A user application would need to store information. The
OS makes memory available to an application when
required.
• Similarly, user applications need use of input facility to
communicate with the application. This is often in the
form of a key board, or a mouse or even a joy stick (if the
application is a game for instance).
Amity School of Engineering & Technology

• The output usually provided by a video monitor or a printer as some times the
user may wish to generate an output in the form of a printed document. Output
may be available in some other forms. For example it may be a video or an
audio file.
Let us consider few applications.
• Document Design
• Accounting
• E-mail
• Image processing
• Games
We notice that each of the above application requires resources for
• Processing information
• Storage of Information
• Mechanism to inputting information
• Provision for outputting information
These service facilities are provided by an operating system regardless of the nature
of application.
Amity School of Engineering & Technology

• The OS offers generic services to support all the


above operations. These operations in turn
facilitate the applications.
• To that extent an OS operation is application
neutral and service specific.
Amity School of Engineering & Technology

Other Services
 Program Execution
OS provides an environment where the user can conveniently run
programs. The user does not have to worry about memory allocation
or CPU scheduling. 

 I/O Operations
Each program requires input and produces output. The OS hides
some of the details of the underlying hardware for such I/O. All the
user sees is that the I/O has been performed, without those details.  

 Communications
There are instances where processes need to communicate with
each other to exchange information. It may be between processes
running on the same computer or running on different computers.
The OS provides these services to application programs, making
inter-process communication possible, and relieving the user of
having to worry about how this accomplished.
Amity School of Engineering & Technology

Application programs and OS


 Operating systems provide a software platform on top of which other
programs, called application programs, can run.

 The choice of operating system, therefore, determines to a great


extent the applications a user can run.

 For example, the DOS operating system contains commands such


as COPY and RENAME for copying files and changing the names of
files, respectively. The commands are accepted and executed by a
part of the operating system.

 Similarly, the UNIX operating system has commands like CP and


MV to copy and rename.
Amity School of Engineering & Technology

User and System View:


• From the user point of view the primary consideration is always the
convenience. It should be easy to use an application. In launching an
application, it helps to have an icon which gives a clue which application it
is. We have seen some helpful clues for launching a browser, e-mail or
even a document preparation application.
• In other words, the human computer interface which helps to identify an
application and its launch is very useful. This hides a lot of details of the
more elementary instructions that help in selecting the application.
Similarly, if we examine the programs that help us in using input devices
like a key board – all the complex details of character reading program are
hidden from the user. The same is true when we write a program. For
instance, when we use a programming language like C, a printf command
helps to generate the desired form of output. The following figure
essentially depicts the basic schema of the use of OS from a user stand
point.
Amity School of Engineering & Technology

UNIX
 UNIX was one of the first operating systems to
be written, in 1971.

 Advantages of UNIX are…

 Multitasking – multiple programs can run at one


time.

 Multi-user – allows more than a single user to


work at any given time. This is accomplished by
sharing processing time between each user.

 Safe – prevents one program from accessing


memory or storage space allocated to another
program, and enables file protection, requiring
users to have permission to perform certain
functions, such as accessing a directory, file, or
disk drive.

You might also like