Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In Elixir OTP, a GenServer implements a process-facing service, a supervisor starts and monitors child processes and applies their restart rules, and an OTP application packages functionality with a lifecycle that commonly starts a top-level supervision tree. These pieces work together, but they solve different problems: a process is not automatically needed for every value or calculation.

Examples here target Elixir v1.20.4, which the official documentation marked stable on October 4, 2026. That release lists Erlang/OTP 27, 28, and 29 as supported; the installation guide says Elixir v1.20.4 requires Erlang 27.0 or later. Check the official documentation index and installation guide against your installed toolchain, since compatibility changes over time.

What is a GenServer in Elixir?

A GenServer is Elixir’s generic server behavior: it provides standard process-loop and interaction machinery, while you define the service’s callbacks and domain behavior. The official API describes it as “A behaviour module for implementing the server of a client-server relation.” A GenServer process can own state and handle messages, and the behavior gives it familiar callback conventions, tracing and error-reporting support, and compatibility with supervision trees. See the GenServer API documentation.

A typical server initializes state in init/1, handles synchronous requests in handle_call/3, and handles asynchronous casts in handle_cast/2. Of these callbacks, only init/1 is required. For example, a stack server might remove an item and return it from handle_call/3, while its handle_cast/2 adds an item without returning a result to the sender.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Callers should generally use a small public API on the server module rather than invoke callbacks directly. That keeps users of the service independent of its message and callback details.

When does a GenServer make sense?

Use one when the design benefits from a long-lived process identity, message handling, serialized access to state, or supervision and restart behavior. A GenServer is not a requirement for all mutable data: if a value can be passed into an ordinary function and returned as an updated value, that simpler design may be enough.

What is the difference between GenServer.call and GenServer.cast?

The practical difference is whether the caller needs a reply and must coordinate around it. A call is synchronous: it waits for the server’s reply, which is produced by handle_call/3. A cast is asynchronous: it sends a message handled by handle_cast/2, but gives the caller no reply confirming that application-level work completed.

Operation Server callback What the caller gets Use when
GenServer.call/2 (or another call arity) handle_call/3 A reply; the caller waits for it. The caller needs a result or must coordinate with the server before continuing.
GenServer.cast/2 (or another cast arity) handle_cast/2 No application-level reply; the caller continues without waiting for completion. The caller can send a message without needing a result from that operation.
Raw process message handle_info/2 Not a GenServer call-and-reply exchange. The process must handle messages sent outside the call and cast interfaces.

These are different coordination contracts, not a universal performance ranking. A cast is not proof that the server received, processed, or completed the requested work.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

What does a supervisor do in Elixir?

A supervisor is a process that starts and monitors child processes. Its child specifications describe how children start and how they should be shut down or restarted. When a child terminates, the supervisor applies both the child’s restart setting and the supervisor’s strategy.

Supervision is fault recovery, not automatic restoration of a crashed process’s in-memory state. If a GenServer restarts, it initializes again; unless state is recovered from some other source, it starts from its initial state. For example, a counter that restarts at its configured initial value has not recovered the count it held before crashing. The official Supervisor documentation explains: “Supervision trees provide fault-tolerance and encapsulate how our applications start and shutdown.”

What is a supervision tree?

A supervision tree is the hierarchy of supervisors and the processes they supervise. A top-level supervisor can supervise other supervisors as well as service processes, allowing related components to have explicit startup, shutdown, and recovery relationships. This hierarchy is commonly the process structure started by an application’s callback.

What is the difference between one_for_one and one_for_all?

A supervisor strategy determines how sibling children are affected when one child terminates. Choose it according to actual lifecycle dependencies: are children independent, ordered, or dependent on one another?

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Strategy Effect when a child terminates Best fit
:one_for_one Restart the failed child without restarting its siblings. Children are independent enough to recover separately.
:rest_for_one Restart the failed child and children started after it in the supervisor’s child order. Later children depend on earlier children, so they should be restarted when an earlier dependency fails.
:one_for_all Restart all children when one child terminates. Children form a mutually dependent unit that must be restarted together.

For example, if a connection process is started before a worker that uses that connection, :rest_for_one can express that failure of the connection requires restarting the later worker. With :one_for_one, the worker would not be restarted as part of that failure response; with :one_for_all, every sibling would restart. These strategies are not interchangeable defaults: their effect should match the relationships among the children.

What do child specs and restart values mean?

A child specification tells a supervisor which child it is managing and how to start, shut down, and restart it. Elixir accepts a child-spec map or a module or {module, argument} form when the module supplies child_spec/1. Using use GenServer defines a child_spec/1 for that module, so it can be passed to a supervisor as a child.

The child’s :restart value is separate from the supervisor strategy. The restart value says whether that child should be restarted for a given exit reason; the strategy says how its siblings are affected.

Restart value Behavior Typical intent
:permanent Always restart the child. A service intended to remain running under supervision.
:temporary Never restart the child. A child whose termination ends its supervised work.
:transient Restart after abnormal termination, but not after normal termination or a shutdown reason. A child that should recover from failure but can finish or shut down deliberately.

For instance, a :permanent GenServer child can be restarted after termination, while :one_for_one governs whether its siblings are also restarted. Consult the current Supervisor reference when setting child-spec details for a particular kind of process.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How do I start a GenServer under a supervisor?

Define a GenServer module, then include its child specification in a supervisor’s children list. The supervisor starts the process and applies its child and tree policies if it terminates.

  1. Implement the server with use GenServer and an init/1 callback to establish initial state. Add handle_call/3 and/or handle_cast/2 for the messages the service needs.

  2. In the supervisor’s init/1, include the module in its children list, for example children = [MyApp.Cache], when that module provides child_spec/1.

  3. Return a supervisor configuration, such as Supervisor.init(children, strategy: :one_for_one), from the supervisor’s init/1.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    Best Value
    Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
    • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
    • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
    • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
    • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
    • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
  4. Start the supervisor, commonly from an OTP application’s start/2 callback. The supervisor starts the GenServer child as part of its tree.

For a child whose start arguments or restart behavior need customization, provide an explicit child-spec map or an appropriate child-spec override rather than assuming the default settings fit every service.

What is an OTP application?

An OTP application is a standardized package of functionality with configuration and a lifecycle; it is not an operating-system process. Applications can be loaded, started, and stopped. In a Mix project, application information is declared by the project, and an application callback module can define start/2. That callback commonly starts and returns the top-level supervisor, which starts the application’s supervised process tree.

The official Application API documentation summarizes the lifecycle: “Applications are loaded, started, and stopped.” It also describes each application’s environment as a keyword list mapping atoms to terms. This application environment is not the operating system’s environment, and the API cautions libraries against using it as general-purpose global storage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How does an Elixir application start and stop?

At a high level, an OTP application is loaded, then started; its callback starts the top-level supervisor, which starts its children according to their specifications. When the application stops, its supervised processes are shut down through the supervision structure and the application’s stop callback can perform application-level cleanup. The precise lifecycle belongs to the OTP application and supervisor machinery, rather than to a single GenServer.

How should Mix configuration fit into startup?

Mix distinguishes build-time configuration from runtime configuration. In a Mix project, config/config.exs is loaded at build time, while config/runtime.exs is loaded at runtime just before the application starts. Put values that must be supplied or adjusted at deployment startup in runtime configuration rather than assuming build-time settings will be reevaluated there. See the Application documentation for application configuration and lifecycle details.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.