overview of computers Flashcards
computers
Machines which receive, store, process, and output information can deal with data of all kinds :numbers, text, images, graphics, and sound.
hardware
is the equipment used to perform the necessary computations which includes: the central processing unit (CPU),Memory, monitor, keyboard, mouse, printer, and speakers.
software
consists of the programs that enable us to solve problems with a computer by providing it with lists of instructions to perform.
hardware: components of a computer
cpu: central processing unit main memory secondary storage input devices output devices
how is communication done in the memory
done using three busses
1-Data Bus (To read/write the actual data).
2- Address Bus (to identify the exact memory cell to read or write).
3-Control Bus (to control if I want to read or write).
content of the cell
the data stored in a memory cell
memory definition
1000 memory Cells.
A memory cell is a grouping of smaller units called bytes
A byte is composed of even smaller units of storage called bits.
The term bit , derived from the words binary digit, is the smallest element a computer can deal with.
numbering system
A numbering system is a systematic method for representing numbers using a particular set of symbols.
binary system
Binary refers to a number system based on two numbers, 0 and 1, so a bit is either a 0 or a 1
Generally, there are 8 bits to a byte.
main memory
Stores programs, data, and results.
types of main memory
Random access memory (RAM): Temporary storage of programs and data.
Usually volatile memory : which means that everything in RAM will be lost when the computer is switched off.
Read-only memory (ROM):
Stores programs or data permanently. Not volatile: the data stored there do not disappear when the computer is switched off.
cpu
central processing unit
ROLES: has 2 roles (coordinating all computer operations. performing arithmetic and logical operations on data.)
USAGE: (Follows the instructions contained in a computer program to determine which operations should be carried out and in what order.)
fetching
a technique used by the cpu to retrieve each instruction in sequence
registers
Register memory is the smallest and fastest memory in a computer. It is not a part of the main memory and is located in the CPU in the form of registers
CPU’s current instruction and data values are stored temporarily inside the CPU in special high-speed memory locations
machine cycle
1: fetch instructions from memory from main memory by the cpu
2: decode instructions into commands in the cpu
3: excute all commands in the ALU (arithmetic logic unit)
4: store results in memory
operating system
It is the software that is responsible for directing all computer operations and managing all computer resources.
eg: ubuntu
ALU
arithmetic logic unit (ALU), a memory unit, and input/output (I/O) controllers. The ALU performs simple addition, subtraction, multiplication, division, and logic operations, such as OR and AND.
memory cell
The memory cell is the fundamental building block of computer memory. The memory cell is an electronic circuit that stores one bit of binary information and it must be set to store a logic 1 and reset to store a logic 0. Its value is maintained/stored until it is changed by the set/reset process
computer languages
Developing new software requires writing lists of instructions for a computer to execute.
** The Computer only understand machine language ( Machine language is a collection of binary numbers.)
** Software developers rarely write in the machine language // Another drawback of machine language is that it is not standardized.
There is a different machine language for every type of CPU.
Assembly language is more readable.
assembly
A language in which computer operations are represented by mnemonic codes rather than binary numbers.
Variables can be given names rather than binary memory addresses.
Each assembly language instruction corresponds to exactly one machine instruction.
high level langues
used: To write programs that are independent of the CPU.
** Combine algebraic expressions and symbols taken from English.
It is easier to express problem solutions in high-level languages.
compiler
because computers do not understand high level languages, we compile the high level language before executing the program to translate the languages into the target computer machine languages
the program that does this process is called a compiler
pwd
(print working directory)
command displays the full pathname of the current working directory.
ls
(list)
command lists all files and folders in your current working directory.
mkdir
(make directory)
command allows you to create a new directory. You can specify where you want the directory created –if you do not do so, it will be created in your current working directory.
cd
(change director)
command used to change the current working directory.
gedit
Text Editor (gedit) To create or open (if exists) a specific file
gedit
Text Editor (gedit) To create or open (if exists) a specific file
cat
It is used to display the content of a file in the Terminal, starting from the first row and finishing on its last row.
cp
(copy)
command allows you to copy a file. You should specify both files: the file that you want to be copied and the location that you want it copied to.
rm
(remove)
command removes the specified file.
main function
Every C program has a main function. The parentheses following the word “main” indicate that it is a function. after main function execution begins
printf()
used to print anything is written between quotation marks “ ” onto the screen.
This function is defined in the standard input/output file “stdio.h”, which is a header file in C language.
semicolon in c
end of statement
include
Tells the compiler where to find the meaning of printf() function.
It is called preprocessor directive.
return statement
The return statement transfers control from a function back to the activator of the function.
For function main , control is transferred back to the operating system.
reserved words
Appear in lowercase, Have special meaning, Cannot be used for other purposes
standard identifiers
Have special meaning, Can be redefined and used by programmer (not recommended),Examples : printf, scanf
User-Defined Identifiers
Constants
Variables
Syntax Rules:
1) An identifier must consist only of letters, digits, and underscores
2) An identifier cannot begin with a digit
3) A C reserved word cannot be used as an identifier
4) An identifier defined in a C standard library should not be redefined
Program outline
Preprocessor Dircetives int main() { Function body }
Code Compilation
gccsourceFile.c–o outputFile
gcc: is the name of the compiler.
sourceFile.c: is the name of your c file.
-o: the name after it will be the executable output file name.
outputFile: you can choose your output file name.