0% found this document useful (0 votes)
8 views

1 - Components of A Computer

Uploaded by

sc23meb0a10
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

1 - Components of A Computer

Uploaded by

sc23meb0a10
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

1

CS131 – Problem Solving and Computer Programming


Class 1

G.R.K.Gupta
COMPONENTS OF A
COMPUTER
A computer is a complex system made up of various
interconnected components, each serving a specific function.
These components work together to perform tasks and process
data. Here are the key components of a typical computer:
Central Processing Unit (CPU)
The data that the input unit accepts goes to the processing unit
before execution. This unit understands what the command
actually is and how they can achieve it. It converts data
accepted in human language into machine language for
computers to understand. It has a mainboard with a central chip
which is the primary part of the processor.

The processor coordinates with both input and output devices to


make things done. It has three main components –
a. Memory Unit
This component of the CPU deals with strong data. When the data reaches the
processor from the input devices, the memory unit saves it immediately. It has some
pre-existing programs which help in transmitting the data to the other parts of the
CPU. Similarly, the completion of a task by output device is also saved here before
it reaches the user. The processor cannot process the data unless the memory unit
saves it.
This is where all the information becomes accessible for the user. It uses bits
and bytes to measure data size. The memory unit further divides into primary and
secondary storage units.
The primary memory is internal and temporary. RAM is the primary memory
in this case. It stores the commands for a short time and is volatile in nature.
The secondary storage is non-volatile and permanent. But not directly accessible.
The data needs to transfer to the primary unit and then the processor can access it.
Functions of Memory Unit In Computer
•Responsible for storing data coming from input devices.
•Storing the result data coming from output devices.
•Storing all the steps that the system goes through while task
execution.
b. Control Unit
This unit is to manage the computer device functioning and is the central
component of the processor unit. Once the data is in the memory, it processes it
for further execution. It is where the data conversion from human language to
machine language takes place. It interprets the signal and sends it over to the
output unit. Once the result is out, it retrieves the data again and presents it to
the user.
Functions of Control Unit in Computer
•Coordinate information transfer between the memory and I/O devices.
•Converts the instruction into machine language.
•It decodes the instruction and sends it to the correct device.
•Prepare a data sequence making it easier for processing.
•Maintains a flow of data inside the system.
•Transfer the commands/issues to the arithmetic and logic unit.
c. Arithmetic & Logical Unit (ALU)
This unit of processor takes care of mathematical calculations and issues that the
computer system faces while functioning. It is also useful for data comparison and
actions including decision making. It has features to facilitate different mathematical
solutions like addition, subtraction, multiplication, etc.
ALU gets the data from the memory in the form of registers. These registers are for a
memory address, data manipulation, and processing. They may have distinctive
features sometimes. The ALU performs the calculation only when needed and then
sends it to the output devices.
Functions of ALU in Computer
•Responsible for all calculations and mathematical issues.
•Allows the computer to compare data easily.
•Enables the data transfer between primary and secondary memory by decoding it.
•Acts as a decision-maker in case of any trouble.
Central Processing Unit (CPU):

• The CPU is the "brain" of the computer, responsible for


executing instructions and performing calculations.
• It fetches, decodes, and executes instructions from
programs and manages data processing.
Memory (RAM - Random Access Memory):

• RAM is a volatile form of memory that stores data and


instructions that the CPU needs while actively running
programs.
• It allows for quick access to data, improving the computer's
overall performance.
Storage Devices
• Hard Disk Drive (HDD):
• HDDs are traditional storage devices that use spinning
disks to store data magnetically.
• Solid State Drive (SSD):
• SSDs are faster and more durable than HDDs, using flash
memory to store data.
• Optical Drives (e.g., CD/DVD drives):
• These are used for reading and writing optical discs.
Motherboard

• The motherboard is the main circuit board of the computer,


providing physical connections and pathways for data
transfer between components.
• It houses the CPU, RAM slots, expansion slots, and
connectors for various peripherals.
Power Supply Unit (PSU):

• The PSU converts electrical energy from the power outlet


into the appropriate voltage and current needed to power
the computer's components.
• It distributes power to different parts of the computer.
Input Unit of Computer System
The computer system responds to the instruction it receives from the users.
And to get those instructions, a computer needs an input unit. This includes all
the input devices responsible for reading the data entered by the user.

The system doesn’t respond unless it receives a command from the user using
the input unit or the input devices. The users use numbers, letters, images, etc.
to enter the command, the input devices are the ones accepting them. For
example – we use a keyboard to enter a text, the keyboard here becomes the
input unit.
Functions of Input Unit of a Computer System
•Takes in user commands in the form of data.
•Converts data in a digital language format.
•Sends over the data to the processing unit for the next step.

Examples of Input Unit


•Keyboard
•Mouse
•JoyStick
•Light pen
•Track Ball
•Scanner
•Graphic Tablet
Input Devices

• Keyboard: Used for entering text and commands.


• Mouse or Touchpad: Used for pointing, clicking, and
navigating on the screen.
• Other Input Devices: Examples include graphics tablets,
joysticks, and game controllers.
Output Unit of Computer System
The user, when sending a set of instructions to the computer,
reaches the output device in the end. The execution of command takes
place here and the users get their results.
The processor sends the transcripted instructions to the output
devices for execution. These devices always have a connection to the
system and thus the coordination is quite easy.
The monitor is one of the main output devices which displays the
results to the user. Everything that the input devices receive, reaches
the output devices eventually. All the execution activities take place
inside the mechanism of a device.
Functions of Output Unit of Computer
•Receives the instructions in machine language to execute a task.
•Coordinates with the processor to get the instruction on time.
•Converts the machine language back into a user-friendly one by completing tasks.
•It is the medium by which users understand that their demands are met by the
system.
Examples of Output Unit of a Computer
•Monitor – variants
•Printers – all types
•Plotters
•Projector
•LCD Projection Panels
•Computer Output Microfilm
•Speaker
•Headphones
•Ear Plugs
Output Devices

• Monitor: Displays visual output, including text, images,


and videos.
• Speakers or Headphones: Provide audio output.
• Printers and Scanners: Used for creating physical copies
of documents and digitizing printed material.
Expansion Slots and Ports

• Expansion slots allow users to add additional hardware


components like graphics cards, sound cards, and
network adapters.
• Ports (e.g., USB, HDMI, Ethernet) provide connections
for external devices and peripherals.
Graphics Processing Unit (GPU)

• The GPU is responsible for rendering images


and videos, making it crucial for gaming and
graphical applications.
• In some systems, the CPU may include
integrated graphics, while others have
dedicated GPUs.
Cooling System:
• Computers generate heat during operation, and a cooling system (fans,
heat sinks, liquid cooling) prevents components from overheating.
Operating System (OS):
• The OS is software that manages hardware resources and provides a
user interface for running applications.
• Common examples include Windows, macOS, Linux, and various
mobile OSs.
Software:
• Software includes applications, programs, and data that users interact
with on the computer.
• Operating systems, word processors, web browsers, and games are
examples of software.
These components work together to enable a computer to
process information, run software applications, and perform
various tasks. The combination of hardware and software
defines the capabilities and functionality of a computer
system.
Evolution of Operating Systems
• Batch processing
• Do only one job or task at a time
• Operating systems
• Manage transitions between jobs
• Increased throughput
• Amount of work computers process
• Multiprogramming
• Computer resources are shared by many jobs or tasks
• Timesharing
• Computer runs a small portion of one user’s job then moves on to service the
next user

31
Personal Computing, Distributed Computing,
and Client/Server Computing
• Personal computers
• Economical enough for individual
• Distributed computing
• Computing distributed over networks
• Client/server computing
• Sharing of information across computer networks between file servers and
clients (personal computers)

32
Machine Languages, Assembly Languages,
and High-level Languages
Three types of programming languages
1. Machine languages
• Strings of numbers giving machine specific instructions
• Example:
+1300042774
+1400593419
+1200274027
2. Assembly languages
• English-like abbreviations representing elementary computer operations (translated via
assemblers)
• Example:
LOAD BASEPAY
ADD OVERPAY
STORE GROSSPAY

33
Machine Languages, Assembly Languages,
and High-level Languages
Three types of programming languages (continued)
3. High-level languages
• Codes similar to everyday English
• Use mathematical notations (translated via compilers)
• Example:
grossPay = basePay + overTimePay

34
History of C
•C
• Evolved by Ritchie from two previous programming languages, BCPL and B
• Used to develop UNIX
• Used to write modern operating systems
• Hardware independent (portable)
• By late 1970's C had evolved to "Traditional C"
• Standardization
• Many slight variations of C existed, and were incompatible
• Committee formed to create a "unambiguous, machine-independent"
definition
• Standard created in 1989, updated in 1999

35
The C++ Standard Library
• C++ programs consist of pieces/modules called functions
• A programmer can create his own functions
• Advantage: the programmer knows exactly how it works
• Disadvantage: time consuming
• Programmers will often use the C++ library functions
• Use these as building blocks
• Avoid re-inventing the wheel
• If a premade function exists, generally best to use it rather than write your own
• Library functions carefully written, efficient, and portable

36
Other High-level Languages
• Other high-level languages
• FORTRAN
• Used for scientific and engineering applications
• COBOL
• Used to manipulate large amounts of data
• Pascal
• Intended for academic use

37
1.13 Structured Programming
• Structured programming
• Disciplined approach to writing programs
• Clear, easy to test and debug and easy to modify
• Multitasking
• Specifying that many activities run in parallel

38
Code for getting Table of a given number
#include <iostream>
int main()
{
using namespace std;
int num, limit;
// Get the number from the user
cout << "Enter a number: ";
cin >> num;
// Get the limit for the multiplication table
cout << "Enter the limit for the table: ";
cin >> limit;
// Print the multiplication table
cout << "Multiplication table for " << num << " up to " << limit << ":\n";
for (int i = 1; i <= limit; ++i)
{
cout << num << " x " << i << " = " << num * i << "\n";
}
return 0;
}
Hello world code
#include<iostream>
using namespace std;
int main()
{

cout << "HelloWorld!" << endl;


return 0;

}
#include <iostream>
int main()
{
using namespace std;
int num, limit;
// Get the number from the user
cout << "Enter a number: ";
cin >> num;
// Get the limit for the multiplication table
cout << "Enter the limit for the table: ";
cin >> limit;
// Print the multiplication table
cout << "Multiplication table for " << num << " up to " << limit << ":\n";
for (int i = 1; i <= limit; ++i)
{
cout << num << " x " << i << " = " << num * i << "\n";
}
return 0;

You might also like