First Commit

main
lomna-dev 1 year ago
parent e9267fb747
commit d6c895778e

File diff suppressed because it is too large Load Diff

@ -0,0 +1,411 @@
#+TITLE: Computer Networks
#+AUTHOR: Anmol Nawani
#+OPTIONS: H:4
#+html_head: <link rel="stylesheet" href="src/org.css">
@@html:<hr />@@
* Introduction
A computer network is collection of two or more computers that can communicate with each other.
Computer networks have two basic building blocks
1. *Nodes* : these are devices that are connected to the network. They can either be network redistribution points or communication endpoints. Example of nodes are computers, routers, switches and other devices on the network.
2. *Links* : these are the connections between nodes. It includes the type of connectivity (wired or wireless) and the protocols that are used for communication between the nodes.
Computer networks are made of protocols which allow us to send data through links between nodes.
@@html:<hr />@@
** Some basic terminologies
Here, we will look at basic terminologies used in computer networks. Most of these will be expanded on further.
+ *Protocol* : a set of rules and standards that govern how data is transmitted between nodes in the network.
+ *Topology* : refers to the arrangement of links and nodes in a computer network. There are eight basic network topologies: point-to-point, ring or circular, mesh, tree, star, bus, daisy chain and hybrid
+ *IP Address* : it is a unique numerical identifier that is assigned to each node in the network. It's purpose is to identify devices in network allowing us to send and recieve data from them. IP Address stands for Internet Protocol Address.
+ *DNS* : stands for Domain Name System. It is naming system and a protocol which translates human redable domains (such as [[https://git.lomna.xyz/][git.lomna.xyz]]) and translates it into an IP address of the node from which we need to get data.
+ *Firewall* : it is a security device which can either be hardware-based or software-based. It controls and monitors incoming and outgoing network traffic and protects from unauthorized access and security threats.
A system which complies with all the protocols can be connected to a network
1. *Open System* : a system which complies to all network protocols and can be used for communication in network.
2. *Closed Sytem* : if a system does not comply to all network protocols and thus is not connected to network, unable to communicate.
Computer networks can fall under two broad categories
1. *Client-Server Architecture* : in this architecture a communicating node can either be a server or a client. The client sends requests to the server, the server fulfills that request and sends a response. There are multiple clients connected to the same server.
2. *Peer-to-Peer* : in this architecture there is no central server, tasks are divided amongst the nodes. Each node has the same set of capabilities and responsibilities.
@@html:<hr />@@
** OSI Model
OSI stands for Open Systems Interconnection. It is a reference model which specifies standards and communication protocols for computer network. It is a 7 layer architecture. Each layer has different functions and protocols. The seven layers are
1. Physical Layer
2. Data Link Layer
3. Network Layer
4. Transport Layer
5. Session Layer
6. Presentation Layer
7. Application Layer
We don't use the OSI Model and mostly use it as a referencial model. The TCP/IP model is more widely used.
@@html:<hr />@@
** Unique Identifiers of Computer Network
In order to establish communication between two nodes, we need to identify the nodes. This is done by using unique identifiers given to devices on a network.
*** Hostname
A hostname is a human readable label that is assigned to a device on the network. On the internet, a hostname is a domain name which has been assigned to a host computer. It is useful to identify devices on a local network.
*** IP Address
Also known as the logical address, every device to which a direct communication can be established will have a unique IP address. Interned Assigned Numbers Authority (IANA) assigns and manages ip addresses globally. Previously, ipv4 (version 4) was used and was an address of 32 bits, hence there are $2^{32}$ unique ipv4 addresses. Because there are limited number of ipv4 addresses, we are running out of them. A new version of ip addresses ipv6 is now implemented. It has addresses of size 128 bits.
*** MAC Address
Stands for Media Access Control Address. It is also known as the physical address. Every Network Interface Card (NIC) is assigned a unique identifier. These are assigned by the manufacturer and cannot be changed. The length of a MAC address is 48 bits.
@@html:<hr />@@
** Ports
A single system has multiple connections and network applications running. A port is a logical channel through which data can be sent or recieved. A port number is always associated with a network address such as an IP address so that we can identify the device whose port was referenced. The unique combination of ip address and port number together is called a *socket*, example 192.168.0.1:8000
\\
The ip address and port number are seperated by a colon (:)
The ports are divided into three categories.
#+ATTR_HTML: :rules all
| Port Type | Range |
|------------------+---------------|
| Well known ports | 0 - 1023 |
| Registered ports | 1024 - 49151 |
| Dynamic ports | 49152 - 65535 |
+ The ports from 0 through 1023 are called well-known ports or system ports. They are used by system processes to provide widely used network services. Example, port 20 is for FTP and 80 is for HTTP.
+ Ports in the range from 1024 to 49151 are user or registered ports. These ports can be freely used by the user. Unlike system ports, most OS will allow applications to use these ports without superuser privelages.
+ Ports in range 49152 to 65535 are dynamic ports or private ports. They are also called ephemeral ports, because they are used for very short period of time. The TCP, UDP and SCTP typically use ephemeral port for client end of communication. The allocation of ephemeral port is temporary and only valid for short duration of communication session.
@@html:<hr />@@
* Network Models
A network model defines a way to organize a system's functions and features. It also defines it's structure and protocols.
In order to assign functionality to different parts of a network, these models are organized into layered structure. Each layer has a set of functions to perform. Protocols are created to handle functions in each layer. So each layer will have it's own collection of protocols which is called a /protocol suite/.
There are a few guiding principles for creating layers in a network model, such as
+ Not creating too many layers, as it may lead to unneccessary complexity.
+ Reduce the number of interactions between the layers
+ Collect similar functions and seperating fundamentally different functions in different layers
+ Indentify whether the function of layer is based on hardware or software.
Lower layers are linked with hardware whereas, the upper layers are linked with software.
There have been many network models, many of them are no longer used. IBM's SNA model, Apple's AppleTalk and IPX/SPX model are all no longer in use. They were phased out by the popular and most commonly used model today, the TCP/IP model.
@@html:<hr />@@
** OSI Model
TODO : Add OSI model image
The OSI model is used as a reference model. This means that it is used to provide building blocks for other network models and compare other network models to improve connectivity and consistency.
The OSI model has 7 layers. Each layer has different functionality. The principles applied for the 7 layers are
1. A layer should be created where a different abstraction is needed
2. Each layer should should perform a well-defined function
3. The function for each layer should be chosen with eye toward defining an internationally standardized protocols
4. Minimize the information flow across layer boundries
5. The number of layers should be large enough that distinct functions need not be in same layer, but small enough that architecture is not unwieldy
*** Physical Layer
The lowest layer of the OSI model. Responsible for physical connections between the devices. The physical layer handles data in form of bits and is responsible for transmitting bits without loss from one node to another.
Functions of physical layer are
+ *Bit Synchronization* : the physical layer provides a clok to synchronize sending and recieving of data between nodes
+ *Bit rate control* : the physical layer also controls the the number of bits sent per second.
+ *Physical topologies* : topology defines how the nodes and links are arranged in the network
+ *Transmission mode* : the physical layer defines how data will flow from one node to another. Some transmissions modes are simplex, half-duplex and full-duplex
Hub, repeater, moden and cables are physical layer devices
*** Data Link Layer (DLL)
This layer is responsible for node-to-mode delivery of the message. It makes sure that data transfer is error-free from one node to another, over the physical layer. When packet enters a network, it is the responsibility of DLL to transmit it to the host using MAC address.
The DLL has two sublayers:
1. Logical Link Control (LLC)
2. Media Access Control (MAC)
The packet recieved from *network layer* is divided into frames, depending on the frame size of NIC. The reciever's MAC address is obtained by placing an Address Resolution Protocol (ARP) request, asking for MAC address for given IP address. The destination host replies to the ARP request with it's MAC address.
The functions of DLL are
+ *Framing* : since physical layer only accepts and transmits stream of bits without meaning or structure, the DLL breaks message into recognizable frame with boundries. This is done by attaching special bit patterns at beginning and end of a frame. Breaking message into frames is called framing.
+ *Physical addressing* : after creating frames, the DLL will add MAC address of the sender and reciever in the header of each frame.
+ *Error control* : DLL will detect and retransmit damaged or lost frames.
+ *Flow control* : the data rate must be constant on both sides to not cause corruption in data. Flow control is coordinated by the DLL to avoid this.
+ *Access contrl* : when a single communication channel is shared by multiple devices, the MAC sub-layer of DLL determines which device has control over the channel at a given time.
DLL is handled by the NIC and device drivers of host machines.
Switch and bridges are example of DLL devices.
*** Network Layer
The network layer controls operations of the subnet.
It is responsible for transmission of data from one host to other located on different subnets. It is also responsible for packet routing i.e, the selection of the shortest path for the packets. The sender and reciever IP addresses are place in the header by the network layer.
Routes can be based on static table that rarely changed, or are updated automatically at the start of conversation. Routes can also be highly dynamic to reflect the current network load.
Too many packets present in subnet can cause bottlenecks. *Handling congestion is also the responsibility of network layer*. The *quality of service* (delay, transit time, jitter, etc.) are also a network layer issue.
Functions of network layer are
+ *Routing* : the network layer determines which route will be used to send packet from sender to reciever.
+ *Logical addressing* : the network layer identifies the IP addresses of sender and reciever in the network an places them in the header.
The implementation of network layer is in devices such as routers and switches.
*** Transport Layer
The data in transport layer is referred to as *segments*. This layer is responsible for end to end delivery of messages. It also acknowledges successful transmission and re-transmits data if error is found.
At sender's side, this layer recieves data from upper layers, performs *segmentation* and also implements *flow and error control*. It also adds source and destination port numbers in headers and forwards the segmented data to network layer. The destination port number is configured either by default or manually. example, when requesting web server, we use destination port 80 for the request because it is default port used for HTTP requests.
At reciever's side, it performs sequencing and reassembling of segmented data. Then port number is read from the header and data is forwarded to the respective application.
Transport layer is an *end-to-end layer*. It carries data all the way from source to destination. That is, a program on source machine carries on a conversation with similar program on destination machine using headers and control messages. The lower layers, have protocols which communicate between machine and immediate neighbours, not the source and destination. /*Layers 1 to 3 are chained, i.e. communicate with neighbours while layers 4 to 7 are end-to-end.*/
Funtions of transport layer are
+ *Segmentation and Reassembly* : at sender the message from session layer is broken into smaller units called segments, at receiver the segements are reassembled into message.
+ *Service Point Addressing* : the transport layer determines what type of service is provided to the session layer and ultimately, to the user. The type of service is determined when connection is established via port address.
The service of transport layer is of two types
1. *Connection Oriented Service* : it is a three phase service that has connection establishment, data transfer and then termination. The receiving node will send and acknowledgment and asks for re-transmission if there is error. This type of transmission is reliable and secure. example, TCP
2. *Connectionless service* : in this type of transmission, there is no need to establish a connection before data transfer and the receiver does not send an acknowledgement. This approach allows faster communication but is less reliable. example, UDP
Transport layer is operated by the OS. This layer is called the *heart of OSI model*.
*** Session Layer
This layer is responsible for establishing connection, maintanance of communication sessions and authentication. It ensures the security in connection.
The services provided by session layer are
+ *Connection establishmen and release* : The session layer open a connection between two nodes, this connection is called a *session*. In OSI, transport layer does not terminate the connection, the session layer is responsible for that. In TCP/IP model, this is done by the transport layer.
+ *Dialogue control* : in a session, there can be three different types of dialogue - two way simultaneous (full-duplex), two way alternate (half-duplex) and one way (simplex). It controls which side has the turn during communication.
+ *Synchronization points and resynchronization* : this layer allows the two sides to insert synchronization points between dialogue and allow them to resynchronize to a previous synchronization point, aborting the current transmission. This can be used for real-time audio/video.
*** Presentation Layer
Also called the translation layer. This layer translates files and data from local formats to standard, transmittable formats.
The services provided by presentation layer are
+ *Data conversion* : example, converting file formats such as bmp to webp which are easier to transmit in a network.
+ *Character code translation* : changing strings to bits that can be transmitted.
+ *Compression* : compressing and decompressing data in order to reduce the amount of data has to be sent.
+ *Encryption and Decryption* : encrypting and decryting of messages for security
+ *Serialization* : converting complex data structures into flat structures using mechanisms like JSON and XML.
*** Application Layer
Also called the Desktop Layer. This layer acts as the window for applications to access the network. This layer produces the data which will be transferred over network and displays the information to user. This layer also contains the protocols for interfaces to different functionalities of the web.
This layer has protocols such as HTTP, FTP, SMTP, DNS and provides the functionality to use services associated with these protocols.
@@html:<hr />@@
** TCP/IP Model
TCP/IP was used in ARPANET and now the worldwide Internet. The ARPANET started as a network of hundreds of universities and government installations. When satellite and radio networks were added, they caused problems with existing protocols. This need for a model that can connect multiple networks in a seamless way was the major goal of the TCP/IP model.
Another requirment was that connections remain intact as long as the source and destination machines were working, even if some machines or transmission lines were out of operation. So a flexible and robust network was needed.
The TCP/IP model had 4 layers, but sometimes physical layer is also included in the model.
*** Link layer
The requirnment for a robust network led to the choice of packet-switching network based on a connectionless layer that runs across different networks. The link layer describes what links like serial lines and classic ethernet must do to meet needs of this connectionless internet layer. It is not a layer in normal sense, but rather an interface between different hosts and transmission links.
*** Internet layer
This layer roughly corresponds to the OSI network layer. Its job is to permit hosts to *inject packets into any network and have them travel independently to the destination*. That is, it will allow packets from go to one network to another while they are going to destination. This property that packets can travel through any network makes the whole network more robust, by allowing communication even if a few networks in some path are down.
The packets may even arrive in a completely different order than in which they were sent. If in-order delivery was needed, then it's the responsibility of higher layers to rearrange them.
It is similar to the *old mail system*. When a sequence of international letters are dropped in a mailbox from one country, most mails will be delivered to the correct address in destination country. The mails may not go in the same sequence they we entered in the mailbox. Furthermore, each country (network for our analogy) has it's own stamps, envelope size, and other rules and protocols.
The internet layer defines an official packet format and protocol called *Internet Protocol* (IP), with a companion protocol *Internet Control Message Protocol* (ICMP) that helps its function.
The job of internet layer is to deliver IP packets where they are supposed to go. Packet routing is the major obstacle for this layer. (IP has proven not effective to avoid congestion)
*** Transport layer
TODO : Here
*** Application layer
TODO : Here
@@html:<hr />@@
* Physical Layer
The lowest layer of the TCP/IP model. It describes the standard for the physical connections between nodes. It only views the data as a stream of bits and is concerned with transmission of bits without error.
@@html:<hr />@@
** Network Topology
The arrangement of nodes and links in a computer network is called network topology. There are various types of topologies
TODO : Add images of network topology
*** Point-to-Point
It is the simplest connection with two nodes and a single link between them.
*** Daisy chaining
Also called linear topology, the nodes are connected in a series. Message will follows the whole chain till it reaches the destination. If a link fails in this topology, it is hard to find it, therefore it is not good for large networks.
*** Mesh topology
Every node is connected to another node through a direct link. In mesh topology, we use AHCP (Ad Hoc Configuration Protocol) and DHCP (Dynamic Host Configuration Protocol).
So every node is connected to every other node directly connected through a link. So if there are $N$ nodes, then the each node has $(N - 1)$ links.
If there are $N$ nodes, then in a mesh topology, the total number of links will be
\[ \text{number of links in mesh topology : } \frac{N(N - 1)}{2} \]
\[ \text{where } N \text{ is the number of nodes} \]
Advantages of mesh topology are
+ communication is fast between any pair of nodes
+ data transfer is reliable since there are dedicated links between all nodes
+ since every pair of node has dedicated link, this provides security and privacy
+ the network is more robust single a failure of single device won't break the network
Drawbacks of mesh topology are
+ installation is hard, since each link needs to be configured
+ excessive amount of cables and channels are required to connect all nodes
+ the cost of maintanance is very high
Mesh topology is of two types
1. *Full mesh topology* : it is the traditional mesh topology, where every node is connected with other node thus every node has $(N - 1)$ connections.
2. *Partial mesh topology* : a more practical implementation where it is not necessary to connect all nodes to one another. Only channels with high amount of traffic are connected. This is not the traditional way to implement mesh topology.
*** Star topology
All nodes are connected to a central node (called the hub) through links. Hubs are not communication endpoints, their function is to forward packets across all ports. The hubs can either be passive in nature or active.
Active hubs repeat and strengthen incoming transmissions, while passive hubs simply serve as a point of connectivity. Active hubs are also referred to as *repeaters*.
Advantages of star topology are
+ only $N$ links are required to connect $N$ nodes to a network
+ each device will need only one port
+ if one link fails, it won't affect other links
+ cost effictive
Drawback of star topology are
+ if the hub fails, then whole network is down
+ performace is dependant on the hubs
*** Bus topology
In bus topology, all the nodes are connected to a single backbone line. This backbone is bi-directional, there are lines from node to backbone called droplines. This topology is not robust, since if backbone is damaged, the whole network is down.
In this topology, various MAC protocols are followed like TDMA, Pure Aloha, CDMA, etc.
Advantages of Bus topology
+ there is only a single link and $N$ drop lines required
+ reduces the cost for installation
+ CSMA is the most common method for this topology
Drawbacks
+ if backbone fails, then whole network is down
+ this topology can't handle heavy traffic
+ adding new nodes slows the network
+ security is very lower
*** Ring topology
A daisy chain in a closed circular loop is called a ring topology. The most common method for communication in this topology is token passing. A *token* is a frame which is circulated around the network. The token is passed from one node to another till it reaches its destination.
Advantages
+ better for traffic than bus topology
+ cheap to install and expand
Disadvantages
+ single node failure can cause entire network to fail
+ troubleshooting is difficult
+ the topology is not secure
*** Tree topology
Also called a star-bus topology. It can be seen as multiple star topologies connected via a backbone like in bus topology. Tree topology is hierarchical and there are parent and child star networks. It uses protocols like DHCP and SAC. The backbone is like the truck of the tree and various star networks branch out from it.
The hubs connected directly to main backbone are central hubs. The hubs connected to other hubs are child hubs. This makes this topology very flexible.
Advantages
+ allows networks to prioritize different computers
+ new nodes are easy to add
+ error detection and error correction is easy
Drawbacks
+ if backbone fails the entire network is down. If a parent hub fails, then all the connected child network is down
+ cost of maintanance is high
+ reconfiguration is hard
*** Hybrid topology
A hybrid topology is when a network combines two or more topologies in a way that does not resemble standard topologies.
Advantages
+ this is very flexible
+ size of network can be easily expanded
Disadvantages
+ it is challenging to design and maintain
+ the infrastructure needs specialization to maintain
@@html:<hr />@@
** Digital Modulation
Wires carry analog signals in form of continuously varying voltage. To send digital information, we need to devise analog signals to represent bits. This process of converting bits to analog signals is called digital modulation.
*** Bandwidth and maximum data rate
Bandwidth is the measure of carrying capacity of a medium. It is measured in Hertz (Hz).
\\
Note : in many places, maximum data rate is also refered to as the bandwidth.
**** Maximum data rate for noiseless wires
Suppose our analog signal has $V$ different levels. Then for a noiseless wire with bandwidth of $B$, the maximum data rate is
\[ \text{maximum data rate} = 2\ B\ log_2V \text{ bits/sec} \]
When converting bits, if we are only using two levels, one for 0 bit and one for 1 bit. So, we can in most cases simplify the formula to
\[ \text{maximum data rate} = 2\ B \text{ bits/sec} \]
Example, a noiseless 3-kHz channel cannot transmit binary signal (two levels) at rate exceeding 6000 bps.
**** Maximum data rate for noisy wires
But the noiseless wire is an ideal case, which is not possible in real wires. Amount of noise is measured using ratio of signal power to noise power called *SNR (Signal-to-Noise Ratio)*. $S$ denotes signal power and $N$ denotes noise power. The ratio is expressed on a log scale as
\[ SNR = 10\ log_{10} (S/N) \text{ dB} \]
The unit of SNR is *decibals (dB)*
Using SNR, the maximum data rate in a noisy medium is
\[ \text{maximum data rate} = B\ log_2(1 + S/N) \text{ bits/sec} \]
*Example*, suppose SNR is of 40 dB and bandwidth is 1MHz. Then, using formula for SNR, $S/N$ is $10^4$. Therefore, the maximum data rate is
\[ \text{maximum data rate} = 1\ log_2 (10^4) \text{ Mbps}\]
\[ \text{maximum data rate} = 13.288 \text{ Mbps} \]
*** Non-Return to Zero (NRZ)
TODO : Add image
The most straightforward form of digital modulation is to use positive voltage for 1 bit and negative voltage to represent 0 bit. This scheme is called NRZ (Non-Return-to-Zero)
The NRZ signal propogates down the wire. At the other end, the reciever converts in into bits by sampling the signal at regular intervals of time. This signal won't look the same as one that was sent. It will be distorted by noise. To decode bits receiver will map signal samples to closest symbols.
The NRZ is simple, but is seldom used by itself in practice. We use more complex schemes to convert bits to signals. These schemes are called *line codes*.
*** Increasing bandwidth efficiency by symbols
Bandwidth is a limited resource, therefore we must use it efficiently.
With NRZ, the signal may cycle between positive and negative level every 2 bits (in case of alternating 1s and 0s). Therefore, atleast a bandwidth of B/2 Hz is needed when bit rate is B bits/sec.
One strategy for using the limited bandwidth is to *increase the signaling levels*. For example, by using four voltages, we can send 2 bits at once as a single *symbol*. When the number of levels is 4, the maximum data rate increases.
\[ \text{maximum data rate} = 4\ B \text{ bits/sec} \]
So, by increasing the number of levels, we can send *symbols* rather than bits to increase performance.
We call rate at which symbol changes the *symbol rate* to distinguish it from bit rate. An older name for symbol rate is *baud rate*.
\[ \text{bit rate} = \text{symbol rate } \times \text{ bits in a symbol} \]
Note: the number of levels does not need to be a power of 2.
*** Clock recovery
Clocks on both sender and reciever side are used to decode the incoming signal into bits. Suppose we are sending a signal with 20 consecutive zero's. In this case it will become hard to tell bits apart, 20 zero's will look very similar to 19 or 21 zero's.
We could use accurate clocks for this problem. But when bit rate is in multiple Mbps, the clock would need to be accurate down to less than a fraction of microsecond. Therefore, accurate clocks are not a general solution.
**** Manchester encoding
TODO : Add image
A clever trick is to *mix a clock signal with the data signal* by XORing them together. This scheme is called *Manchester Encoding*.
The clock should make a complete cycle for every bit that needs to be transmitted. Therefore, clock frequency needs to be twice of bit rate. In other words, if the bit rate is $B$ bits/sec, then the clock frequency will be $B$ Hz.
Therefore, the downside of manchester encoding is that it requires *twice as much bandwidth as NRZ*.
**** Non-Return-to-Zero Inverted (NRZI)
TODO : Add image
Clock recovery problems occur when there are long runs of 1's or 0's. NRZ-I encoding produces signals that are easy to translate with clock.
In NRZI, rather than using levels to represent bits, *we use transitions to represent bits*. Example, 1 bit will be a transition and 0 bit will be no transition. A transition is going from one level to another.
*USB uses NRZI* encoding to send bits. Long runs of 0 will still cause problems in NRZI.
**** 4B/5B
To truly fix the issue, we can break long runs of 0's by mapping group of bits to longer patterns that do not have consecutive 0's.
A well known code of this type is 4B/5B. Every *4 bits are mapped to 5 bit patterns* which are then sent as analog signals. The translation table is fixed.
The 5 bit patterns are designed in a way that *there are never more than three consecutive 0's*. This encoding will *add 25% overhead which is better than 100% overhead of manchester*.
| Data (4B) | Codeword (5B) |
|-----------+---------------|
| 0000 | 11110 |
| 0001 | 01001 |
| 0010 | 10100 |
| 0011 | 10101 |
| 0100 | 01010 |
| 0101 | 01011 |
| 0110 | 01110 |
| 0111 | 01111 |
| 1000 | 10010 |
| 1001 | 10011 |
| 1010 | 10110 |
| 1011 | 10111 |
| 1100 | 11010 |
| 1101 | 11011 |
| 1110 | 11100 |
| 1111 | 11101 |
Since there are 32 different 5 bit patterns and all of them are not used. We can have remaining patterns which don't have many successive 0's as control signals.
4B/5B is usually used in conjunction to NRZI.
**** Scrambling
Another approach is scrambling the bits to reduce chances of long runs of 0's.
A *scrambler* will XOR the data with a psuedorandom sequence before it is transmitted. This mixing will make data pseudorandom (assuming the sequence was chosen independent of data). The receiver can XOR the incoming bits with same sequence to recover the real data. Therefore, the pseudorandom sequence must be easy to create. It is usually given as seed to a simple random number generator.
*Scrambling will add no overhead.* Also, repetitive data patterns can cause electromagnetic interference. Pseudorandom data is usually "white", i.e. has more uniform spread across signals *reducing interference.*
However, since scrambling is pseudorandom there is *no guarentee that long runs won't occur.* With predictable data patterns, it is *easy for malicious users to send data that can cause long runs of 0's*, causing link to fail. Earlier standards had this defect, it was possible to send certain *"killer packets"* that caused problems.
*** Balanced signals
Signals that have almost as many positive voltages as negative voltages are called *balanced signals.* Balanced signals *average to zero*, which means they have no DC electrical component.
We need balanced signals because
+ *Many mediums* such as coaxial cables or lines with transformers *strongly reduce the DC component of signals.*
+ A method of connecting receiver called *capacitive coupling* can only pass AC signals.
+ If signal is not balanced, we waste energy because DC component is filtered out.
+ Balanced signals have *easier clock recovery* since there is a mix of positive and negative voltages.
+ It helps in *calibration of receivers* as they can check average of signals to decode symbols. In *unbalanced signals, the average drifts causing errors.*
@@html:<hr />@@

@ -0,0 +1,7 @@
* Export to HTML
#do
emacs --script src/export.el
* Remove intermediate
#do
rm main.html~

@ -0,0 +1,9 @@
;; In elisp, default-directory is the current directory
(add-to-list 'load-path "src")
;; If htmlize is outdated, just replace htmlize.el with the newer version lmao.
(require 'htmlize)
(load-theme 'tsdh-light)
(find-file "main.org")
(org-html-export-to-html)

File diff suppressed because it is too large Load Diff

@ -0,0 +1,177 @@
@import url("https://fonts.googleapis.com/css2?family=Lora:wght@500&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Inconsolata&display=swap");
body {
margin: 40px auto;
width: 700px;
max-width: 100%;
line-height: 1.6;
font-size: 16px;
background: #fbf1c7;
color: #3a1616;
padding: 0 10px;
font-size: 18px;
line-height: 28px;
font-family: "Lora";
font-weight: 500;
/* Smooth the font a little bit, it's a
bit too bold on retina screens */
-webkit-font-smoothing: antialiased;
}
/*
* Make a nice input form with rounded corners and hover animations
*/
input {
padding: 10px 16px;
margin: 2px 0;
box-sizing: border-box;
border: 2px solid #dabebe;
border-radius: 6px;
background: #fffff4;
color: #3a1616;
font-size: 16px;
-webkit-transition: 0.5s;
transition: 0.5s;
outline: none;
}
input:focus {
border: 2px solid #3a1616;
}
/*
* The button is very similar to the input
*/
.button {
background-color: #fffff4;
border: none;
color: black;
padding: 6px 14px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
border: 2px solid #3a1616;
border-radius: 6px;
}
.button:hover {
background-color: #3a1616;
color: white;
}
/*
* Various classes for messages of different kinds
*/
.isa_info,
.isa_success,
.isa_warning,
.isa_error {
width: 90%;
margin: 10px 0px;
padding: 12px;
}
.isa_info {
color: #00529b;
background-color: #bde5f8;
}
.isa_success {
color: #4f8a10;
background-color: #dff2bf;
}
.isa_warning {
color: #9f6000;
background-color: #feefb3;
}
.isa_error {
color: #d8000c;
background-color: #ffd2d2;
}
h1,
h2,
h3 {
line-height: 1.2;
font-family: "Lora";
}
img {
width: 500px;
max-width: 100%;
border-radius: 10px;
text-align: center;
}
/*
* Bold hover animations on links and clickables
*/
a {
cursor: pointer;
/* color: #217ab7; */
color: #d16286;
line-height: inherit;
transition: .14s;
}
a:hover {
color: white;
background-color: #3297d3;
}
a:visited {
/* color: #43458b; */
color: #d16286;
border-color: #43458b;
}
a:visited:hover {
color: white;
background-color: #9251ac;
}
/*
* Moving sizes of headings up
*/
h2 {
font-size: 2em;
}
h3 {
font-size: 1.5em;
}
h4 {
font-size: 1.17em;
}
h5 {
font-size: 1em;
}
pre {
font-family: "Inconsolata", monospace;
}
/*
* Fancy horizontal rule
*/
hr {
border: none;
border-top: 3px double #333;
color: #333;
overflow: visible;
text-align: center;
height: 5px;
}
hr:after {
background: #fbf1c7;
content: '§';
padding: 0 4px;
position: relative;
top: -13px;
}
::selection {
color: white;
background: #ff4081;
}
Loading…
Cancel
Save