|
The ways extension can be used
|
Extension monitors system activities and
reports to application upon request |
|
Extension offers hints to system |
|
Extension may entirely replace or
augment an
existing system service |
|
|
Extension Model
|
System services are done by the event
handling |
|
Extension = installation of new handler
to events |
|
Dispatcher routes events to
appropriate handlers |
|
|
Event
|
An event is just a signature of a
procedure |
|
Event definition = declaration of a
procedure and exporting it |
|
Raising an event = calling the function
|
Dynamically link against the
definition of the event, if necessary, and call the procedure |
|
Callee(s) are dynamically
determined by dispatcher |
|
A raising can be resulted in
invoking multiple handlers |
|
|
Handling the event = executing the
procedure linked to the specific call |
|
|
Handler
|
Handler registration is done through:
|
Dispatcher.InstallHandler (
event-name, guard, handler ) |
|
|
Handling an event = executing the
handler procedure with the argument passed by raiser |
|
|
Guard to extension
|
Default handler
|
primary handler |
|
the function with the same
signature |
|
|
Installation of new handler can be
denied, allowed, or guarded by the default handler |
|
Guard can be specified also by the
handler |
|
Guard is a predicate which is associated
with the particular handler
|
the predicate is evaluated
whenever the event arrives |
|
only when the predicate is true,
the handler is invoked |
|
|
Multiple handlers with their own guards
can be installed for an event |
|
|
Default handler's control on handlers
|
Synchronous or asynchronous invoke of
handlers |
|
Handlers may be cancelled after timeout |
|
Handlers can be invoked in an arbitrary
order to enforce, say, their mutual dependency |
|
Multiple handlers may be invoked to
handle, in a cooperative way, a single event
|
For example pipeline of handlers |
|
|
|
Example: Syscall
|
Built-in interface
"TrapHandler"
|
exports "Syscall" event |
|
|
Extension "MachEmul"
|
imports "Syscall" event
with a guard |
|
register
"MachEmul.privSysCall" for a handler of
"Syscall" |
|
|
How is system call handled?
|
Application calls a system call
-> trap occurs |
|
TrapHander
|
does very basic things:
change to kernel mode, save exec context |
|
raises "Syscall"
event |
|
|
MachEmul.privSysCall gets called |
|
|
|
Questions:
|
Who can raise or handle events? |
|
Which handler is allowed to handle a
particular instance of an event? |
|
Who is authorized to answer those
questions? |
|
|
Authorizer
|
The module which defines and exports the
event |
|
This module implements default (or
intrinsic) handler, which enforces the policies concerning those
questions |
|
|
Who can raise an event? = Who can call the
procedure? = Protection domain issue
|
When a module requests that it be
dynamically linked against some other module, the module's
authorizer is consulted and the linkage is permitted or denied |
|
|
Who can handle an event or an instance of it?
= Who can implement the procedure and overrides or augment the original
one? = Protection domain issue, and
|
Handler registration is consulted to the
authorizer of the event and denied, accepted, or guarded |
|
|
Three objects are provided so that extension
can define its own virtual memory system using those objects
|
physical address |
|
virtual address |
|
translation |
|
|
Note pink
procedures are events raised by these object, i.e, extensible |
|
Physical address -- physical memory object
|
allocate (size, attribute)
|
attribute: color, continuity, etc |
|
return: the capability of the
allocated physical memory |
|
|
deallocate (the capability of the
physical memory) |
|
reclaim (candidate capability)
|
request to reclaim a candidate
page |
|
extension may handle this
event to nominate an alternative candidate |
|
|
|
Virtual address
|
allocate (size, attribute)
|
return: the capability to the
allocated virtual memory |
|
I think this is semantically
identical to segment creation |
|
|
deallocate (the capability of the
virtual memory) |
|
|
Translation
|
create ()
|
return: new translation context is
created and its capability is returned |
|
|
destroy (context) |
|
addMapping (context, capability of
virtual, capability of physical, protection) |
|
removeMapping (context, capability of
virtual) |
|
examineMapping (context, capability of
virtual)
|
return: protection |
|
|
pageNotPresent (capability of virtual)
|
remember pager of Mach? |
|
|
badAddress (capability of virtual) |
|
protectionFault (capability of virtual) |
|
|
An extension which implements Unix address
semantics
|
Interfaces: copy address space &
allocate additional memory to an address space |
|
new address space creation
|
create a context |
|
allocate initial physical memories
and virtual memories |
|
bunch of addMappings |
|
|
allocate additional memory to an address
space
|
allocate a physical and virtual
page |
|
addMapping |
|
|