7/22/2023 0 Comments Linux beancounter![]() In the above picture, we can see pages in the virtual memory that exist physically in either the RAM or the HD. One user could technically put all the others out of business by starting up some processes that are able to fill up the entirety of the physical RAM. As the hard disk is a much slower medium, this is a situation to avoid, especially when many users need to make use of the same system. When a lot of processes start actually using most of their virtual pages, the RAM might not suffice, and will need to swap certain data to the first available storage space to make room: the hard disk. The issue here is that the total amount of virtual memory for all processes is usually much larger than what is available in the RAM. This way, each process works with the impression that the full amount of virtual pages is always available, and even though it isn't currently using the free pages, it can do so in the future if the need arises. Instead of receiving the full amount on the physical RAM, it is given an amount of "virtual" pages, so that only the number of pages actually used are loaded into the RAM, while "empty" pages remain free for other processes to use. ![]() Processes can make requests for extra memory pages, without necessarily putting them to use immediately or even using them at all. The following paragraphs dip into the logic behind the system a bit more deeply, and discuss some of the challenges faced in allocating memory to several containers while showing examples of how beancounters can be put to use in a container-based environment. We'll try to cover the actual accounting of some types of resources as short and as clear as possible.Īccounting of memory is divided into several parts and discussing all of them would fill up several pages. We're able to see the current status of beancounters for each existing container by outputting the contents of /proc/user_beancounters ![]() The rows, in turn, contain the different types of resources the BC can keep track of, including but not limited to: Furthermore, an absolute limit for moments of burst usage and the number of failed allocations due to a shortage of still available resources can be tracked. Think of the BC as containing a sort of table, of which the columns contain the resources currently held, the maximum of resources held during the session and a barrier value, at which the BC will send a warning to the kernel to stop allocating resources. From that point on, the BC controls the maximum amount of resources available to that container. As a result, each of its child processes is bound to it. Upon creation, the process is assigned to a beancounter object by the OpenVZ software. ![]() Readers familiar with Linux-based systems will recognize this process as the proverbial mother of all processes, and in containers it is no different. However, upon creation of a new container, an "init" process is made for it. Since containers are no more than groups of processes, actual allocation of memory and other resources requires no large changes. These kernel-level objects keep track of the resources available and can notify the kernel of user space processes that are overstepping their boundaries. ![]() Of these resources, memory is the most notable, so an important task is to keep track of the amount of pages each process is allowed to use.įor this reason, OpenVZ has implemented an addition to the kernel called beancounters (BC). Current day resource management in Linux is certainly adequate for management of a conventional operating system, but when trying to provide limited resource sets for contained groups of processes, it falls a bit short. ![]()
0 Comments
Leave a Reply. |