diff --git a/slides/intro/Namespaces_Cgroups.md b/slides/intro/Namespaces_Cgroups.md index c27fae3a..f5819678 100644 --- a/slides/intro/Namespaces_Cgroups.md +++ b/slides/intro/Namespaces_Cgroups.md @@ -808,7 +808,7 @@ $ sudo mkdir $CG Limit it to approximately 100MB of memory usage: ```bash -$ sudo tee $CG/memory.memsw.limit_in_bytes <<<100000000 +$ sudo tee $CG/memory.memsw.limit_in_bytes <<< 100000000 ``` Move the current process to that cgroup: @@ -819,6 +819,59 @@ $ sudo tee $CG/tasks <<< $$ The current process *and all its future children* are now limited. +(Confused about `<<<`? Look at the next slide!) + +--- + +## What's `<<<`? + +- This is a "here string". (It is a non-POSIX shell extension.) + +- The following commands are equivalent: + + ```bash + foo <<< hello + ``` + + ```bash + echo hello | foo + ``` + + ```bash + foo < $CG/tasks" +``` + +The following commands, however, would be invalid: + +```bash +sudo echo $$ > $CG/tasks +``` + +```bash +sudo -i # (or su) +echo $$ > $CG/tasks +``` + --- ## Testing the memory limit