Random Computer Rambles

1. Algorithms   algo

a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.

1.0.1. RNGs   rand

  1. Permuted Congruential Generator

1.0.2. Binary Search   search

  • A very common algorithm used to find the index of a specific item in a

sorted array.

  • Array must be sorted
  • Executes in logarithmic time
  • Faster than linear search (except for very small arrays)
  • Can be applied easily in many situations
  • There are many variations of binary search such as fractional cascading and exponential search
  • Many data structures provide a better overall design for fast optimal searches, such as Hash Tables
  • Binary Search Tutorials & Notes | Algorithms | HackerEarth

1.0.3. Merge sort   sort

A divide and conquer algorithm for sorting an array. The array is split into immutable chunks and then all chunks are merged in sorted order.

  • Invented by John von Neumann in 1945

1.0.4. Lubachevsky–Stillinger algorithm   granular_flow

Lubachevsky-Stillinger (compression) algorithm (LS algorithm, LSA, or LS protocol) is a numerical procedure suggested by F. H. Stillinger and B.D. Lubachevsky that simulates or imitates a physical process of compressing an assembly of hard particles. As the LSA may need thousands of arithmetic operations even for a few particles, it is usually carried out on a computer.

An acoustic phenomena of interest: Singing sand

1.0.6. ROT13   cipher

A very simple, symmetrical substition cipher that shifts a character by 13 positions. Since the standard alphabet has 26 characters, this operation is its own inverse.

  • The canonical example of weak encryption.

2. Networks   net

2.1. Models

2.1.1. Client-Server Model

  • https://en.wikipedia.org/wiki/Client%E2%80%93server_model
  • A distributed application architecture model
  • usually used to describe a networked service where multiple Clients communicate with a single Server
  • The term 'work' is used to describe the inputs and outputs of such a model. The 'work' performed is strictly scoped.
    • For example, consider the architecture for an MMO video game. The client-server model applies to the design of Players (Clients) connecting to a match, which is hosted on the game server (Server). The 'work' performed here may include updates to a Player's in-game position based on control input, chat messages, connection status, etc.
    • In addition to communicating with the game server, Players may establish direct connection to other Players in their match in a client-to-client or decentralized manner, where 'work' is shared and managed between the Clients themselves, under authority of the Server. This is where terminology begins to miss the point, as these features share a likeness to p2p networking.

2.1.2. Peer-to-peer Networking

Peer-to-peer (P2P) computing or networking is a distributed application architecture that partitions tasks or workloads between peers. Peers are equally privileged, equipotent participants in the application. They are said to form a peer-to-peer network of nodes.

Peers make a portion of their resources, such as processing power, disk storage or network bandwidth, directly available to other network participants, without the need for central coordination by servers or stable hosts. Peers are both suppliers and consumers of resources, in contrast to the traditional client–server model in which the consumption and supply of resources is divided.

2.2. Protocols

2.2.1. TCP   transport

2.2.2. UDP   transport

  1. UDP vs TCP
    • UDP and TCP share the same space in a network stack and operate on top of the IP protocol.
    • UDP has no built-in notion of State, TCP does. However, stateless protocols can be built on lower-level stateful ones.. and vice-versa. It's just a matter of abstraction.

      • for example HTTP is a stateless protocol, built

      on TCP (stateful), which is built on IP (stateless)

    • TCP provides connection guarantees that a client receives packets IN ORDER and exactly in the condition they were sent (thanks to checksums in headers), at the cost of some performance (to ensure packet sequencing, checking headers, establishing connection, etc)
      • UDP does NOT provide connection guarantees.
        • UDP does have checksums though, and thus ensures packets are received in same condition that they were sent.
      • Packets can be sent and lost, it doesn't intrinsically matter in UDP that the client didn't receive them.
      • The loss of built-in guarantees does come with a performance boost though, as well as a network protocol that is quite flexible in its simplicity.
    1. The need for speed

      UDP is on the rise in networks due to the usage of P2P services, and the need for more immediate methods of streaming media data at scale. Analyzing UDP usage in Internet traffic

  2. resources

2.2.4. HTTP

Hypertext Transfer Protocol (HTTP) is an application-layer protocol for transmitting hypermedia documents, such as HTML. It was designed for communication between web browsers and web servers, but it can also be used for other purposes. HTTP follows a classical client-server model, with a client opening a connection to make a request, then waiting until it receives a response. HTTP is a stateless protocol, meaning that the server does not keep any data (state) between two requests. Though often based on a TCP/IP layer, it can be used on any reliable transport layer, that is, a protocol that doesn't lose messages silently like UDP does. RUDP — the reliable update of UDP — is a suitable alternative.

  1. HTTPS

    HTTPS consists of HTTP with the addition of TLS.

  2. HTTP/S

    HTTP/S is often used as a blanket statement for both HTTP and HTTPS.

2.2.5. WebSocket

rfc
6455
(no term)
layer on top of TCP
(no term)
The WebSocket API (WebSockets) - Web APIs | MDN

2.2.6. QUIC

  • https://www.chromium.org/quic

    Transport-layer network protocol, part of the Chromium project.

    • Leverages the benefits of building on top of UDP instead of TCP
    • Designed as a re-implementation of TCP+TLS+HTTP/2
    • Great documentation (ty Mr. Google) + has Rust implementations (yay!) which leads us to:
    • Quinn
      • Rust implementation of the QUIC protocol.
      • Super awesome-cool
      • provides an API built with tokio
      • provides the core deterministic state machine of the protocol via quinn-proto
    • Playing With QUIC provides documentation on how to set up a test client/server from the chromium source, a bit verbose for our needs but relevant
  1. QUIC at 10,000 feet   net
  2. drafts

2.3. links