In: Computer Science
Handling Competition among Processes in computer science
An important task of an operating system is the allocation of the machine's resources to the competing processes in the system. Here we are using the term resource in a broad sense, including the machine's peripheral devices as well as features within the machine itself. – The file manager allocates access to files as well and allocates mass storages pace for the construction of new files; – The memory manager allocates memory space; – The scheduler allocates space in the process table; and the dispatcher allocates time slices.
A common problem that can arise during resource allocation is deadlock: the condition in which two or more processes are blocked from progressing because each is waiting for a resource that is allocated to another. For example, one process may have access to the computer's printer but be waiting for access to the computer's CD player, while another process has access to the CD player but is waiting for the printer. Such conditions, as in other settings can severely degrade a system's performance
Solution to this is Avoiding deadlocks -Techniques that attack deadlock tend to be known as deadlock avoidance schemes. One, requires that each process requests all its resources at one time. • Another, perhaps more imaginative technique attacks the first condition, not by removing the competition directly but by converting non shareable resources into shareable ones.
Defining priority and scheduling resources to processes based on priority is another way to handle competition. CPU scheduling heavily uses priority to differentiate between performance of interactive jobs versus batch jobs.