GithubHelp home page GithubHelp logo

shadowpower / judger Goto Github PK

View Code? Open in Web Editor NEW

This project forked from qingdaou/judger

0.0 2.0 0.0 162 KB

Online judge sandbox based on seccomp | 需要命令行、Java JNI和php C extension集成,欢迎contribute

Home Page: https://qduoj.com

License: Other

C 75.78% Python 24.22%

judger's Introduction

#Judger Build Status

OnlineJudge 判题沙箱

本项目属于历史项目,最新代码请看newnew分支,相关文档请看 http://docs.onlinejudge.me

##Python api 使用方法

见 demo

sudo python setup.py install
cd demo && sudo python demo.py

##C语言 api 使用方法

#include "runner.c"即可,然后传入 configresult 的结构体指针。

为什么不是ptrace

ptrace在很多OJ上都有应用,但是不可否认的是ptrace存在一个重大缺点:严重影响进程运行的性能,因为每次系统调用就要进行两次上下文切换,从子进程到父进程,然后父进程到子进程。OJ上题目很多都需要大量的输入和输出,会产生大量的系统调用,导致代码运行时间加长。

##注意

  • 本Judger定位于C/C++语言,如果使用Java,由于JVM的特殊性,请设置use_sandbox=False, max_memory=MEMORY_UNLIMITED,安全方面使用Java自带的安全策略,内存限制方面使用XmsXmx等参数。参考这里关于Java的部分注释。
  • runner.c里面硬编码了系统调用白名单,在Ubuntu 14.04 64位系统上测试通过。如果在您的系统上正常程序出现了Runtime Error可能是部分系统调用不一致导致的。如果怀疑是这个原因提出issue,请务必提供系统版本和strace ./FILE_NAME的结果。目前已知32位系统肯定会出现非白名单系统调用,但是因为32位系统无法使用docker,一般出现在本地测试环境中。
  • 如果使用了 use_nobody = True 则需要 root 权限启动。
  • Python api 请只使用str。

##感谢

judger's People

Contributors

spxcds avatar virusdefender avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.