Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungFliproom: a room changeover is a content problem(21.09.2026 um 04:10 Uhr)
Sichere ProgrammierungNova Adiutrix: My Second Agent Built My First Project's To-Do List(21.09.2026 um 04:11 Uhr)
Sichere ProgrammierungFliproom: a room changeover is a content problem(21.09.2026 um 04:10 Uhr)
Sichere ProgrammierungNova Adiutrix: My Second Agent Built My First Project's To-Do List(21.09.2026 um 04:11 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Linux cgroups: Limiting Process Resources Without the Pain

Reagiere als Erste:r — dein Feedback zählt!

Linux cgroups: Limiting Process Resources Without the Pain

Let me share something I ran into last week that might save you a headache.

Had a script that was eating too much memory and killing adjacent services. The fix was simpler than I expected — systemd-run.

The Quick Fix

Instead of chasing down every poorly-written script and adding manual resource limits, you can just run the command with resource constraints upfront:

systemd-run --scope -p MemoryLimit=256M your-script.sh

That's it. The script gets its own scope with a 256MB memory cap. When it tries to allocate more, the OOM killer handles it gracefully instead of taking down the whole machine.

Why This Is Handy

The thing I like about systemd-run is that you don't need to edit service files or reboot. It's just a wrapper around the cgroups interface that systemd already manages.

If you want persistent limits — like for a service that should always have constraints — you edit the unit file:

[Service]
MemoryMax=512M
CPUQuota=50%

A Couple of Flags Worth Knowing

MemoryHigh — this is the threshold where the kernel starts reclaiming memory aggressively. Useful if you want to warn before hitting the hard limit.

CPUQuota — takes a percentage. CPUQuota=50% means the service never gets more than half a CPU core, even if idle.

The cgroupfs Path (If You Need It)

For debugging, you can see what's actually happening:

cat /sys/fs/cgroup/systemd/system.slice/your-service.scope/memory.max

Each scope gets its own cgroup. You can read the limits, see current usage, and poke around without touching anything.

When I Reach for This

  • Scripts that call out to third-party binaries I don't trust
  • One-off batch jobs that might go sideways
  • Isolating services on shared homelab hardware
  • Testing how software behaves under memory pressure

It's not a silver bullet, but it's one of those tools that's cleaner than the alternatives I used to use (ulimit, nice, cgroups manually via /sys/fs/cgroup/).

Give systemd-run a shot next time you need to contain something. The manual pages are actually decent on this one.

Image: cgroups provide a hierarchical structure for resource control on Linux

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Linux cgroups: Limiting Process Resources Without the Pain

Thematisch verwandte Begriffe: Linux, cgroups, Limiting, Process · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-93977 | A vulnerability was determined in code-projects Assessment Management 1.…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick