skip to content

Server Runtimes & Process Management

The runtimes and supervisors that actually keep a backend process alive — Node, Bun, Deno, .NET — plus the process managers wrapped around them. Interviewers ask because 'it works on my laptop' and 'it survives production' are different problems, and the gap lives here.

on this pageshow

explore

questions

197 · 3 sections

In Node.js, how do Buffer.from(string, encoding) and buf.toString(encoding) convert between text and bytes, and why can a string's length differ from Buffer.byteLength()?

level: juniorimportance: must knowfreq 60%
basics
~20 s

Buffer.from(str, enc) encodes a string into bytes and buf.toString(enc) decodes bytes back, both defaulting to utf8; base64 and hex render bytes as text. A string's length counts UTF-16 code units, while Buffer.byteLength() counts encoded bytes.

open as a page

What does Node's cluster module do, and how does one entry script know whether it is running as the primary or a worker?

level: juniorimportance: must knowfreq 60%
basics
~20 s

Node's cluster module runs one script as a primary that calls cluster.fork() and as worker processes that share its server ports. cluster.isPrimary, derived from an environment variable the primary sets for each worker, tells the script which role it has.

open as a page

In Node.js, what type does every value in process.env have, and why does a check like if (process.env.CACHE_ENABLED) misfire?

level: juniorimportance: must knowfreq 55%
basics
~10 s

Every process.env value is a string, or undefined when the variable is unset. CACHE_ENABLED=false yields the non-empty string 'false', which is truthy, so the branch runs; parse and compare values explicitly.

open as a page

In Node.js, how does the error-first callback convention work, and what rules must a callback-style API and its caller follow?

level: juniorimportance: must knowfreq 70%
basics
~20 s

A Node.js callback API calls its last argument as callback(err, result): err is an Error on failure and null on success. The caller checks err first and returns; the API calls back exactly once, always asynchronously.

open as a page

In Node.js, what does registering process.on('uncaughtException') change about a crash, and why is it unsafe to keep serving afterwards?

level: juniorimportance: must knowfreq 70%
basics
~20 s

A process 'uncaughtException' listener replaces Node's default of printing the stack trace and exiting with code 1, so the process keeps running. Its state is now unknown, so the handler should log synchronously, clean up and exit non-zero.

open as a page

In .NET, what runs the delegate you pass to Task.Run, and how does a thread pool thread differ from one created with new Thread?

level: juniorimportance: must knowfreq 62%
basics
~20 s

Task.Run queues the delegate to the process's single managed thread pool, where a reused worker thread runs it. Pool threads are background threads the runtime creates and retires itself; new Thread gives you a dedicated foreground thread that you own.

open as a page

In .NET, why should an invoicing service record payment and due instants as DateTimeOffset rather than DateTime, and what does DateTime.Kind fail to capture?

level: juniorimportance: must knowfreq 62%
basics
~20 s

A DateTime carries only a Kind flag (Utc, Local or Unspecified), and equality ignores it, so values from different zones mix silently. DateTimeOffset stores the UTC offset and compares by instant, though an offset is not a time zone.

open as a page

In .NET, what does the C# compiler put into an assembly, and when does the JIT turn a method into machine code?

level: juniorimportance: must knowfreq 65%
basics
~20 s

The C# compiler emits IL, a CPU-independent instruction set, plus metadata describing every type, member signature and reference. At run time the JIT compiles each method to native code on its first call, and later calls in that process reuse it.

open as a page

In .NET, what are garbage-collection generations 0, 1 and 2, and how does an object move from one to the next?

level: juniorimportance: must knowfreq 75%
basics
~20 s

The .NET GC puts new small objects in gen 0; an object that survives a gen 0 collection is promoted to gen 1, and one that survives a gen 1 collection to gen 2, which only a full (gen 2) collection reclaims.

open as a page

In .NET, how do Parallel.ForEach and Parallel.ForEachAsync differ for an image-resizing job, including each one's default degree of parallelism?

level: middleimportance: must knowfreq 55%
basics
~20 s

Parallel.ForEach blocks the caller, runs an Action<T> per item on pool threads plus the calling thread, and sets no upper bound on parallelism by default. Parallel.ForEachAsync (.NET 6) returns a Task, awaits a ValueTask-returning body and defaults to Environment.ProcessorCount.

open as a page

Which Laravel Octane features work only on Swoole or Open Swoole, and what happens to each if the app runs on FrankenPHP or RoadRunner?

level: juniorimportance: must knowfreq 30%
basics
~20 s

Concurrent tasks, ticks and intervals, the octane cache store and Swoole tables need Swoole or Open Swoole. Elsewhere Octane::concurrently runs tasks one after another, the octane store is a per-worker array, ticks never fire and Octane::table() throws.

open as a page

In Laravel Octane, what do octane:install and the OCTANE_SERVER variable decide, and how does octane:start choose which server to launch?

level: juniorimportance: must knowfreq 45%
basics
~10 s

octane:install asks for FrankenPHP, RoadRunner or Swoole, sets up what that server needs, publishes config/octane.php and writes OCTANE_SERVER to .env. octane:start launches --server if given, otherwise config('octane.server'), on 127.0.0.1:8000.

open as a page

Under Laravel Octane, how often do service providers' register() and boot() methods run, and why is reading request() or auth()->user() inside boot() a bug?

level: juniorimportance: must knowfreq 50%
basics
~20 s

Under Octane, providers' register() and boot() run once per worker, at boot. The request then is a synthetic GET built from app.url and nobody is logged in, so whatever boot() reads from request() or auth() is wrong for real requests.

open as a page

After deploying new code to a Laravel Octane server, why do you run octane:reload, and when do you need a full restart instead?

level: middleimportance: must knowfreq 55%
basics
~20 s

Octane workers keep the old code in memory, so a deploy is ignored until they restart; octane:reload restarts them gracefully inside the running server. Options fixed at start - port, worker count, max_execution_time, the driver - need a stop and start.

open as a page

After moving a Laravel banking API to Octane, some responses show the previous customer's accounts; which Octane-specific state is carrying them over, and how do you fix it?

level: seniorimportance: must knowfreq 45%
basics
~20 s

Octane clones one booted app per request, but instances resolved at boot or warmed, and static properties, are shared by every request on the worker. A singleton or static cache that memoizes the current customer serves them to the next request.

open as a page