Docsity

Computer Sciences Summary, Appunti di Elementi di Informatica

Toggle sidebar
bg1
Summary Computer Theory
Bohm Jacopini Theorem: any flowchart can always be
transformed into a structured flowchart equivalent to that
given. (therefore, any logical flow can be made using
only two control structures, decision mechanism,
repetition mechanism [the loop]).
There are two major classes of computers:
• General-purpose computers;
• Special-purpose computers: a dedicated computer
(embedded system) performs functions specifications
defined at first during the design/production phase.
Server: it is a computer that provides "services" to other computers called clients, through a
network (computer network).
Server Farm: is a set of server computers located in a special room (computer center), in a medium
or large company.
Mainframe: are computers that offer great performance, used by large companies for relevant
software applications.
Algorithm: it is a finite sequence of actions that must be followed mechanically to reach the
solution of a problem. The computer follows these types of processes.
Creating a program:
• Writing a source file (main.c);
• Processing of the source file in the compiler (Codeblocks or Xcode);
• Creation of the object file, therefore the translation of the source file in machine language
(binary);
• Object file is passed to the linker which adds components from, for example, libraries, which
allow the use of functions such as printing, reading etc.;
• Creation of the executable file (.exe).
IDE, Integrated Development Environment: it is a software application that contains a text editor
for programmers, a C compiler, a program verification environment.
1-Central memory: fast memory, it contains the data that must be processed; frequently interacts
with the processing unit. It's composed by:
RAM = Random Access Memory: volatile, non-permanent memory. Faster and more
frequent instruction data with the processing unit. The access time to any memory cell is
always constant;
ROM = Read Only Memory: it is a class of memory devices mainly used for reading which
contains useful data at startup, it is written only once and cannot be modified.
2-Mass memory: it contains the data we want to store (Hard disk, Cd, floppy ...).
pf3
pf4
pf5
pf8
pf9

Anteprima parziale del testo

Scarica Computer Sciences Summary e più Appunti in PDF di Elementi di Informatica solo su Docsity!

Summary Computer Theory

Bohm Jacopini Theorem: any flowchart can always be transformed into a structured flowchart equivalent to that given. (therefore, any logical flow can be made using only two control structures, decision mechanism, repetition mechanism [the loop]). There are two major classes of computers:

  • General-purpose computers ;
  • Special-purpose computers : a dedicated computer (embedded system) performs functions specifications defined at first during the design/production phase. Server : it is a computer that provides "services" to other computers called clients, through a network (computer network). Server Farm : is a set of server computers located in a special room (computer center), in a medium or large company. Mainframe : are computers that offer great performance, used by large companies for relevant software applications. Algorithm : it is a finite sequence of actions that must be followed mechanically to reach the solution of a problem. The computer follows these types of processes. Creating a program :
  • Writing a source file (main.c);
  • Processing of the source file in the compiler (Codeblocks or Xcode);
  • Creation of the object file, therefore the translation of the source file in machine language (binary);
  • Object file is passed to the linker which adds components from, for example, libraries, which allow the use of functions such as printing, reading etc.;
  • Creation of the executable file (.exe). IDE, Integrated Development Environment : it is a software application that contains a text editor for programmers, a C compiler, a program verification environment. 1- Central memory : fast memory, it contains the data that must be processed; frequently interacts with the processing unit. It's composed by:  RAM = Random Access Memory: volatile, non-permanent memory. Faster and more frequent instruction data with the processing unit. The access time to any memory cell is always constant;  ROM = Read Only Memory: it is a class of memory devices mainly used for reading which contains useful data at startup, it is written only once and cannot be modified. 2- Mass memory : it contains the data we want to store (Hard disk, Cd, floppy ...).

The Microprocessor is a chip that performs the functions of CPU (Central Processing Unit) in a computer or in a digital system. It is a complex element and represent the brain of the machine. A generic CPU contains:  a control unit (also known by the acronym "CU") is a component of the CPUs which has the task of coordinating all the actions necessary for the execution of an instruction and sets of instructions. It is the component which gives the possibility to the microprocessor to execute different instructions.  arithmetic and logical unit (also known by the acronym "ALU") which is responsible for carrying out the logical and arithmetic operations. Usually it is composed of combinatorial circuits. Each unit has a given task is not flexible, but still very fast.  registers , special memory locations inside the CPU, very fast, which can be accessed much faster than from memory: the overall value of all the registers of the CPU constitutes the state in which it is currently located. The registers are few in number and small in size. Two registers always present are:  the IR Register (Instruction Register), which stores the instruction being processed, and the PC (Program Counter), which contains the address in memory of the next instruction to be executed (and from which to fetch);  the register of flags: this register does not contain conventional numerical values, but is rather a set of bits, called flags, which indicate particular CPU states and some information on the result of the last operation performed.  The decoding unit takes care of receiving the input instructions and activating the appropriate internal processor units to execute the loaded instruction;  The memory management unit ("MMU") is a class of hardware components that manages requests for memory access generated by the CPU. The MMU can perform various tasks including translating (or translating) virtual addresses into physical addresses, protecting memory, checking the CPU cache, bus arbitration, switching memory banks.  Bus control unit. Buses (computer circulatory system) are hardware components that interface the different computer units or several computers. If poorly sized, it could be a 'bottleneck'. Features of a bus are:  Transport of only one data at a time;  Frequency, ie the numbers of data carried per second;  Width, the number of bits that make up the single data. T = clock period - Measure unit = s f = clock frequency ( = 1 / T ) - Measure unit = s

