building the virtual babel: mono in second life
TRANSCRIPT
![Page 1: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/1.jpg)
Building A Virtual Babel: Mono In Second Life
Dr Jim Purbrick, Technical Director, Linden LabFOSDEM 2010
![Page 2: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/2.jpg)
http://flickr.com/photos/rorowe/2650727613/sizes/o/
Second Life At 6
![Page 3: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/3.jpg)
Second Life In 2003
![Page 4: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/4.jpg)
Second Life Today
769Krepeat logins/mo
US$47Muser-to-user
transactions/mo
800GBnew content/day
40M
user hours/mo
miles2 of land600
390TBcontentUS$10M
exchanged/mo
25K
cores
150 +countries
80Mrunning scripts
87Kpeak concurrency
12Gbdata/s
![Page 5: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/5.jpg)
Pixie Dust
• Animations• Dancing• Vehicles• Seats• Games, guns• Doors, elevators, teleporters• Big, tiny, non-human avatars• Chickens, dogs, bunnies, wildlife• Customizable hair, shoes, furniture• In world vendors and web sales
Image Moon over Belgium
![Page 6: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/6.jpg)
Scripting Second Life
• Scripts in prims• Prims linked to make objects• Sensors and effectors via library calls• Communication via IM, email, XMLRPC, HTTP• Untrusted code• 2000 scripts per process• Migration between processes
Image Suzanne Graves
![Page 7: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/7.jpg)
LSL
• C-Like Language• Vectors and Rotations (DSL!)• Static Types (6!)• Heterogenous Lists• States• Textbook 16KB Bytecode VM• Easy Migration• Easy Scheduling• Easy Sandboxing (Maybe?)• Slow• Inconsistent
default{ state_entry() { llSay(0, "Hello, Avatar!"); } touch(integer total_number) { llSay(0, "Touched."); }}
![Page 8: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/8.jpg)
LSL On Mono
Image Ganymedes Costagravas
• Rewrite assemblies for concurrency and mobilty• Induce stack state (Verification)• Rewrite bytecode (Reflection.Emit, RAIL, cecil)• Inject microthreading (JavaGoX, Brakes)• Serialize stack and heap, transfer assemblies• Migrate assemblies between app domains to unload• Subvert profiler for resource limitation
![Page 9: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/9.jpg)
• LSL value semantics• CIL pushes MP• Can’t copy to heap• Step back through CIL• Copy operands to heap• Run CIL on restore• Resythesise MP• Microthread all CIL
Migrating Managed Pointers
Image Bettina Tizzy
![Page 10: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/10.jpg)
Memory Allocation Monitoring
• Walk object tree between time slices• Concatenation allows rapid memory consumption• Limit length of lists and strings• Hard limit on allocation size• Exceptions would have been better• Lucky scheduling gives temporary memory boost• Yield whenever memory limit might be reached
Image Ka Rasmuson
![Page 11: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/11.jpg)
Scheduling
• Check time at yield points• System call gates execution• Execution time very variable• Adaptive timer skipping• Flywheel exploits• Marshalling new bottle neck
Image juria yoshikawa
![Page 12: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/12.jpg)
Managed Execution After A SEGV
• Emergency state save• Mono replaces handlers• Disable garbage collection• Chain signal handlers• Definitely void warranty• Contributed signal chaining
Image The New Media Consortium
![Page 13: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/13.jpg)
Memory Model
• Script Limits• Resource Pools• Big Scripts• Efficient Scripts• Bytecode Sharing
![Page 14: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/14.jpg)
C#
• Arrays• Primitive Types• Enumerations• User Defined Types• Exceptions• Ecosystem Image Betina Tizzy
![Page 15: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/15.jpg)
• Full CIL Instruction Set• RAIL or Cecil?• Generics?
Image Gita Rau
Complete UThreadInjector
![Page 16: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/16.jpg)
Build Sandbox
• Moonlight?• CoreCLR Security?• Embedded Mono?• Assembly Markup?
Image Raul Crimson
![Page 17: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/17.jpg)
C# API
• Library.llFoo Methods• System.Collections• System.Security.Crytography• XML?• Web?• .NET to Silverlight machinery?
Image Gita Rau
![Page 18: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/18.jpg)
C# Types
• Vector• Quaternion• Parsing and Formatting• ArrayList or object[]• FooBuilders?• Versioning?
list l = [“foo”,42]
ArrayList l = new ArrayList(new object[]{“foo”,42})
List l = new List().Add(“foo”).Add(“42”);
llHTTPRequest(url, [HTTP_METHOD, “POST”]);
Library.llHTTPRequest(url, new ArrayList(new object[]{HTTP_METHOD, "POST"});
new HttpRequest().Url(url).Method(“POST”).Request();
![Page 19: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/19.jpg)
C# Event Handling
• Subclass SecondLife.Script• Override OnFoo Event Handlers• Register Delegates• Events? Image keankelly
public class EventExample : Script{
public override void OnRez(int param){
Touch = new Script.TouchDelegate(Touch);}
void Touch(int num){ Libary.llSay(0, "Turning off..."); Touch = null;}
}
![Page 20: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/20.jpg)
C# Libraries
• Scope?• Naming?• Versioning?
![Page 21: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/21.jpg)
Future
• F#/Boo/Haskell...• IronPython/Ruby/JS...• IDE Integration• Client Side Scripting• Debugging?
Image The New Media Consortium
![Page 22: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/22.jpg)
How Can You Help?
• Publish current C# API soon• Public C# beta this summer• Snowglobe open source viewer• Talk now!
Image Atomo Hosho
![Page 23: Building The Virtual Babel: Mono In Second Life](https://reader030.vdocument.in/reader030/viewer/2022032419/55a28d651a28ab0f588b4609/html5/thumbnails/23.jpg)
Thank You
• Jim Purbrick• Babbage Linden• [email protected]• http://blog.lindenlab.com• http://jimpurbrick.com