Pantrypoints Pantrypoints

OTP

August 22, 2023 1 minutes  • 158 words
Table of contents

OTP is made up of:

Image
  1. Elxir Tool Set
  • mix: a build tool
  • application: sets the other independent Modules that will run
  1. Erlang OTP Features
  • ETS : Erlang Term Storage
  • mnesia : Database Management System
  • crypto
  1. Behaviors
  • GenServer: has client and server
  • Supervisor: manages workers in a GenServer
  • Protocols: allows polymorphism. An example of a bult-in protocol is String.Chars

OTP Processes and State Management

This allows functions to hold data independent of the function which is really held through the Genserver. This makes the OTP a real app.

Processes

  • runs the actual functions and modules in memory
  • has PID

Tasks: Start-Stops a Function or Module on a Process

  • Runs a single process such as polling
  • 1 task : 1 process
  • has no state
Task.start(function_name)

Agents: Adds Lightweight State management on a Process

Only gets and updates single states. This makes it faster.

Genservers: Adds Heavy Duty State management on a Process

Gets, manipulates, and updates states by allowing “messages”.

Follow Us! →

We're creating a new Economic System from a new Economic Science! Please support us by leaving your email or leaving a comment above.