隐形调度器:拖拽精灵可以改变Scratch程序的行为
The Invisible Scheduler: Dragging a Sprite Can Change What a Scratch Program Does
浏览论文内容
中文总结 AI 辅助
本研究揭示Scratch中精灵堆叠顺序这一隐形调度器可改变程序行为,提出StackSwap工具检测此类并发问题,并在真实程序中证实其普遍性。
中文摘要 AI 辅助
数以千万计的儿童使用Scratch编程,其程序是并发的:当点击绿色旗帜时,每个精灵的脚本同时启动并共享项目状态。哪个脚本先启动由精灵的前后堆叠顺序决定,而没有任何积木块可以读取该顺序。拖拽一个精灵会将其置于最前面,且该顺序会随项目保存。因此,一个程序可能在作者的屏幕上正常工作,而在教师的屏幕上失败,尽管积木块完全相同。我们的关键观察是,在文件其余部分固定的情况下,在它们的位置之间重新排列启动脚本的精灵,恰好产生它们初始堆叠顺序的所有排列。在固定的输入和随机种子下,未修改的虚拟机能够重现每一种排列。StackSwap在所有这些顺序下运行项目,对于最多五个精灵则运行所有顺序,对于更多精灵则每个冲突图类别运行一个顺序,以及在两者均不可行时运行一个样本,并在四种观察视角下比较运行结果。它返回一个两运行见证,指明一对相邻精灵,其交换会改变结果,并将它们共享的资源作为候选原因;否则返回一个穷举或基于图的条件鲁棒性证书,或一个未解决的判定。在来自课程、在线评测系统和随机公共样本的767个真实程序中,具有调度选择的程序中26.4%(课程)和18.2%(公共)的程序在某些堆叠顺序下表现不同。在运行了所有顺序的敏感程序中,保存的顺序的结果在课程中位数17%和公共50%的顺序下重现。在脚本化游戏下,根据既定需求编写的谓词在一个顺序下成立,在另一个顺序下失败,涉及427份具有调度选择的学生提交中的5份。对于一半的敏感程序,随机流是竞争对共享资源中优先级最高的。最后,我们为学习者、评分者和Scratch平台提出建议。
英文摘要
Tens of millions of children program in Scratch, whose programs are concurrent: when the green flag is clicked, every sprite's scripts start together and share the project's state. Which script starts first is decided by the sprites' front-to-back stacking order, which no block reads. Dragging a sprite brings it to the front, and the order is saved with the project. Hence, a program can work on the author's screen and fail on the teacher's, with the same blocks. Our key observation is that, with the rest of the file fixed, rearranging the sprites that start scripts among their positions produces exactly the permutations of their initial stacking order. Under a fixed input and seed the unmodified virtual machine reproduces every one of them. StackSwap runs a project under these orders, all of them for up to five sprites, one per class of a conflict graph beyond, and a sample where neither is feasible, and compares the runs under four observation lenses. It returns a two-run witness naming an adjacent pair of sprites whose swap changes the outcome, with the resources they share as candidate causes; otherwise an exhaustive or graph-conditional robustness certificate, or an unresolved verdict. On 767 real programs from a course, an online judge, and a random public sample, 26.4% (course) and 18.2% (public) of those with a scheduling choice behave differently under some stacking order. Among the sensitive programs whose every order ran, the saved order's outcome recurs under a median 17% (course) and 50% (public) of the orders. Under scripted play, a predicate written from a stated requirement holds under one order and fails under another for 5 of 427 student submissions with a scheduling choice. For half of the sensitive programs the random stream is the racing pair's highest-priority shared resource. We close with recommendations for learners, graders, and the Scratch platform.
发表机构
- University of Waterloo(滑铁卢大学)
机构由 AI 辅助整理,请以论文原文为准。