270 likes | 547 Views
Capability-Based Addressing. By R.S. Fabry University of California Presented by: Luis Vazquez October 4, 2005. Outline. Introduction Shared Segment References Problem Solutions Hardware Implementations Conclusion. What is a Capability?.
E N D
Capability-Based Addressing By R.S. Fabry University of California Presented by: Luis Vazquez October 4, 2005
Outline • Introduction • Shared Segment References Problem • Solutions • Hardware Implementations • Conclusion
What is a Capability? • Data structure that represents access to an object. • Used with protection schemes since possessing a capability grants a particular type of access (read/write/execute/etc). • Capabilities can only be created by the system and cannot be modified by non-system programs. • Idea developed by Dennis and Van Horn.
Using Capabilities for Addressing • Must be able to store capabilities in user-defined structures • Scheme must be in place to ensure integrity of these capabilities • Capabilities were used for protection, but Fabry wants to use capabilities to provide an absolute address to some object.
Context-Independent versus Context-Dependent • Allocating jobs into fixed areas of memory allowed for context-independent addresses. • Address relocation was introduced, but so were context-dependent addresses to objects. • Complicates the sharing of addresses • Capabilities provides a context-independent way to access these objects. • The capability can point to a real object or a virtual object (which is handled by the system). • Allows the system to support address relocation.
Shared Segment Reference Problem • Looking at the problem when no sharing of objects. • PC loads segment reference 0, which tells us to call the subroutine in segment reference 1 and then access the data in segment reference 2.
Shared Segment Reference Problem • Assume the relationship between integers and segments are created independently. • How should the segment references be coded?
Shared Segment Reference Solutions • Fabry discusses what he says are the most developed and promising solutions which are: • Uniform Address Solution • Indirect Evaluation Solution • Multiple Segment Table Solution • Capability Addressing Solution
Uniform Address Solution • All shared integer statements are functionally equivalent. • Functions must be defined centrally. • Used by the Burroughs systems.
Indirect Evaluation Solution • Shared integer segment address is an index to a linkage segment. • Linkage segments contain segment table indexes. • Base registers remembers the address of the linkage statement • Concept used in Multics
Multiple Segment Table • Modifies indirect evaluation solution. • Replace indexes with capabilities.
Capability Addressing Solution • Processor registers used to indirectly evaluate data addresses. • Capabilities for subroutines are embedded into the program.
Difficulties in Implementation • Integrity of Capabilities • Address Translation • Instruction Sets • The Stack
Integrity of Capabilities • Due to the access lists in a capability, user programs should not change the bit pattern. • Tagged = Contents of a word is denoted as a capability or not using one or more tag bits. • Partition = Segments, at creation, can only hold either capabilities or data.
Partitioned Approach • Advantages • Locating of capabilities are quicker since they reside in known locations. • No tag bits to occupy memory. • Disadvantages • Some objects require both data and capabilities, and extra capabilities to couple these segments is preferred. This leads to more memory usage. • Paper mentions it is possible to translate from one approach to another.
Address Translation • Capability is seen as an address to an object (which is made up of a bit pattern) • A capability is seen as in-form or out-form. • In-form = Capabilities for segments in primary memory. Are not allowed to be on secondary storage. • Out-form = Capabilities for segments in secondary storage.
In-Form Capability • Contains: • Absolute address of origin of the segment in primary memory • Length of the statement • Converted to out-form when copied to secondary storage
Out-Form Capability • Contains: • Secondary storage address of the first record of the segment • Unique sequence number used to invalidate capabilities for objects that no longer exist. • Using an out-form capability to access a segment results in a trap to the system.
Performance of In-Form and Out-Form Capabilities • The system must continue to convert capabilities to and from In-Form and Out-Form Capabilities depending on where the object is located, and when it’s needed. • This provides a lot of overhead to be imposed on the system for address translation.
Future Implementations of Address Translations • Capabilities have a unique code (never to be reused) • Use a Hash Table using the unique code as a key for all objects in primary memory • Presence bit (determine if segment is in primary memory), primary memory location, secondary memory location, and segment size • Entries age over time and are removed. • Accessing the Hash Table results in 3 outcomes • Segment found in HT and in Primary Memory • Type A Exception – Entry found in HT but segment not in Primary Memory • Type B Exception – Entry not found in HT
Accessing the Hash Table • Type A Exception – O/S reads in the segment from secondary storage (it knows the location and size of the segment from the HT) and updates the HT entry accordingly (presence bit). • Type B Exception – O/S needs to determine the size and location of the segment and creates a new HT entry. Then raises a Type A Exception to copy this segment into primary memory.
Instruction Sets • Capabilities should be able to be copied around freely, since to the user, these are simply addresses to objects. • “Enter instruction” can be seen as a call and is used to call subroutines. • “Enter access" is used for a transfer of control and is weaker than read, write, or execute access. • Control is transferred to a fixed entry point. • Calling program cannot access called program’s embedded capabilities.
The Stack • Stack is used when dealing with calls to subroutines where stack frames are given to subroutines for temporary storage. • Solution presented: • Creating a new temporary stack frame for each subroutine. • Also helps keeping the called program from modifying the return location of the calling program.
Conclusion • Capability-based Addressing provides an efficient type of absolute address for an object. • Appears to simplify the amount of indirection needed for address relocation. • Paper discussing design suggestions for computer architects to make use of such schemes.
References • Fabry, R.S. “Capability-Based Addressing”, University of California, 1974.