On Sun, May 04, 2014 at 03:41:45AM -0700, Archos wrote:On Sunday, May 4, 2014 11:30:05 AM UTC+1, Aram Hăvărneanu wrote:
The place for enforcing quotas is not in the Go runtime. Use your
operating system's resource quota technology.
The issue is that I want a solution for all systems (where Go runs) and
since I know, Windows --I'm not user of such sytem-- does not enables to
limit resources like memory.
It's been a while, thankfully, since I had to deal with Windows, but it likely
has this mechanism as well, just done differently.
In general, I don't think it's useful to push features into a language because
a target OS does not natively support that feature. Otherwise, the language
turns into an OS ;)
Also, measuring memory consumption accurately is complex business,
there's no such thing as "my program uses xMB of memory" in the world
of virtual memory systems. You have to be very precise about what kind
of questions you ask. Fortunately, the quota mechanisms allows for
this fine grained caps.
I simply want to limit the resources like if the Go compiler were a VM,
for programs untrusted downloaded from Internet.
Of course, I've in mind packages like syscall, functions of "os", etc, for
that such programs can not damage the system where they are run.
The Go compiler is NOT like a VM and cannot be depended upon to limit damage
caused by untrusted programs. You need a sandbox for that.
I would review the code for play.golang.org (IIRC it's available somewhere).
You'll find that you need an actual VM of some kind to do this effectively, which
obviates the need for Windows compatibility and provides the level of control you need
to implement it correctly.
-Gyepi
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.