In earlier chapters, we touched on the subject of resource limits. In this chapter, we’re going to look first at ways of managing your resource allocation, then at ways of dealing with files that are accessed by many users more or less simultaneously, and lastly at one tool provided in Linux systems for overcoming the limitations of flat files as a data storage medium.
We can summarize these topics as three ways of managing data:
- Dynamic memory management: what to do and what Linux won’t let you do
- File locking: cooperative locking, locking regions of shared files, and avoiding deadlocks
- The dbm database: a basic, non-SQL-based database library featured in most Linux systems
On all computer systems memory is a scarce resource. No matter how much memory is available, it never seems to be enough. It doesn’t seem so long ago that 256MB of RAM was considered sufficient, but now 2GB of RAM is commonplace as a sensible minimum requirement even for desktop systems, with servers usefully having significantly more.
From the earliest versions of the operating system, UNIX-style operating systems have had a very clean approach to managing memory, which Linux, because it implements the X/Open specification, has inherited. Linux applications, except for a few specialized embedded applications, are never permitted to access physical memory directly. It might appear so to the application, but what the application is seeing is a carefully controlled ...