Cloud and Container Basics

Among the Linux kernel features that make containers possible, which of the following correctly pairs namespaces and cgroups (control groups) with their roles?

  1. ANamespaces: separate what a process can see (process IDs, network, mounts, etc.); cgroups: limit and account for the use of resources such as CPU and memory
  2. BNamespaces: limit and account for the use of resources such as CPU and memory; cgroups: separate what a process can see (process IDs, network, mounts, etc.)
  3. CNamespaces: boot a separate kernel for each container to isolate them; cgroups: create a virtual CPU for each container and emulate the hardware
Show answer and explanation

Answer: A. Namespaces: separate what a process can see (process IDs, network, mounts, etc.); cgroups: limit and account for the use of resources such as CPU and memory

A container is an ordinary process running on the host kernel, isolated by two mechanisms. Namespaces split process IDs, the network, mounts (the view of the file system), the host name and so on into groups, so that the processes in a container see only their own share. Cgroups limit the CPU time and amount of memory a group of processes can use and account for their usage. Both are kernel features, so a container neither boots another kernel nor emulates hardware.

  • A. Correct. Namespaces handle "what is visible" and cgroups handle "how much can be used".
  • B. The roles are swapped. Cgroups limit the amount of resources, and namespaces separate the view.
  • C. Running a separate kernel or emulating hardware is how virtual machines on a hypervisor work. Containers share the host kernel.
Practice this topic Back to topic

Books on Cloud and Container Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Cloud and Container Basics questions

  1. On a Linux host, Docker is used to start a container from an image based on a different distribution from the host, and uname -r (which shows the kernel release) and cat /etc/os-release (which shows information about the distribution) are run inside it. Which of the following correctly describes the results?
  2. Which of the following correctly describes the relationship between a container image and a container?
  3. Inside a container started from an image, the configuration file /etc/app.conf, which is part of the image, is modified. Which of the following correctly describes what happens with Docker's usual storage mechanism (such as overlay2)?
  4. To unpack a 500 MB archive, data.tar.gz, an image was built with the Dockerfile above. Although the archive was deleted in the same RUN after unpacking, the image remained larger by the size of the archive. Which of the following is the most appropriate pair of reason and remedy?
  5. There are five images, each of which stacks its own 30 MB layer on the same base image (120 MB). Layer compression and the size of metadata are ignored. Which of the following is the disk space used by the images when all five are pulled to one server?