[Squeak-e] 'gotta get this done... =\
Alan Grimes
alangrimes at starpower.net
Sun Feb 15 08:08:57 CET 2004
om,
Okay, attached is part of my current attempt at implementing my Sphere
design. There's also a sketch of how I envision the system working.
The yellow part is supposed to be the Sphere class itself. Unlike
Environment, it doesn't directly support an instance of Smalltalk,
instead its role is merely to provide the structure and support the core
services as listed in the "SphereInterfaceBase" class.
The reason for this design decision is that it will,
hopefully/eventually be relatively language agnostic such that it will
be possible to write language bindings such that you can write spheres
in the language of your choice. -- hence the Intercal joke. -- heck,
intercal 2 can't be any worse than its predecessor! ;)
The "CPU" and "MEMORY" modules provide the interface between the Sphere
system and whatever the heck is running the code for this sphere.
The little purple spheres are nested spheres which are managed by the
sphere system. -- By necessity, the entire Sphere framework must be in
the same language.
The "interface" and "outerface" are callbacks to the intercal 2/whatever
code. (or to some code in a parent environment)
One security issue with the interface and outerface is that they must be
invulnerable to modification in any way yet still accessable to the
varrious modules.
Visability:
The outerface must be visable to other spheres in the system and the
parent environment. It must be callable in a fairly elegant fassion and
be able to return session classes and objects in such a way that a call
to a session object will be transmitted to the providing sphere in such
a way that is exclusive to any other communication.
The interface is inherited from the base class and may be extended by
the sphere's code and _ONLY_ by the sphere's code. It automaticly
becomes the base class for any sub-spheres...
This may pose a problem because spheres should be dynamicly loadable, --
it should be possible to load a sphere within any sphere which has
compatible interfaces. This means that the inheritance mechanism just
mentioned must be agnostic to the actual name of the class being
inherited!!! =P
(If this were easy I would have done it myself. =( )
The top-level problem is that I'm only an intermediate level Squeak
programer trying to design a meta-meta class. =P
Come to think of it, my feeble and confused mind had a different idea
about this long ago... The key to my older design was that the CPU
needed to have enough features for the intercal/etc environment to
basically run its own kernel....
I think this design will also work and, if done correctly, will redily
lend itself towards the more ambitious nested-kernel design. =)
-- I will post with increasing frequency untill something happens... I
really _NEED_ this OS!!! =\
-------------- next part --------------
Object subclass: #Sphere
instanceVariableNames: 'Name interfaces Outerfaces Memory Supervisor Subordinants tasks visitingTasks MyPriority allowRecursiveCalls '
classVariableNames: ''
poolDictionaries: ''
category: 'Sphere-Base'!
!Sphere commentStamp: 'ATG 10/16/2003 17:00' prior: 0!
This is the base class for a system oriented operating system called "sphere".
For reasons of system durability, this class is to be used to manage the actual spheres and not directly linked to any Sphere software. This is neccessary to enhance compatibility across versions and through time. !
!Sphere methodsFor: 'accessing' stamp: 'ATG 10/17/2003 16:29'!
changeNameTo: aNewName
"om."
Name _ aNewName. ! !
!Sphere methodsFor: 'accessing' stamp: 'ATG 10/19/2003 17:33'!
interface: newInterface
interfaces _ newInterface. ! !
!Sphere methodsFor: 'accessing' stamp: 'ATG 10/17/2003 16:51'!
name
^Name.! !
!Sphere methodsFor: 'accessing' stamp: 'ATG 10/19/2003 17:35'!
outerface: newOuterface
Outerfaces _ newOuterface. ! !
!Sphere methodsFor: 'error handling' stamp: 'AFG 10/4/2002 14:14'!
serverFailure
"should a server this sphere depend on fail..."
self die. ! !
!Sphere methodsFor: 'initialization' stamp: 'ATG 12/18/2003 19:02'!
initialize
super initialize.
Name _ 'UNUSED'.
" a generic sphere doesn't need an interface... "
" interfaces _ SphereInterfaceBase new.
Outerfaces _ SphereOuterfaceBase new.
"
Memory _ BogusMemory new.
Subordinants _ Array new.
tasks _ Heap new.
visitingTasks _ Collection new.
allowRecursiveCalls _ true.! !
!Sphere methodsFor: 'as yet unclassified' stamp: 'ATG 10/17/2003 17:01'!
addSubordinant: aSubordinantSphere
Subordinants add: aSubordinantSphere.! !
!Sphere methodsFor: 'as yet unclassified' stamp: 'ATG 10/17/2003 16:48'!
assignMemory: aVirtualMemoryProvider
Memory _ aVirtualMemoryProvider.! !
!Sphere methodsFor: 'as yet unclassified' stamp: 'ATG 10/17/2003 21:56'!
doToAllChildren: aBlock
Subordinants do: aBlock.! !
!Sphere methodsFor: 'as yet unclassified' stamp: 'ATG 10/17/2003 17:03'!
extTryService: aMessage! !
!Sphere methodsFor: 'as yet unclassified' stamp: 'ATG 10/17/2003 17:04'!
intTryService: aMessage! !
!Sphere methodsFor: 'as yet unclassified' stamp: 'ATG 10/17/2003 21:27'!
memorySize
^ Memory size.! !
!Sphere methodsFor: 'as yet unclassified' stamp: 'ATG 10/17/2003 16:46'!
parent
^ Supervisor.! !
!Sphere methodsFor: 'as yet unclassified' stamp: 'ATG 10/17/2003 16:47'!
parent: aNewSupervisor
Supervisor _ aNewSupervisor.! !
!Sphere methodsFor: 'as yet unclassified' stamp: 'ATG 10/17/2003 17:27'!
removeSubordinant: aDerilictSubordinant
! !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
Sphere class
instanceVariableNames: ''!
!Sphere class methodsFor: 'as yet unclassified' stamp: 'ATG 10/17/2003 22:13'!
createNewIn: aParentSphere
| aNewSphere |
aNewSphere _ self new.
aNewSphere
parent: aParentSphere.
^ aNewSphere.
! !
!Sphere class methodsFor: 'as yet unclassified' stamp: 'ATG 10/17/2003 16:50'!
createNewIn: aParentSphere with: aMemory
| aNewSphere |
aNewSphere _ self new.
aNewSphere
parent: aParentSphere;
assignMemory: aMemory.
^ aNewSphere.
! !
Object subclass: #SphereCallInterface
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Sphere-Base'!
!SphereCallInterface commentStamp: 'ATG 10/17/2003 17:28' prior: 0!
The syscall interface for Sphere. !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
SphereCallInterface class
instanceVariableNames: ''!
!SphereCallInterface class methodsFor: 'as yet unclassified' stamp: 'ATG 10/17/2003 16:58'!
SystemCall: aMessage
"Tries to find a sphere within or available to the current context which understands this message. This is a secure synchronous call from the sender's perspective. from the receiver's perspective it is an assynchronous event which executes one of the public interfaces." ! !
Object subclass: #SphereInterfaceBase
instanceVariableNames: 'owner '
classVariableNames: ''
poolDictionaries: ''
category: 'Sphere-Base'!
!SphereInterfaceBase commentStamp: 'ATG 10/16/2003 17:32' prior: 0!
Base class for interface objects.
Each Sphere is likley to have two children of this class, one exclusively for subspheres and one that is accessable publicly.!
!SphereInterfaceBase methodsFor: 'thread navigation' stamp: 'ATG 10/17/2003 00:24'!
enter: aSphere
"switch the current thread's context to the new one." ! !
!SphereInterfaceBase methodsFor: 'thread navigation' stamp: 'ATG 10/17/2003 01:03'!
home
"return to home context"! !
!SphereInterfaceBase methodsFor: 'thread navigation' stamp: 'ATG 10/17/2003 01:03'!
leave
"leave current context" ! !
!SphereInterfaceBase methodsFor: 'security' stamp: 'ATG 10/17/2003 01:10'!
giveAccess
"Grant the thread's home access to this sphere." ! !
!SphereInterfaceBase methodsFor: 'security' stamp: 'ATG 10/17/2003 01:10'!
requestAuthent: key
"request security access to the parent context with provided key." ! !
!SphereInterfaceBase methodsFor: 'informational' stamp: 'ATG 10/17/2003 21:11'!
HELP "!!!!!!!!"
"return a help message for this context."
^ 'Welcome to the Sphere Operating System. This is an early prototype which is intended to demonstrate its basic concepts and perhaps even serve as the basis for a more capable version. You are in a context called a Sphere. The system calls available here are derived from the services provided by other Spheres which are also within this context as well as (possibly) spheres outside of this current context. Use the List function to learn what spheres may be here to explore. use menu function to learn what commands you can try.'! !
!SphereInterfaceBase methodsFor: 'informational' stamp: 'ATG 12/18/2003 19:03'!
VMLook
"return a virtual memory report for this and all subordinant contexts."
^ owner memorySize.! !
!SphereInterfaceBase methodsFor: 'informational' stamp: 'ATG 12/18/2003 19:03'!
getCurrentContextName
"returns the name of the current context."
^ owner name. ! !
!SphereInterfaceBase methodsFor: 'informational' stamp: 'ATG 10/17/2003 22:07'!
list
"returns a list of spheres within this context."
| tempString |
tempString _ String new.
Owner doToAllChildren: [: x | tempString append: (x name).
tempString append: ' ' ].
^ tempString.! !
!SphereInterfaceBase methodsFor: 'informational' stamp: 'ATG 10/17/2003 00:23'!
menu
"I think this should return a list of methods of the interface class and all the commands available within the current context, including interfaces provided to parent contexts for both program and user interfaces." ! !
!SphereInterfaceBase methodsFor: 'graph managment...' stamp: 'ATG 10/17/2003 14:05'!
disconnect
"disconnect a client gracefully." ! !
!SphereInterfaceBase methodsFor: 'graph managment...' stamp: 'ATG 10/17/2003 14:06'!
disconnect: serverSphere
"disconnect a client or server ungracefully." ! !
!SphereInterfaceBase methodsFor: 'graph managment...' stamp: 'ATG 10/17/2003 00:22'!
graph
"Returns a dependancy graph that may be converted into any of a number of types of user reports." ! !
!SphereInterfaceBase methodsFor: 'graph managment...' stamp: 'ATG 10/17/2003 01:04'!
recogClient
"Recognise the home of the thread as a client." ! !
!SphereInterfaceBase methodsFor: 'Sphere Managment' stamp: 'ATG 12/18/2003 19:04'!
create
"Create a gnu sphere within the current context."
| newSphere |
newSphere _ Sphere createNewIn: owner.
owner addSubordinant: newSphere.
^ newSphere. ! !
!SphereInterfaceBase methodsFor: 'Sphere Managment' stamp: 'ATG 10/17/2003 00:02'!
interpret: someSpherewarez in: thisSphere
! !
!SphereInterfaceBase methodsFor: 'Sphere Managment' stamp: 'ATG 10/17/2003 22:21'!
murder: theVictim
"not much needs to be done for process cleanup in a GC'd environment... This will delink the sphere and run a GC..." ! !
!SphereInterfaceBase methodsFor: 'Sphere Managment' stamp: 'ATG 12/18/2003 19:04'!
setHomeSphere: newOwner
owner _ newOwner. ! !
!SphereInterfaceBase methodsFor: 'Sphere Managment' stamp: 'ATG 10/17/2003 22:22'!
shutdown: aSphere
"Attempt to run a Sphere's cleanup routines and shutdown gracefully." ! !
!SphereInterfaceBase methodsFor: 'Sphere Managment' stamp: 'ATG 10/17/2003 01:07'!
transfer
"give this sphere's responsibilities to the caller, used for On-the-mosquito upgrading." ! !
!SphereInterfaceBase methodsFor: 'interface managment' stamp: 'ATG 12/18/2003 19:04'!
installInterface: newInterface
owner interface: newInterface.! !
!SphereInterfaceBase methodsFor: 'interface managment' stamp: 'ATG 12/18/2003 19:04'!
installOuterface: newOuterface
owner outerface: newOuterface.! !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
SphereInterfaceBase class
instanceVariableNames: ''!
!SphereInterfaceBase class methodsFor: 'as yet unclassified' stamp: 'ATG 10/18/2003 11:25'!
new: homeSphere
"set up the interface to work with the provided sphere."
^ self new;
setHomeSphere: homeSphere. ! !
Object subclass: #SphereOuterfaceBase
instanceVariableNames: 'owner '
classVariableNames: ''
poolDictionaries: ''
category: 'Sphere-Base'!
!SphereOuterfaceBase methodsFor: 'as yet unclassified' stamp: 'ATG 2/15/2004 01:11'!
owner: nOwner
owner ifNil: [ owner _ nOwner].
"this should be secure but we really want to hurt the idiot who thought he could take over someone else's outerface." ! !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
SphereOuterfaceBase class
instanceVariableNames: ''!
!SphereOuterfaceBase class methodsFor: 'as yet unclassified' stamp: 'ATG 2/15/2004 01:09'!
newWithOwner: nOwner
^ self new;
owner: nOwner.! !
Object subclass: #SphereSoftware
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Sphere-Base'!
!SphereSoftware commentStamp: 'ATG 10/16/2003 16:57' prior: 0!
Abstract class for all software written for Sphere including drivers and user software.!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sphereSketch.jpeg
Type: image/jpeg
Size: 103296 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-e/attachments/20040215/e63dd8de/sphereSketch-0001.jpeg
More information about the Squeak-e
mailing list