在线评判网站如何隔离程序性能?

发布于 2024-08-16 18:29:14 字数 173 浏览 4 评论 0原文

有许多在线评判网站可以通过将输出与正确答案进行比较来验证您的程序。更重要的是,他们还会检查运行时间,以确保您的程序运行时间不超过最大限制。

那么我的问题是,由于一些在线裁判网站同时运行多个测试程序,它们如何实现性能隔离,即如何确保在重负载环境中运行的用户程序能够在同一个测试程序内完成?时间,比如在空闲环境中运行时?

There are many online judge sites which can verify your program by comparing its output to the correct answers. What's more, they also check the running time to make sure that your program running time doesn't exceed the maximum limit.

So here is my question, since some online judge sites run several test programs at the same time, how do they achieve performance isolation, i.e., how can they make sure that a user program running in a heavy-loaded environment will finish within the same time, as when it is running in an idle environment?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

如果没结果 2024-08-23 18:29:14

操作系统将 CPU 时间与现实世界的“挂钟”时间分开跟踪。在进行基准测试时,仅查看一种或另一种时间是很常见的。 CPU 或文件 I/O 密集型任务只需 CPU 时间即可测量。需要外部资源的任务(例如查询远程数据库)最好以挂钟时间来衡量,因为您无权访问远程资源上的 CPU 时间。

如果评审站点只是比较不同测试的 CPU 时间,则该站点可以同时运行许多测试。另一方面,如果挂钟时间很重要,那么站点必须使用独立的硬件或作业队列,以确保一个测试在下一个测试开始之前完成。

Operating systems keep track of CPU time separately from real-world "wall clock" time. It's very common when benchmarking to only look at one or the other kind of time. CPU or file I/O intensive tasks can be measured with just CPU time. Tasks that require external resources, like querying a remote database, are best measured in wall clock time because you don't have access to the CPU time on the remote resource.

If a judging site is just comparing CPU times of different tests, the site can run many tests simultaneously. On the other hand, if wall clock times matter, then the site must either use independent hardware or a job queue that ensures one test finishes before the next starts.

ま昔日黯然 2024-08-23 18:29:14

正如计算机语言基准测试游戏测量CPU时间和运行时间这些测量< strong>在空闲环境中按顺序制作。

As The Computer Language Benchmarks Game measures both CPU time and Elapsed time those measurements are made sequentially in an idle environment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文