Modula-3 is a strongly typed language with built-in safety and encapsulation
mechanisms. It does automatic management of memory. That is, since it does
automatic storage management, there are no memory leaks. Modula-3 supports
a data abstraction called an object with well defined entry points. Only the
entry points are known outside the object, not the implementation of
the code for that entry point, or the data structures that are contained within
an object. And therefore there's no cheating possible as you can do with
a language like C. And modula-3 allows exposing the
externally visible methods inside an object using
generic interfaces. And it also supports the notion of threads that execute in
the context of the object, and it
allows raising exceptions, for example, when there
is a memory access violation. All of the features that I mentioned here in
a nutshell allows implementing system services as
an object with well defined entry points.
This modula-3 allows the creation of logical
protection domains. What you can do from outside
the object is what the entry point methods that are inside the object will let
you do and no more. In other words, we are getting the safety property of
a monolithic kernel without having to put
system code in a separate hardware address space.
So in other words the logical protection domains give you both protection and
performance, the two things that we
strive for. Now, what about flexibility? Well,
the genetic interface mechanism allows you
to have multiple instances of the same
service. And a given application may be able to exploit the different instances
of services that are available, that cater
to the same generic interface, and that's
the way you can get flexibility as
well. And objects that implement specific services
can be the desired granularity of the
system designer. It can be fine-grained, or
it can be a collection. You can
think of individual hardware resources as fine-grained object.
For example, a page frame and what you can do with a particular page frame.
You can have interfaces that provide a
certain functionality. That can be what an object
is. For example a page allocation module can be on object. And it can also
make a collection of interfaces into an
object. For example, an entire virtual memory subsystem
can be an object that is hierarchically composed of page allocation module,
and within that, you may have hardware resources defined as objects as well. And
all of these objects, whether it is at the course level of a collection of
interfaces, or individual interface that is a component of this collection,
or specific hardware resources, all of those are accessible via
capabilities. Now the word capability may give you jitters, because I just now
said that capabilities traditionally in
the operating system parlance signifies a
heavyweight mechanism. But because we are
dealing with a strongly typed language,
capabilities to objects can be supported as pointers.
Or in other words, the programming language supported pointers can
serve as capabilities to the objects. So now, with this
idea access to the resources, that is entry point functions
within an object that is representing a specific resource,
is provided via capabilities that are simply language supported pointers.
And because they are language supported pointers, these capabilities that
we are talking about here, are much cheaper compared to
real capabilities as was used in the hydra operating system.