= Hz (cycles/s) A single bus is divided into three 'sub-buses':

 From Binary to Decimal: the definition written above applies, making the weighted sum of the binary digits. EXAMPLE: 1101 = 1 * 2 ^ 3 + 1 * 2 ^ 2 + 0 * 2 ^ 1 + 1 * 2 ^ 0 = 8 + 4 + 0 + 1 = 13;  From Decimal to Binary: we proceed with successive divisions by 2, reporting the remainder (which can be 1 or 0); at the end of the operation, the remains are 'copied' in the reverse order. EXAMPLE: 13 6 3 1 0 1 0 1 1 = 1101 Across the binary language numbers limited by the number N of available bits can be represented: to be exact, 2^N combinations can be created (where the minimum is 0 and the maximum 2^N-1, included). [Min = 00 ... 0 Max = 11 ... 1]. Operations with binary numbers:SUM , basic rules. *0 + 0 = 0 * 1 + 0 = 1 * 1 + 1 = 0 with carryover of 1;  DIFFERENCE , basic rules. * 0 - 0 = 0 *1 - 1 = 0 *1 - 0 = 1 *0 - 1 = 0 with a loan of 1 to the next figure. 1 1 - 0 1 1 0 + 0 1 0 1 - 0 1 1 1 = 0 0 1 1 = 1 1 0 1 0 0 1 0 There are limitations on the sum: Overflow. It indicates the error that occurs in an automatic calculation system when the result of an operation cannot be represented by the same coding and number of bits of the operands. In the sum in pure binary there is an overflow when working with a fixed number of bits and carrying on the MSB. To represent binary numbers, there are several encodings:  Form and sign: the MSB will assume a value of 0 for a positive sign, 1 if the sign is negative; a Bit will be occupied by the sign and N-1 Bit by the module. The disadvantages are double zero (zero is representable as 00 = + 0 and 10 = -0), complex operations. With N Bit number, it is representable the interval [- (2𝑁 − 1 - 1), 2𝑁 − 1 - 1] (we speak of a symmetrical range);  2's complement: in this coding for the N-bit number, the MSB has negative weight, equal to −2𝑁 − 1. While the other bits have positive weight. Consequently, the MSB always indicates the sign: 0 = + 1 = -. As for the operations, these are carried out regardless of the signs of the operands. With operands having a discordant sign, overflow can never occur, while, otherwise, the overflow occurs when the result has a sign different from that of the operands; in the event that a carry occurs on the last digit, it is not considered. To convert a signed decimal number to CA2 : if the number is positive, CA2 = M&S; if the number is negative, the corresponding positive is calculated in M&S, after which it is copied from right to left up to the first number 1, then copied by inverting the ones with zeros.

EXAMPLE: -10 = |-10| = 01010 𝑀&𝑆 = 10110 𝐶𝐴 2

THE BOOOLEAN LOGIC

The logic on which the computer is based is the Boolean logic, based on variables that are capable of assuming only two values, True or False, and central importance has the distinction between dependent and independent variables. Logic gates : are the basic building blocks of any digital system. It is an electronic circuit having one or more than one input and only one output. The relationship between the input and the output is based on a certain logic. Based on this, logic gates are named as AND gate, OR gate, NOT gate etc.

 Char: 1 byte;  Int: 2 bytes (depends on the structure of the computer);  Long: 4 bytes (depends on the structure of the computer);  Float: 4 bytes;  Double: 8 bytes (depends on the structure of the computer);  Long double: 12 bytes (depends on the structure of the computer). 1byte = 8bit Multiple bytes:

SI prefix Binary prefix

Nome Simbolo Nome Simbolo 1kilobyte kB = 10^3 byte kibibyte KiB = 2^10 byte 1megabyte MB = 10^6 byte mebibyte MiB = 2^20 byte 1gigabyte GB = 10^9 byte gibibyte GiB = 2^30 byte Memory It stores data and instructions that the computer needs to execute. Features:  Addressing  Parallelism  Access (sequential or random) Addressing Memory is organized in cells (minimum directly accessible unit). An address (number) is assigned to each cell for uniquely identifying it.

Parallelism Each memory cell contains a fixed quantity of bits:  Same for all the cells (of a certain memory unit)  Accessible with a unique Bus Cycle  It is a multiple of a byte  At least 1 byte (typically a word for the main memory) Internal Memory  Inside the computer  Solid state (chip)  Usually volatile  Fast (nanoseconds, 10-^9 s) • Limited quantity (some GB) • Not removable  Expensive (0.1 € / MB) External Memory  External to the computer  Sometime removable  Not electronic (e.g., magnetic, optical) • Permanent  Slow (milliseconds, 10-3s)  Large quantity (some TB)  Cheap (0.1 € / GB) Type of representation of an image:  Raster: graphic information represented as a pixel matrix;  Vettoriale: graphic information represented by matematic relations (functions). Formula for the calculation of bytes needed to store an image BxH and 16384 colors: (B x H) + (n° colors x 3) = tot bytes (n° colors x 3) = (3 x 2n) where n is the number of bits required to store an image:  256 = 2^8 = 8 bits = 1 byte  65526 = 2^16 = 16 bits = 2 bytes  … In this case we need at least (3 x 16384) + (B x H) bytes