I am trying to fix a problem that occurs when using unsecured file I / O buffers in several programs in different languages ββrunning on Linux. The solution for flushing buffers is quite simple, but the question of non-fading buffers is rather random. Instead of asking for help on what might cause this, I'm interested in how to create (reproduce) and diagnose a similar situation.
This leads to a two-part question:
Is it possible to artificially and easily build instances in which output buffers, which, as you know, are not unlocked, can be created over a certain period of time? My searches are empty. The trivial baseline is to clog a hard drive (e.g. swap) in one process, trying to write a large amount of data from another process. Although this "works", it makes the system almost unusable: I can not poke and see what happens.
Are there any Linux commands that can identify that a given process has loose output buffers? Is this something that can be run on the command line or you need to query the kernel directly? I watched fsync , sync , ioctl , flush , bdflush and others. However, without a method for creating unbound buffers, it is unclear what they might reveal.
To reproduce for others, the example for # 1 in C would be excellent, but the question is really linguistic agnostic - just knowing the approach to creating this situation will help in other languages ββin which I work.
Update 1: I apologize for any confusion. As several people have noted, buffers can be in kernel space or in user space. This helped identify problems: we create large dirty kernel buffers. This distinction and answers fully resolve No. 1: it now seems clear how to recreate unexpanded buffers in user space or in kernel space. The identification of a process identifier with dirty kernel buffers is not yet clear.
source share