重放文件系统调用

发布于 2024-12-04 02:46:33 字数 429 浏览 0 评论 0原文

交错序列的文件系统 I/O 调用的集合

processid   system-call

我有一个格式为例如

1  open(A)
1  read(A)
2  open(B)
1  open(C)
2  write(B)
.....

。我现在需要以大致相同的顺序重播这些跟踪,并且每个进程都由不同的线程执行。在我编写的程序中,主线程读取跟踪文件,并通过将系统调用放入相关线程的任务队列中来将任务分配给进程对应的线程。任务线程从其队列中读取调用并进行必要的调用。

但我没有实现 I/O 跟踪文件中所示的交错。请建议我一种方法...

谢谢

编辑:一种方法是在调用每个跟踪后延迟主线程读取文件,从而允许任务线程继续进行。这使得线程的目的毫无用处,但它似乎达到了我的目的

I have a collection of file system I/O calls of the format

processid   system-call

For example

1  open(A)
1  read(A)
2  open(B)
1  open(C)
2  write(B)
.....

i.e interleaved sequence. I now need to replay these traces in approximately the same order and each process being executed by a different thread. In the program i have written, the main thread reads the trace file and allocates task to the thread corresponding to the process by putting the system call in the task queue of the concerned thread. The task thread reads calls from its queue and makes the necessary calls.

But I am not achieving the interleaving as seen in the I/O trace file. Please suggest me a way...

Thank you

Edit: One way is to delay the reading of the file by main thread after each trace is called thus allowing the task threads to proceed. This makes the purpose of threads useless but it seems to serve my purpose

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

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

发布评论

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

评论(1

探春 2024-12-11 02:46:33

让调度程序在告诉线程要做什么后进入睡眠状态,并睡眠直到线程完成时被线程唤醒。你不会同时执行;您将通过不同的线程命令执行。这就是您所要求的,但可能不是您想要的。您可能想要的是将依赖关系图写入文件中,并让每个线程等待,直到其依赖关系完成。某些语言(例如 prologue 和 haskell)会为您执行此操作。

Have the dispatcher go to sleep after it tells the thread what to do and sleep until it is woken up by the thread when the thread completes. You won't have simultaneous execution; you will have ordered execution by different threads. That's what you have asked for, but it's probably not what you want. What you probably want is a dependency graph written into the file and to have each thread wait until its dependencies are completed. Some languages (like prologue and haskell) will do this for you.

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