# \[ANN\] Malt.jl – Distributed alternative (used internally by Pluto)

**URL:** https://discourse.julialang.org/t/ann-malt-jl-distributed-alternative-used-internally-by-pluto/108401
**Category:** Package Announcements
**Tags:** package, announcement, distributed, pluto
**Created:** [January 5, 2024, 6:01pm UTC](https://discourse.julialang.org/t/ann-malt-jl-distributed-alternative-used-internally-by-pluto/108401 "2024-01-05T18:01:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![fonsp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fonsp/32/222349_2.png) [@fonsp](https://discourse.julialang.org/u/fonsp)
#### Post date: [January 5, 2024, 6:01pm UTC](https://discourse.julialang.org/t/ann-malt-jl-distributed-alternative-used-internally-by-pluto/108401/1 "2024-01-05T18:01:23Z")

</div>

We are happy to announce [Malt.jl](https://github.com/JuliaPluto/Malt.jl) 1.0 – simple multiprocessing for Julia. Malt allows the creation and remote control of other Julia “worker” processes. Pluto uses Malt behind the scenes, using a Malt worker for every notebook to execute code.

# Basic example

```julia-repl
julia> import Malt

julia> worker = Malt.Worker();

julia> Malt.remote_eval_fetch(worker, :(1 + 1))
2

julia> Malt.remote_eval_fetch(worker, :(rand(5))) |> sum
3.0618168580350966

```

# **Malt** vs **Distributed**

Malt is inspired by the [`Distributed standard library`](https://docs.julialang.org/en/v1/stdlib/Distributed/), but with a focus on process sandboxing, not distributed computing. Important differences are:

## API changes

Malt has different function names, see our [**documentation**](https://juliapluto.github.io/Malt.jl).

One important addition is public API for **evaluating an `Expr`** :

```julia
worker = Malt.Worker()

Malt.remote_eval_fetch(worker, :(sqrt(123)))

```

## Nested use

With Malt, any **worker** process can also be a **host** process to its own workers.

In Distributed, only “process 1 can add or remove workers”. Malt does not have this limiation. _This means that Malt workers can use Distributed (and Malt) like a regular Julia process._

## Process isolation

Malt worker processes **do not inherit** `ENV` variables, command-line arguments or the Pkg environment from their host.

## Interrupt on Windows

Malt supports **interrupting a worker process on Windows** , not just on UNIX.

## No heterogenous computing

Malt does not have API like `@everywhere` or `Distributed.procs`: Malt is **not the right tool for heterogenous computing**.

## Exception handling

Exceptions in Malt workers are converted to plaintext before being rethrown in the host.

The original exception object is only available to the worker. In Distributed, the original exception object is serialized and rethrown to the host.

## Faster launch

Malt launches workers \>50% faster.

```julia-repl
julia> @time Distributed.addprocs(1);

2.064801 seconds (11.63 k allocations: 1.093 MiB, 1.08% compilation time)

julia> @time Malt.Worker();

0.964955 seconds (537 allocations: 308.734 KiB)

```

# Thank you!

Malt was created by the awesome [Sergio A. Vargas](https://github.com/savq) (@savq) during GSoC 2022, under mentorship of [Paul Berg](https://github.com/pangoraw) (@Pangoraw), inspired by the original Distributed stdlib. [Nehal Patel](https://github.com/habemus-papadum) (@habemus-papadum) was very helpful with the tricky networking and performance work, and [JuliaHub](https://juliahub.com/) sponsored [me](https://github.com/fonsp) to complete the work and integrate the package with [Pluto.jl](https://plutojl.org/).

---

<div class="post-metadata">

### Author: ![stillyslalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stillyslalom/32/45687_2.png) [@stillyslalom](https://discourse.julialang.org/u/stillyslalom)
#### Post date: [January 5, 2024, 6:28pm UTC](https://discourse.julialang.org/t/ann-malt-jl-distributed-alternative-used-internally-by-pluto/108401/2 "2024-01-05T18:28:54Z")

</div>

Very glad to see Windows process interrupt - thanks to the Pluto team for addressing a real pain point for those of us stuck on Windows! This should significantly reduce the need to kill and restart Pluto notebooks.

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [January 5, 2024, 6:29pm UTC](https://discourse.julialang.org/t/ann-malt-jl-distributed-alternative-used-internally-by-pluto/108401/3 "2024-01-05T18:29:30Z")

</div>

Looks cool - when did pluto start using this?

---

<div class="post-metadata">

### Author: ![fonsp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fonsp/32/222349_2.png) [@fonsp](https://discourse.julialang.org/u/fonsp)
#### Post date: [January 5, 2024, 7:14pm UTC](https://discourse.julialang.org/t/ann-malt-jl-distributed-alternative-used-internally-by-pluto/108401/4 "2024-01-05T19:14:42Z")

</div>

Pluto did a gradual roll-out of Malt:

- [18 Sep 2023](https://github.com/fonsp/Pluto.jl/pull/2240) – available as option with `Pluto.run(workspace_use_distributed_stdlib=false)`
- [31 Oct 2023](https://github.com/fonsp/Pluto.jl/pull/2695) – enabled by default on Windows
- [15 Jan 2024](https://github.com/fonsp/Pluto.jl/pull/2767) – enabled by default on all systems
