epam upskill notes
epam upskill notes
epam upskill notes
and about everything that is being worked with. It is not suitable for long-term
storage, because the information disappears after a computer is turned off. Types:
DIMM (dual in-line memory module), SO-DIMM (small outline DIMM), DDR SDRAM
(versions 2, 3, 4).
A hard disk drive and a solid state drive ensure long-term storage of information.
A motherboard is a microlite printed circuit board, on which various microcircuits
and expansion slots are soldered. It consists of:
A power supply is needed to make a constant flow of current from alternating current
and to provide power to all components of a computer. A power supply consists of:
voltage converters. Usually, there is a sticker with data on a power supply, for
example: input 220V, output + 3.3V, + 5V, + 12V
power supply outputs (e.g. for a motherboard, a processor, SATA power for
SSD/HDD and PCIe power for a graphic card)
a motherboard
CPU
a cooling fan
a RAM module
an HDD or a SSD
Wi-fi, Bluetooth module
a battery
slots and sockets
Boolean Algebra
Boolean algebra is a branch of mathematics that deals with variables
having only two possible values, 1 and 0, or "true" and "false". The
main difference between Boolean algebra and elementary algebra is
that Boolean algebra deals with logical operations, whereas
elementary algebra deals with arithmetic operations. Why is it
important to us? First, as we will learn later, modern computers and
their one of the most important parts, CPU, are built of billions very
simple circuits called logic gates. These logic gates are physical
implementations of Boolean functions. Second, all programs contain
many conditional statements, which allow the program to perform
different actions depending on whether a condition is seen as true or
false. These conditional statements are also Boolean functions.
Key Facts About Boolean Algebra
Variables can have only two values. The values are truth values, "true" and
"false". It is often denoted as 1 and 0, respectively.
There are three basic operations in Boolean Algebra:
1. A AND B. This operation results in true value only if both A and B are true.
2. A OR B. This operation results in true value only if at least one of A or B is
true.
3. NOT A. This operation negates the value of A. If A is true, then NOT A is
false, and if A is false, then NOT A is true.
There are many other registers in modern complex CPUs but let us
keep it simple.
The CPU also has a clock generator that generates pulses with
predefined intervals of time. It is used to synchronize different parts of
a processor. Each time a clock pulse occurs, millions of small circuits in
the processor change their state and process signals. All at the same
time.
Fetch-Execute cycle or Fetch-Decode-Execute cycle or Instruction cycle
is a three-stage process:
The first 4 bits, 0001, indicate that this is a Load command and the last 4 bits are used
for memory address. 4 bits allow us to use 16 memory addresses from 0 to 15. This is
enough for our simple CPU because we only have 8 bytes of memory.
The cycle continues repeating again and again. With each cycle, the value at the data
register is increased by the value at the memory address 5, 2, and the result is stored in
the memory address 4. In our simple CPU this cycle would never end. Real CPUs have
commands to compare two registers and jump based on the result of this comparison.
If we had extended our instruction set with "Compare X, Y" command to compare
register X and Y and store the result of the comparison as a bit in a flag register (flag
register is essentially a read-only register to indicate status of some commands) and
"JumpGreater C" command to set the program counter to C only if the comparison flag
is set to the value corresponding to "X is greater than Y" result of comparison, we
would have been able to modify our program so that it jumps to another part of code
as the value in the data registry exceeds, for example, 16. Machine level instructions
which do something based on a condition are called control flow instructions.
We have already explained how a computer stores and operates number data.
However, we need to process not only numbers, but texts as well. This is done by
mapping letters to numbers. These mappings are called encoding systems. One of the
first such systems was ASCII (American Standard Code for Information Interchange). It
maps one byte to one character. Though only 7-bits of byte are used, 7-bits give us 128
unique characters which is enough to code all letters of the English alphabet,
numbers, and some special symbols.
ASCII table can be extended to 8-bit (one byte). There are many extended ASCII
encodings. The upper part of Extended ASCII is used to represent characters from the
languages other than English. However, additional 128 characters are not enough to
represent all missing characters from all languages. So, to correctly interpret text
codes using one of the extended ASCII encodings, you also need to know which
encoding system should be used.
One-byte encodings can be used to represent an English text and other
alphabet-based languages, but some languages like Chinese have
thousands of different characters. In scientific texts we might also want
to have a mixture of English and Greek letters. The standard called
Unicode was developed to solve this problem. The standard maps
more than 100,000 characters to numbers. The first 128 characters in
the Unicode match the first 128 ASCII characters.
Unicode
Since UTF-8 is a variable length encoding, we must have a way how to tell when a
character ends and another one starts. This is done by using several first bits of the
first byte of each character to indicate how many bytes this character uses.
1 0xxxxxxx 7
2 110xxxxx 10xxxxxx 11
As a conclusion, the table with listed properties of the discussed encodings is provided
below.
What is a color? Most electromagnetic waves are not visible for us, but a narrow band
of electromagnetic waves stimulates retina of our eyes making these waves visible for
us. Each individual wavelength of this band represents a particular color. Human eyes
have cells known as cones which are responsible for color perception. There are three
types of cones, each being sensitive to its own range of colors: red, blue, and green.
However, it does not mean that red cones are not stimulated when you are looking at
a green color, it means that they are stimulated less than the green ones are. Our brain
interprets how much each type of a cone is stimulated producing our sensation of
color as a result.
There are two ways to obtain color: additive color mixing and subtractive color mixing.
RGB stands for Red, Green, and Blue (primary colors in the RGB model). Each
computer screen pixel releases the amounts of red, blue, and green light so that our
eyes perceive the desired color.
This type of color mixing is called “additive” because we start with a black color and
combine (or add) different amounts of red, green, and blue light. We add several wave
lengths to obtain a color.
When painting or printing, colors are obtained in a way that is called "subtractive".
The white surface seems white to us because it reflects all visible wavelengths (the
white color is simply a mixture of all visible wavelengths). By painting on the white
surface, we make the surface absorb some part of spectrum, thus giving it a color.
When we mix paints, both paints still absorb all wavelengths they did previously. The
only difference is that the wavelengths reflected by both paints are reflected now.
Thus, we “subtract” colors from white to obtain a new color.
In color printing, the usual primary colors are cyan, magenta, and yellow (CMY). The
key (K, black) component is often added to avoid mixing all colors to obtain black.
FSM is defined by:
This FSM has seven states labelled from 1 to 7; each state is represented by a circle on
the graph. State 1 is the initial state; it is denoted by a circle with an arrow coming
from nowhere. States 2, 4, and 7 are accepting states; they are shown as double
circles. The transitions are represented with arrows. Each arrow has a symbol, or a list
of symbols written next to it. These symbols cause corresponding transitions.
Suppose a number 14.5E+5 (14.5×105) is given as an input to this FSM. Let us run it
through this FSM. The machine starts in state 1 as it is our initial state.
Special
Description
Character
\ Escape character.
^ Beginning of a string.
$ End of a string.
Special
Description
character
(…) Used for grouping to define the scope and precedence of other operators. For
example, "gray|grey" and "gr(a|e)y" are equivalent patterns.
[…] Matches a single character contained within brackets. It is not needed to escape
characters listed in brackets even if it is a special character. For example, "[*+]"
would match "*" or "+".
[X-Y] Matches any character between X and Y. For example, [a-z] matches any
lowercase letter of the English alphabet, [0-9] matches any digit.
{min, max} Matches the preceding element at least min times and not more than max times.
Character
Description
class
\s Whitespace characters
\d Digits
.ar The dot matches any character, so this regex would match "bar", "car",
"ear" and others.
[ec]ar [] matches a single character listed in brackets. This regex matches only
"ear" and "car".
^[ec]ar Matches "ear" or "car" but only at the beginning of the string.
a{5}r Matches "aaaaar" because "{" and "}" are not escaped.
When writing a
program, a
programmer takes
into consideration
that the program will need to perform a task with a specific hardware.
For example:
a Messenger must be able to interact with a network card. However, there are
many different network cards.
a Web Browser must be able to work with a processor. However, there are many
different processors.
The solution is to
use an operating
system. An
operating system
is a large program
that interacts with
various hardware
manufacturers
using a set of
drivers.
A driver is a
computer
program that
operates or controls a particular type of device that is attached to a
computer. For example, there are drivers for INTEL PROC, AMD PROC,
WD HDD, D-Link NC network cards, etc. A shell (e.g. NVIDIA, Samsung
Magician) might be used to make it easier to run and set drivers.
Types of OS
Let's take a close look at the types of operating systems and statistics
about their use.
Click each tab for more information.
Desktop Operating SystemsMobile Operating Systems
According to
the Statcounter,
the dominant
desktop operating
systems in 2019
were:
Windows
(76.32%)
OS X (17.65).
Thus, an
operating system
helps developers
of programs and applications not to tie development to specific
hardware and, thus, it increases the efficiency of a program
development process. The main functions of an operating system are
as follows:
In the further topics, we will discuss in more detail Windows and Linux
operating systems.
For the same reason that is listed above, for some operations, you may need to run the
Command line with administrator privileges – "Run as administrator."
CD Command in Command Line
CD is the command-line command that is used for navigating the directory tree. One
of the possible use cases of using CD command is to jump directly to your target folder
by enclosing the path in quotation marks:
C:\Users\user>cd "C:\Windows\Microsoft.NET\DirectX for Managed Code"
To learn more about CD, use help command:
cd/?
Processes and Threads
When you run any program, the program creates processes. Each process provides the
resources needed to execute the program.
In simple terms, a process is an executing program. One or more threads run in the
context of the process.
A thread is the basic unit to which the operating system allocates processor time. A
thread can execute any part of the process code, including the parts currently being
executed by another thread.
From: official site of Microsoft
Each process can create a child process. In this case, the process which has a child
process is called the parent process.
From: official site of Microsoft
How to end/kill/close a process?
In the Task Manager, if you want to end a process, right-click on the desired process
and click End task.
If you want to end a process and all related child processes, right-click on the desired
process and click End process tree.
Sorting in Task Manager
In the Task Manager, you can sort processes by Name, Status, CPU, Memory, Disk, Net
Restart a Service from the Command Line
Sometimes there are cases when you need to restart a service. You can do this using
the command-line program, SC.
SC is a command-line program used for communicating with the
Service Control Manager and services.
sc <server> [command] [service name] <option1> <option2>...
where service name is the name of the service. If the name contains
spaces, enclose it in quotation marks, "service name."
Let us consider the basic requests and the corresponding commands.
Request Command
If you are not sure whether a service is already running, and sc stop [service name] & sc start
want to restart or to start it [service name]
&& is "and" operator. If two commands are chained together using &&,
then the second command will run only if the first command has been
finished successfully.
If we talk about the start of a service, you can start it with parameters, if necessary.
sc [<ServerName>] start <ServiceName> [<ServiceArguments>]
where
<ServerName>: Specifies the name of the remote server on which the service is
located. The name must use the Universal Naming Convention (UNC) format
(for example, \\myserver). To run SC.exe locally, omit this parameter.
<ServiceName>: Specifies the service name returned by
the getkeyname operation.
<ServiceArguments>: Specifies the service arguments that should be passed
for the service to be started.
1. The first way is to set each account rights individually. This method becomes
ineffective when there are a lot of users that should have similar permissions.
2. The second method is more preferable from this point of view. The essence of
this approach is that users are formed into groups, and then the whole groups
are granted the required permissions or rights. For example, a group of
administrators.
When we talk about creating new users in an organization and authenticating them,
concepts such as domain and active directory may come up.
A domain is the minimal structural unit in Active Directory. It may include network
objects, such as users, computers, printers, shared resources, etc.
For example, domains may correspond to departments in an organization, or to
geographical locations.
Active Directory (AD) is a directory service that stores information about objects on
the network and makes this information easy for administrators and users to find and
use.
You can find more information about Active Directory and the related
concepts on the official website of Microsoft and here.
An environment variable is a text variable of the operating system storing some
information, for example, system settings data, a path to a folder, etc.
There are two types of environment variables:
User variables
System variables
Environment variables can be useful in many ways. One of the possible applications of
environment variables is to use them for quick access to a folder. If you have some
documents in a folder with a long path, you can create an environment variable which
will contain the path to the required folder and, when necessary, use it for quick
access. Consider an example.
Click the arrow to see information about the next steps.
Step 1
Imagine that you have a folder named "Subfolder" with the following
path:
C:\Users\<UserName>\Documents\Folder\Subfolder
What is Shell?
In simple terms, the shell is a command line interface that takes commands and
executes them. In other words, the shell processes commands and returns the output.
What is Terminal?
Comman Comman
Description Description
d d
pwd (short for "print working more displays long text files per page at
directory") a time; you can navigate only
prints the current working forward
directory
ls lists files and directories in the less displays long text files per page at
current directory a time; you can navigate both
forward and backward
cat (short for "concatenate") wget download a file from the Internet
reads data from a file and displays
its content on the screen
top shows processes that are sudo runs a program as a super user
currently running; the list of the
processes is updated every
second
OSI Model
Protocols
Browser DNS caching. Modern web browsers cache DNS records for a small
amount of time.
Operating system caching. The DNS resolution request from an application may
not leave your machine if your operating system has already made a request for
that domain name and has it in its cache.
DNS server caching. Each type of the DNS server may cache responses it
received from other DNS servers.
o Oracle database
o MySQL
o Microsoft SQL Server
o PostgreSQL
Relational - The data is stored in tables, some of which are related to each other. Each
row in the table is a record with a unique ID called the key. The columns of the table
hold attributes of the data, and each record usually has a value for each attribute.
Information in an object-oriented database is represented in the form of objects, as in
object-oriented programming.
Several organizations have released various guidelines on strong
passwords. Most common advice is:
Numbers 10 3.322
A 6-symbol password that uses only lower-case Latin letters will have
28.2 entropy bits. It would take only 228.2 = 308,351,367 attempts to
discover it (if we assume that we spend 1 second per attempt, this
results in approximately 9.8 years of trying).
Diceware method gives 12.9 bits of entropy per word (there are
65 words in the list, so the entropy per word is ). The entropy of the
recommended six-word password is 77.5 bits, assuming an attacker
knows that you used diceware technique. Otherwise, it is even more
entropic.
So far, we assumed that the attacker would try all possible
combinations of symbols to find the password. Such attacks are
called brute-force attacks. In fact, a more common attack is
a dictionary attack. It is based on trying all the strings from a
predefined list. Usually this would be words from a dictionary. The
attacker also tries different combinations of these strings and makes
well-known substitutes like writing "$" instead of "s" in the words ("pa$
$word").
Another threat is that the attacker may get access to the system
storing passwords. For example, the database containing a user’s
passwords may be stolen. In the past, the systems used to store
passwords as plain text. After gaining the access, the attacker would
immediately know the usernames and their passwords, and may try to
use these credentials to access other systems because people often
reuse their passwords. To prevent that, a technique called password
hashing is used. Modern systems almost never store passwords as
plain text; they store a hash of a password instead. The hash is a
result of applying a one-way function to a password. The one-way
function is a function which is easy to compute on every input, but
hard to invert given the result. A simple example of a one-way function
is a product of two prime numbers. It is easy to multiply two large
prime numbers, but very difficult to find prime factors having only the
product.
One of the most used and well-known hashing algorithm families is a
SHA (Secure Hash Algorithm). It uses a number of logical operations
(AND, XOR, OR, and others) on the input to produce its output. SHA
usually has a number after its name to indicate the variant being used.
For example, SHA-256 means that the result is a 256-bit hash. A hash
is essentially a fixed-size image of an input string which can be of any
length. An important property of hash functions is that it should be
virtually impossible to find two input strings which would produce the
same hash, but this is still possible because it maps a larger set to a
smaller one. Older versions of hashing algorithms (SHA-1 and MD5) are
no longer widely used because such collisions were found.
Secure Communications
Secure communications take place when the parties want to
communicate without the third party being able to listen to them.
Secure communications over the Internet are usually achieved via
encryption, assuming the endpoints are not compromised.
The two primary methods for encryption used in computer systems
are symmetric and asymmetric.
Click each heading to see more information about primary methods of
encryption.
Symmetric
In symmetric encryption, the same key is used for encryption and
decryption. The key should be somehow passed to both parties
beforehand via a secure method. If an attacker eavesdrops on the
message, he would not be able to understand it without the key. One
of the simplest symmetric encryptions is XOR cipher. XOR operation is
applied to the message and the key, repeating the key if the message
is longer than the key. The party receiving the message uses the same
operation to decrypt the message.
– message, – key, – encrypted message
The encrypted message is .
The decryption works because
For example, the string “EPAM” (01000101 01010000 01000001
01001101 in ASCII) can be encrypted using the key “PW” (01010000
01010111 in ASCII) as follows: