Unit 1 Introduction To Programming
Unit 1 Introduction To Programming
Unit 1 Introduction To Programming
(disks, memory, processor, where a program is stored and executed, operating system,
compilers etc.)
What is programming?
The process or activity of writing computer programs.
Programming involves creating code that Programmers can enter into a computer,
application, or software program. This code instructs the device how to perform.
1. Central Processing Unit [Control Unit, Memory Unit and ALU Unit]
2. Input Unit
3. Output Unit.
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.
Output Unit :
The output unit consists of output devices that are attached to the computer. It converts the
binary data coming from the CPU to human understandable form. The common output devices
are monitor, printer, plotter, etc.
Central Processing Unit
The Central Processing Unit (CPU) is called "the brain of computer" as it controls operation of all
parts of computer. It consists of following components :
Data entered into computer is sent to RAM, from where it is then sent to ALU, where rest of data
processing takes place. All types of processing, such as comparisons, decision-making and
processing of non-numeric information takes place here and once again data is moved to RAM.
Arithmetic calculations include addition, subtraction, multiplication and division. Logical decisions
involve the comparison of two data items to see which one is larger or smaller or equal.
Control Unit
As name indicates, this part of CPU extracts instructions, performs execution, maintains and
directs operations of entire system.
1. Fetch
2. Decode
3. Execute
4. Write back
Control unit performs following functions −
Memory Unit
This is unit in which data and instructions given to computer as well as results given by computer
are stored. Unit of memory is "Byte". Memory attached to the CPU is used for the storage of data
and instructions, and is called internal memory
1 Byte = 8 Bits
What is Disk?
Alternatively known as a diskette, a disk is a hard or floppy round, flat, and magnetic platter
capable of having information read from and written to it.
Types of disks
There are two basic types of disks in the computer hardware realm:
1. Magnetic disks
2. Optical disks.
Magnetic Disks:
Description:
Composition: Magnetic disks, also known as hard disk drives (HDDs), consist of one or more
magnetic platters coated with a ferrous material.
Read/Write Mechanism: Data is stored on the surface of these platters in binary form (0s and
1s) using a magnetic read/write head.
Speed: Typically have faster data access speeds compared to optical disks.
Capacity: Generally offer higher storage capacities compared to optical disks.
Durability: More susceptible to physical damage due to their mechanical parts and sensitive
platter surfaces.
Optical Disks:
Description:
Composition: Optical disks include various types like CD (Compact Disc), DVD (Digital
Versatile Disc), and Blu-ray.
Read/Write Mechanism: Data is read and written using a laser beam. Pits and lands on the
disk surface represent binary data.
Speed: Generally slower in terms of data access compared to magnetic disks.
Capacity: Typically have lower storage capacities compared to magnetic disks.
Durability: More resistant to physical damage compared to magnetic disks.
Magnetic disks are more commonly used for primary storage and active data access due to their
higher capacities and faster speeds.
Optical disks are often used for distribution and archival purposes, especially when a write-once,
read-many (WORM) model is desired.
In modern computing, solid-state drives (SSDs) have become increasingly popular, offering
benefits like faster data access speeds, durability, and efficiency, while overcoming some
limitations of traditional magnetic disks.
Hard Drives
Floppy Drives
CD-ROM
CD-R
CD-RW
DVD-ROM
DVD-R
DVD+R
DVD-RW
Blue Ray
Removable Drives
HARD DRIVES
These are also called 'fixed disks' in ancient computerese because the storage media is mounted
within the computer and not intended to be removed.
Hard drives consist of one or more metal platters stacked together on a single spindle. Multiple
read/write heads (one for the top and bottom of each platter) float next to the surface of the
drive. Hard Disk drive capacities are determined by the number of cylinders and blocks per
cylinder a drive will support.
FLOPPY DRIVES
Named for the media disks that could be pulled out and that would 'flop' when carried. These
disks are designed to allow users to store data to a disk, remove it and carry the data elsewhere.
These typically come in one of two formats in the United States: 3.5" @1.44Mbytes and 5.25" at
1.22 Mbytes. There are a few proprietary types as well, such as Zip drives, DAT tapes etc.
CD-ROM
Compact Disk Read Only Memory or CD-ROMs are shiny circular pieces of plastic with a hole in
the middle. These look like audio compact disks and computer software and data are stored on
them. They are read using a powerful (red) light-emitting diode (LED) that is sometimes called a
'laser' and thus the name 'laser disk'. Compact Disk media is made of pressed layers of plastic and
can store about 640 MB of data.
DVD-ROM
Digital Video Disks were first used to store movies for playback on compact players.
Blu-Ray
The latest development in data storage and movie disks is Blu-Ray, so called because it uses a
blue LED (sometimes called a laser, which is actually something entirely different) to read/write
from the disk.
REMOVEABLE DRIVES
These are drives where the drive itself can be removed or ported elsewhere. The media is usually
not pulled out. Removable hard drives are a good example of these.
Memory
Memory in computers refers to the electronic components used to store and retrieve data for
processing. There are two primary types of memory in a computer system:
Description: RAM is volatile memory used by the computer to store and quickly retrieve data
that the CPU is actively using or processing.
Functionality: It provides fast access to data and instructions, enabling the CPU to perform
operations quickly. However, its contents are lost when the computer is powered off.
Types: Different types of RAM include DRAM (Dynamic RAM) and SRAM (Static RAM).
Description: Secondary memory refers to non-volatile storage devices that retain data even
when the computer is turned off.
Functionality: It is used for long-term storage of data, applications, and the operating system.
Unlike RAM, it retains data even during power cycles.
Types: Common types of secondary memory include Hard Disk Drives (HDDs), Solid State
Drives (SSDs), optical disks (CDs, DVDs, Blu-rays), and USB drives.
Key Points:
Characteristics:
Uses:
Characteristics:
Uses:
Characteristics:
Uses:
Virtual Memory:
Description:
Functionality:
Every computer system must have at least one operating system to run other programs.
Applications like Browsers, MS Office, Notepad Games, etc., need some environment to run
and perform its tasks.
It provides a set of services and functionalities that allow users to interact with the hardware
and run applications.
Single-User Single-Tasking: Operating system allows a single user to execute one program at a
particular time. This operating system is designed especially for wireless phones and two-way
messaging. Some functions such as printing a document, and downloading images and videos are
performed in one given frame.
MS-DOS
MS-DOS which is short for Microsoft Disk Operating System is a non-graphical command line
operating system developed for IBM compatible computers with x86 microprocessor. The
operating system used a command line interface for the user to input commands to navigate,
open and manipulate files on their computer.
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:
Single-User Multi-Tasking: Operating system allows a single user to execute multiple programs
at the same time, the single user can perform multiple tasks at a time. This type of operating
system is found on personal desktops and laptops. The most popular single-user multi-tasking is
Microsoft windows. This single-user multi-tasking can be pre-emptive or cooperative.
Example: Windows
Windows is an operating system designed by Microsoft to be used on a standard x86 Intel and
AMD processors. It provides an interface, known as a graphical user interface(GUI) which
eliminates the need to memorize commands for the command line by using a mouse to navigate
through menus, dialog boxes, buttons, tabs, and icons. The operating system was named
windows since the programs are displayed in the shape of a square. This Windows operating
system has been designed for both a novice user just using at home as well as for professionals
who are into development.
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.
2. Multi-User Operating System
In a multiuser operating system, multiple numbers of users can access different resources of a
computer at the same time. The access is provided using a network that consists of various
personal computers attached to a mainframe computer system. A multi-user operating system
allows the permission of multiple users for accessing a single machine at a time. The various
personal computers can send and receive information to the mainframe computer system. Thus,
the mainframe computer acts as the server and other personal computers act as clients for that
server.
1. Distributed System: The distributed operating system also known as distributed computing is
a collection of multiple computers located on different computers. Communicate and coordinate
their actions by passing messages to one another from any system.
2. Time sliced system: It is the system where each user talk is allocated to a short span of cpu
time. A small time duration is allotted to every task. CPU time is divided into small time slices, and
one time is assigned to each other.
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.
Compilers in c
There are several C compilers available, catering to different platforms and development
environments. Here's a list of some popular C compilers:
2. Clang:
5. TinyCC (TCC):
7. Pelles C:
A complete development environment for Windows.
Includes an integrated development environment (IDE) along with the compiler.
Command to compile a C program: Use the Pelles C IDE.
8. Cygwin: