Cours Computer Science 1
Cours Computer Science 1
Computer Science 1
This course is intended for first-year students specializing in material Sciences. The main objective of this
module is to learn the basic concepts of computer science (presenting the main units of a computer and
explaining their functioning as well as the principles of their use) which will be presented in Part 1: Office
Automation & Web Technology, and understanding the concept of algorithms, learning the methods of its
In the second chapter, computer components will be detailed. Specifically, we will identify and define the role of
each of these components. This chapter will be concluded by explaining how a computer works according to the
principles of the Von Neumann machine.
Chapter 3 focuses on Operating Systems, or how to make computer components usable for the user. We will also
introduce some known types of OS.
1- Introduction
2- A Brief Historical Overview of Calculating Machines
2.1. Abacus
2.2. Slide rule
2.3. First mechanical calculators
2.4. First programmable machines
2.5. Generations of Computers
3- Definitions
3.1 Computer science
3.2 Computer
4- Types of computers
5- Numeral systems
7- Coding
For centuries, humans have created and used various means and tools of calculation to improve the speed and accuracy of numerical
calculations. However, it was in the 20th century after World War II that a great technological advance was made in the field of
electronics, paving the way for the creation of programmable electronic machines (later called computers) and the birth of computer
science.
Computer science is currently undergoing an extremely rapid evolution, due to the miniaturization and reduction of production costs
of electronic components and the intensive development of programs and software for various applications. It can be seen that
computer science is now everywhere. In a few years, this technique has established itself in all areas without exception
(administration, industry, economy, medicine, games and leisure, in households, ...).
1
2- A Brief Historical Overview of Calculating Machines
Exploring the evolution of computing, we will center our attention on significant dates commonly mentioned in the context of
human-made calculating instruments.
2.1 Abacus
The abacus, invented in China a few centuries before Christ, was the first mechanical calculating instrument. It consists of a
rectangular frame with rods on which beads slide. It is used to perform calculations: addition, subtraction, multiplication, division.
Figure 1: Abacus
2
2- A Brief Historical Overview of Calculating Machines
3
2- A Brief Historical Overview of Calculating Machines
4
2- A Brief Historical Overview of Calculating Machines
5
3- Definitions
3.2 Computer
A computer is an automatic information processing machine (in binary form) under the control of recorded programs. It can:
Acquire and store information,
Perform data processing received as input,
And output it in another form. Different types of data processed include texts, images, sounds, numbers, etc
6
4- Types of computers
7
4- Types of computers
4.3 PC tablets
Consists of a case incorporating a touch screen as well as a number of built-in peripherals..
4.4 Media center
Is a hardware and software system providing the following multimedia services:
• Reading multimedia files (image, sound, video);
• Broadcasting of these files;
• Listening to and recording radio or television broadcasts;
Digital, satellite, analog television;
Smartphone or intelligent phone: is an advanced mobile phone with the functions of a personal digital assistant, a digital camera,
and a laptop computer. Data entry is usually done through a touch screen or, less commonly, a keyboard or stylus
Smartphones
PC tablet Media center
The binary system represents the language of computers today, and is the basis used in computing for the representation of
information at the machine level.
• A numbering system is a set of rules for representing numbers using signs or digits. The following are the main numbering
systems used:
- The binary numbering system exclusively uses the two digits 0 and 1 (which are then called "bits" - binary digits).
- The octal numbering system uses the eight digits 0, 1, 2, 3, 4, 5, 6, 7.
- The decimal numbering system is the most well-known, using the ten digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
- The hexadecimal numbering system uses the sixteen digits0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
Base in numbring system
The base in a numbering system is the number of elements used by the system. The base "n" uses "n" digits ranging from 0 to n-1: {0,
1, 2...n-1}. Examples:
Base 2 uses two digits {0,1}.
Base 10 uses ten digits {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}.
9
5- Numeral systems
Exemple
• 𝑁1 = 18079 10 , where 𝑁1 is a number represented in the decimal system (𝑏=10) and [ 𝑎4 =1, 𝑎3 =8, 𝑎2 =0, 𝑎1 =7, 𝑎0 =9 ], the values
𝑎𝑖 < 𝑏.
• 𝑁2 = 1011001 2 , where 𝑁2 is a number represented in the Binaire system (𝑏=2) and [𝑎6 =1, 𝑎5 =0 𝑎4 =1, 𝑎3 =1, 𝑎2 =0, 𝑎1 =0, 𝑎0 =1
], the values 𝑎𝑖 < 𝑏.
• 𝑁3 = 756 8 , where 𝑁3 is a number represented in the Octal system (𝑏=8) and [𝑎2 =7, 𝑎1 =5, 𝑎0 =6 ], the values 𝑎𝑖 < 𝑏.
• 𝑁4 = 𝐴𝐵129 16 , where 𝑁4 is a number represented in the Hexadécimal system (𝑏=16) and [𝑎4 =A, 𝑎3 =B, 𝑎2 =1, 𝑎1 =2, 𝑎0 =9 ], the
values 𝑎𝑖 < 𝑏.
In a numeral system with base b, the general formula for representing a number N is as follows:
Result = 0, so Stop
X= 115 10 = 1110011 2
11
5- Numeral systems
To pass from numeral system to another, we will apply the general formula
We consider the following number : N= 1011 2 , the number N is written in binary b=2
𝒂𝟑 𝒂𝟐 𝒂𝟏 𝒂𝟎
1 0 1 1
3 2 1 O 𝒊 Weight of numbers
A decimal number is made up of an integer part and a fractional part after the decimal point. we must manipulate values which have a
non-zero fractional part (example real number), we always use the same numbering system (the same formula *), adding the negative
powers. In base B, this number X is written as follows:
𝒏
(𝑿) 𝑩 = 𝒂𝒊 𝑩𝒊 = 𝒂𝒏 𝑩𝒏 + 𝒂𝒏−𝟏 𝑩𝒏−𝟏 + ⋯ + 𝒂𝟏 𝑩𝟏 + 𝒂𝟎 , 𝒃𝟏 𝑩−𝟏 + ⋯ + 𝒃𝒎 𝑩−𝒎
𝒊=𝟎
Exemples
• 128,75 = 𝟏 ∗ 𝟏𝟎𝟐 +𝟐 ∗ 𝟏𝟎𝟏 +𝟖 ∗ 𝟏𝟎𝟎 + 𝟕 ∗ 𝟏𝟎−𝟏 + 𝟓 ∗ 𝟏𝟎−𝟐
• 145,32 = 𝟏 ∗ 𝟏𝟎𝟐 +𝟒 ∗ 𝟏𝟎𝟏 +𝟓 ∗ 𝟏𝟎𝟎 + 𝟑 ∗ 𝟏𝟎−𝟏 + 𝟐 ∗ 𝟏𝟎−𝟐
Similarly for binary numbers, for example the number (111,011)
111,011 = 𝟏 ∗ 𝟐𝟐 +𝟏 ∗ 𝟐𝟏 +𝟏 ∗ 𝟐𝟎 + 𝟎 ∗ 𝟐−𝟏 + 𝟏 ∗ 𝟐−𝟐 +𝟏 ∗ 𝟐−𝟑
𝟏 𝟏 𝟏
= 𝟏 ∗ 𝟒 + 𝟏 ∗ 𝟐 + 𝟏 ∗ 𝟏 + 𝟎 ∗ 𝟐 + 𝟏 ∗ 𝟒 +𝟏 ∗ 𝟖
= 4 + 2 + 1 + 0 + 0,25 + 0,125
= 7,375 13
5- Numeral systems
For the whole part we use the division method as in the previous examples,
For the fractional part, we multiply it by 2, we note the integer part obtained and we start the operation again with the new
fractional part of the result, we stop when the fractional part becomes zero or when the desired precision is reached,
the sequence of integer parts obtained in the order of their calculation represents the fractional part in binary
14
5- Numeral systems
5.6 Binary arithmetic • Multiplication
Example Example
• Addition
The addition table:
0+0=0
0+1=1
1+0=1
1 + 1 = 10 ,
• Substraction Division
The subtraction table: Example : 101100 / 100 (44/4=11)
0-0=0
0 - 1 = 1 and deduction of 1 Example 1001 11
1-0=1
1-1=0
11 11
0011
11
00
15
6- Vocabulary and computing units
A bit is the smallest unit of binary information (a physical object ❖ Byte: 1 byte = 8 bits 1
with two states represents one bit). It is the basic element for the ❖ Kilobyte (KB): 1 kilobyte (KB) = 1024 (210 ) bytes
representation of information.
❖ Megabyte (MB): 1 megabyte (MB) = 1024 KB = (210 ) KB
Instruction ❖ Gigabyte (GB): 1 gigabyte (GB) = 1024 MB = (210 ) MB
A line of text containing an operation code and one or more
references to operands. ❖ Terabyte (TB): 1 terabyte (TB) = 1024 GB = (210 )GB
Byte
A byte is the primary unit of calculation for computer storage The representation of binary numbers
capacity. An octet is an information unit composed of 8 bits. The possible values to be represented are equal to 2 to
1 byte = 8 bits. the power of the number of bits, for example:
Word • 1 bit : 21 = 2 possible values, 0 or 1
A word is a group of bits considered as a single indivisible unit. The • 2 bits : 22 = 4 possible values, 00,01,10 or 11
size of a word is often used to classify processors (8 bits, 16 bits, 32 ⋮
8
• 8 bits : 2 = 256 possible values.
bits, 64 bits, etc.). A processor is faster if it can process longer
words.
16
7- Coding
• In literature, coding is the transformation of a clear message into a coded message. Coding is an operation that consists of
assigning a symbol or a sequence of abstract symbols or numbers to all characters (digits, letters, symbols, etc.), which is the case
for computers (association of a character with a number). Generally, coding is the transition from one representation of data to
another representation known by the machine. Character encoding allows for the creation, manipulation, and transfer of
heterogeneous objects (text, image, sound, etc.) via computer tools.
• Natural Binary Code
• This is the code in which a number is expressed in binary system. As we have seen previously, it is the simplest code and follows
the standard rules of positive number arithmetic.
• DCB Code “Decimal Coded Binary”
In the DCB code, 4 bits are used to code the digits of the decimal system according to their binary equivalent.
• Gray Code
The Gray code or the reflected binary code is a 5-bit code. This code is not weighted and cannot be used for arithmetic operations.
17
7- Coding
7.1 Alphanumeric Codes
The ASCII code (American Standard Code for Information Interchange)
18