Playground for Golang

Playground for Golang

What is Playground?

The service receives a Go program, compiles, links, and runs the program inside a sandbox, then returns the output

The playground service has three parts:

The back end

The back end program itself is trivial, so we won’t discuss its implementation here. The interesting part is how we safely execute arbitrary user code in a secure environment while still providing core functionality such as time, the network, and the file system.

Faking time

Playground programs are limited in the amount of CPU time and memory they can use, but they are also restricted in how much real time they can use. This is because each running program consumes resources on the back end and any stateful infrastructure between it and the client.

Faking the file system

Programs built with the Go’s NaCl tool chain cannot access the local machine’s file system. Instead, the syscall package’s file-related functions (Open, Read, Write, and so on) operate on an in-memory file system that is implemented by the syscall package itself.

The playground uses the latest stable release of Go.

Read more…

Rating:

comments powered by Disqus