COS 132 Chapter 1
COS 132
CHAPTER 1 – INTRO TO COMPUTERS AND PROGRAMMING
UNTI 1.1- WHY PROGRAM
Program = set of instructions that a comp follows to perform a task.
- Commonly referred to as software
Few things that must be designed for any real-world comp program
- Logical flow of instructions
- Mathematical procedures
- Appearance of screens
- Way info is presented to the user
- Programs user-friendliness
- Documentation, help files, tutorials etc.
UNIT 1.2 – HARDWARE AND SOFTWARE
HARDWARE
= physical components of which a comp is made.
- CPU
- Main memory
- Secondary storage devices
- Input devices
- Output devices
THE CPU
The CPU is the part of the comp that actually runs programs, most important component of the comp, known as
microprocessors.
In the earliest comps, CPUs were huge devices made of electrical and mechanical components such as vacuum tubes and
switches – the ENIAC computer
Consists of two parts:
1. Control Unit
- Coordinates all of the comps operations
- Responsible for determining where to get the next instruction and regulating the other major components of
the comp w control signals
2. Arithmetic and Logic Unit
- Designed to perform mathematical operations
1|P a g e
, COS 132 Chapter 1
When a program (sequence of instructions stored in comps memory) runs, the CPU is engaged in a process known as the
fetch/decode/execute cycle
Fetch the CPUs control unit fetches from main memory the next instruction in the sequence of program
instructions
Decode the instruction is encoded in the form of a number, the Control Unit decodes the instruction and
generates an electronic signal
Execute the signal is routed to the appropriate component of the comp, and it will cause the component to
perform an action
MAIN MEMORY // RAM
= where the comp stores a program while the program is running as well as the data with which the program is working.
CPU is able to quickly access data stored at any random location in RAM, it is usually a volatile type of memory that is
only used for temporary storage when a program is running.
A comps memory is divided into tiny storage locations known as bytes, each byte is divided further into eight smaller
storage locations known as bits. The term bit stands for binary digit. Bits are tiny electrical components that can hold
either a positive or a negative charge.
Each byte is assigned a unique number known as an address, which are all ordered from lowest to highest. Bytes are
identified by their address.
SECONDARY STORAGE
= type of memory that can hold data for long periods of time, even without a power source.
Programs are usually stored in secondary memory and loaded into main memory when needed.
Most common type -> disk drive
- A traditional disk drive stores data by magnetically encoding it onto a circular disk
- Solid state drives have no moving parts and operate faster than a traditional disk drive
- External storage devices (usb, - universal serial bus, SD – secure digital) are smaller devices that appear in the
system as disk drives
- Optical drives (CD, DVD)
INPUT DEVICES
= device that collects information and sends it to the computer
Keyboard, mouse, touchscreen, USB etc.
OUTPUT DEVICES
= information that is sent to a device, which will format it and present it.
2|P a g e
COS 132
CHAPTER 1 – INTRO TO COMPUTERS AND PROGRAMMING
UNTI 1.1- WHY PROGRAM
Program = set of instructions that a comp follows to perform a task.
- Commonly referred to as software
Few things that must be designed for any real-world comp program
- Logical flow of instructions
- Mathematical procedures
- Appearance of screens
- Way info is presented to the user
- Programs user-friendliness
- Documentation, help files, tutorials etc.
UNIT 1.2 – HARDWARE AND SOFTWARE
HARDWARE
= physical components of which a comp is made.
- CPU
- Main memory
- Secondary storage devices
- Input devices
- Output devices
THE CPU
The CPU is the part of the comp that actually runs programs, most important component of the comp, known as
microprocessors.
In the earliest comps, CPUs were huge devices made of electrical and mechanical components such as vacuum tubes and
switches – the ENIAC computer
Consists of two parts:
1. Control Unit
- Coordinates all of the comps operations
- Responsible for determining where to get the next instruction and regulating the other major components of
the comp w control signals
2. Arithmetic and Logic Unit
- Designed to perform mathematical operations
1|P a g e
, COS 132 Chapter 1
When a program (sequence of instructions stored in comps memory) runs, the CPU is engaged in a process known as the
fetch/decode/execute cycle
Fetch the CPUs control unit fetches from main memory the next instruction in the sequence of program
instructions
Decode the instruction is encoded in the form of a number, the Control Unit decodes the instruction and
generates an electronic signal
Execute the signal is routed to the appropriate component of the comp, and it will cause the component to
perform an action
MAIN MEMORY // RAM
= where the comp stores a program while the program is running as well as the data with which the program is working.
CPU is able to quickly access data stored at any random location in RAM, it is usually a volatile type of memory that is
only used for temporary storage when a program is running.
A comps memory is divided into tiny storage locations known as bytes, each byte is divided further into eight smaller
storage locations known as bits. The term bit stands for binary digit. Bits are tiny electrical components that can hold
either a positive or a negative charge.
Each byte is assigned a unique number known as an address, which are all ordered from lowest to highest. Bytes are
identified by their address.
SECONDARY STORAGE
= type of memory that can hold data for long periods of time, even without a power source.
Programs are usually stored in secondary memory and loaded into main memory when needed.
Most common type -> disk drive
- A traditional disk drive stores data by magnetically encoding it onto a circular disk
- Solid state drives have no moving parts and operate faster than a traditional disk drive
- External storage devices (usb, - universal serial bus, SD – secure digital) are smaller devices that appear in the
system as disk drives
- Optical drives (CD, DVD)
INPUT DEVICES
= device that collects information and sends it to the computer
Keyboard, mouse, touchscreen, USB etc.
OUTPUT DEVICES
= information that is sent to a device, which will format it and present it.
2|P a g e