INTRODUCTION
TO
OPERATING SYSTEMS
Lecture 6: RESOURCE ALLOCATION (1)
CHRIS STAFF
Dept. of Computer Science and Artificial Intelligence
University of Malta
Lecture Outline
Aims and Objectives
General Issues
Allocating Resources
Allocation Mechanisms
Allocation Policies
Summary
Aims and Objectives
- Some issues of resource allocation
- Allocation Mechanisms
- Allocation Policies
General Issues
- In a multi-processing environment, usually processes request more resources
than there are available.
- It would be too expensive to provide enough non-shareable resources to cope
with maximum demand.
- OS must ensure that processes get the resources they request without
compromising system integrity.
- E.g., non-shareable resources cannot be shared amongst processes, because
otherwise input or output could be meaningless (Printer intermingling output
from several processes).
Allocating Resources
Issues:
- Mutual Exclusion of processes from non-shareable resources.
- Deadlock should be handled sensibly.
- Ensure high level of resource utilisation.
- Processes should be allocated resources within a reasonable length of time.
- The last two points compromise each other. OS can ensure high level of
resource utilisation, but sometimes compromising response times for process
completion.
Allocation Mechanisms
- A resource is a component of the computer system for which processes can
compete. Typically these are:
- Central Processors
- Usually 1, but in a multi-processor environment there will be more than
one.
- Processors may be several of the same type, or some may have specific
characteristics, to be dedicated to certain tasks.
- OS needs to know what each processor can do to help it allocate processor to
a process - uses Processor Descriptor.
- Each processor may have its own processor queue, to queue jobs.
- Memory
- Processes and data need to be in primary memory to be operated on.
- Memory is finite, and Memory Manager must create enough space in primary
memory to accommodate a process for it to become runnable.
- Peripherals
- Each device has a device descriptor
- IORBs are added to device request queue.
- Mutual exclusion to non-shareable peripherals is managed by setting
semaphore's initial value to 1.
- Backing Store
- Can be used for Virtual Memory - managed by memory manager
- Can also be used for File Store - managed by filing system.
- Requests for space granted, unless there is no space left, or user has
exceeded quota.
- Requests cannot be queued.
- Files
- Collections of related information (Programs, Data, Etc.)
- Access may be restricted - security
- Access may be limited - non-shareable in write mode
- Access may be unlimited - shareable in read mode
- Requests may be queued until the expiration of some timeout.
- Allocation mechanisms are handled by the OS at the appropriate Layer, but
policies for using the mechanisms should be standard throughout the OS.
Allocation Policies
Deadlock
- When Process A holds non-shareable resource X and requests non-shareable
resource Y, and Process B holds resource Y and requests resource X.
- 4 Necessary and Sufficient conditions for deadlock
- Mutual Exclusion - non-shareable resources
- Hold and Wait
- No Pre-emption
- Circular Waiting
- Deadlock can be solved by
- preventing any one of the conditions from holding
- Detection and recovery
- Avoidance by anticipation
Summary
- Issues - to identify some allocation problems
- Allocation Mechanisms - to identify how different resource types may be
allocated
- Allocation Policies - to show that any policy that is adopted needs to handle
deadlock
Next Lecture...
Resource Allocation (2)