sandboxing python code
tjreedy at udel.edu
Tue Jun 3 22:32:11 CEST 2003
"Michael Chermside" <mcherm at mcherm.com> wrote in message
news:mailman.1054662971.17122.python-list at python.org...
> What to do? Well, what you need is a large and complex system for
> managing resources. It should be responsible for providing nearly
> resources -- timeslicing CPU use, allocating memory, mitigating
> to disk, network sockets, etc, etc. Such a system is called an
> "operating system".
In a house with kids (see first word of subject line), its called
'responsible adult supervision'. The OPs question is a lot like "How
do I make sure a kid does X in a reasonable amount of time" without
supervision or at even checking on progress from time to time.
> Okay, forgive me my dramatic phrasing... the truth is that resource
> restriction is best done by the operating system... and, in fact,
> much can ONLY be done by the operating system (if you built
> to manage resources this well, you'd be creating your own OS). So
> REAL solution is to use the OS.
Back in the days when CPU time cost $6/minute, etcetera, IBM's OSes
monitored usage of scarce resources. The usage limit per run was the
lesser of what the user had in his/her account and what the user
explicitly allocated to the run. Limit reached? Process killed! ...
One learned to read code carefully and expend time frugally.
Terry J. Reedy
More information about the Python-list