Parts of this architecture are aspirational - implementation is actively underway to fully realize the design described here.
Core architecture principles
The Ladybird architecture is built on several key principles:- Process isolation: Separate processes for different concerns (rendering, networking, decoding)
- Aggressive sandboxing: All processes except the main Browser run with restricted permissions
- Unprivileged execution: Helper processes run as separate users from the desktop user
- Event-driven design: LibCore’s EventLoop system handles concurrent tasks cooperatively
Multi-process architecture
Every instance of the Browser application can have one or more tabs open. Each tab spawns a unique WebContent service process to handle rendering and execution.Browser process
Main UI process that manages tabs and user interaction
WebContent process
Hosts LibWeb rendering engine and LibJS JavaScript engine
RequestServer process
Handles all network requests via HTTP/HTTPS protocols
ImageDecoder process
Decodes images in isolated, sandboxed processes
Security model
All processes are aggressively sandboxed usingpledge() and unveil() mechanisms. Furthermore, all processes except Browser run as an unprivileged user, separate from the primary logged-in desktop user.
Component overview
The architecture separates concerns across multiple specialized components:LibWeb rendering engine
LibWeb is the core HTML/CSS rendering engine that powers web content display. It implements:- HTML parsing and DOM tree construction
- CSS parsing and style computation
- Layout tree generation and positioning
- Paint tree creation and rendering
LibJS JavaScript engine
LibJS provides JavaScript execution capabilities within the WebContent process. It features:- JavaScript parsing and AST generation
- Bytecode interpreter
- Garbage collection (mark & sweep)
LibCore event system
LibCore provides the foundational event loop system used throughout Ladybird. The event loop handles:- POSIX signals
- Timer events
- File descriptor notifications
- Deferred callbacks
Process communication
Processes communicate using IPC (Inter-Process Communication) protocols:- Browser ↔ WebContent: Passes input events and receives painted bitmaps
- WebContent ↔ RequestServer: Makes network requests for resources
- WebContent ↔ ImageDecoder: Sends encoded data and receives decoded bitmaps
The
OutOfProcessWebView widget in the Browser process manages spawning and communication with all helper processes.Process spawning
Helper processes are spawned on-demand through Unix domain sockets:- WebContent: Spawned by connecting to
/tmp/session/%sid/portal/webcontent - RequestServer: Spawned by WebContent as needed for network operations
- ImageDecoder: Spawned by WebContent for each image decoding task
/tmp/session/%sid/portal/webcontent is managed by SystemServer, which spawns a new WebContent instance for every connection.
Next steps
Process architecture
Deep dive into multi-process design and IPC protocols
Event loop
Learn how LibCore’s event system works
LibWeb pipeline
Explore the rendering pipeline from loading to painting