An important feature of our program will be the ability to run multiple programs at the same time. Within the squawk VM there is a thing called isolates. A Squawk isolate is a collection of threads and associated objects that forms a distinct and separate execution unit. Objects are never shared between isolates.
If you want to run two or more Java applications on your desktop you would normally launch a separate VM process for each application. This is not practical if you are resource limited, as with the SPOT. So the alternative is to run the applications as a set of isolates within a single VM. A clever feature of Squawk is the ability to snapshot the state of an isolate and save it in a file or, for SPOT applications, send it to another SPOT over the radio.
What we need in our application is the ability to start a program from our already running program. This is where Isolates come in. After sending a new program(a .class file) from a basestation to a sunspot, we create an Isolate with it and have this run.
At this moment we are able to send a .class file to a sunspot. But when we try to have it run as an Isolate we get an error. So there's still some work to do next week.
This is how we create an Isolate:
Isolate i = new Isolate("com.sun.spot.flashmanagement.FlashFile", args, null, Isolate.currentIsolate().getParentSuiteSourceURI());
Thursday, 2 October 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment