Resource Management

It is not enough to just to exchange resources and information. A concurrent environment must manage its resources. As true with most management science, there are few agreed-upon best methods. However, all processes must agree upon a method for managing resources. Deadlock is a typical problem in resource management, when, simultaneously, a set of processes each try claim resources that another one of them owns. Another more subtle problem is Livelock; here deadlock is broken, but when the processes retries the situation occurs again and again. Another similar and subtle situation is process starvation; for example when the readers of a file come and go so frequently that a writer process can never write. Here are some typical resources, and how they may be managed:

Processor
management is the most fundamental part of a multitasking environment. Processors must be dynamically allocated to different tasks. Usually this is done by a separate task called a scheduler. The simplest scheme is round-robbin scheduling, circling through each task, executing it for only a unit of time (a time quanta) or until it reliquishes control. Usually, however, this scheme is not adequate. Suppose a task is simply idle waiting for a keystroke? Or suppose a task is time-critical, and must receive a character from a serial port. Real schedulers must suspend when they are awaiting resources & messages and must prioritize tasks according to their timeliness. Also, they must take into consideration how long the task has had to execute, and how frequently it has executed, to see each task gets its fair share. In addition, a scheduler may consider the task's history (big task, small task; CPU bound, I/O bound). And as the scheduler grows more complex, the designer must even consider how much time the scheduler making a decision. In short, good scheduler design is complex; it requires understanding, experience, and a touch of black magic.

Random Access Memory
is a resource and is usually intimately tied with multitasking environment. Often, especially in stack-based languages, this resource is taken for granted; the program dynamically allocates stack and heap memory as needed. However, a multitasker cannot make such assumptions; dynamic memory allocation takes time and resources too costly for its time-critical primitive functions. Most often, a multitasker's memory management is tightly designed around the hardware's capabilities. For example, many workstation and larger environments have virtual memory, allowing each process a contiguous address space which is much larger than physical memory, by swapping in memory from secondary storage as it is accessed.

Secondary Storage Devices
are next in line in a multitasker's complex management scheme. As well as its use for virtual memory page swapping, hard disks and tapes often contain an intricate file system which the operating system must manage. To support complex, multi-user database applications, operating systems often provide locking on the file level, or even on records within the file. And in optimized systems, the pending disk accesses of multiple tasks may be organized according to the head position of the disk.

Network Devices
are now playing an increasing role in operating systems, to the point to where nearly half the operating system may be dedicated to network communications! (as is the case with some of the networked versions of UNIX). Often a single network connection is multiplexed between several processes, and the operating system will emulate its interprocess communication protocol (as pipes) over the network between processes on different machines.

User Devices
are beginning to be multiplexed as well. On graphics terminals, often a window is dedicated to each process. Standards, as Microsoft's Presentation Manager, are emerging which allow a consistent multitasking interface to text and graphics functions. Some standards, as the Sun NeWS system and the MIT X Window system, allow text and graphics to be displayed on remote machines.

In short, resource management plays a very large part in a multitasking system, and the technology is still under development.