通过 ac 程序模拟文件系统跟踪
我有一个包含“PID、调用时间、系统调用”类型记录的文件,并且不同进程进行的调用是交错的。现在,我正在编写一个模拟器来重放系统调用,并且需要由 PID 1 进行的调用与 PID 2 进行的调用由不同的进程进行。此外,同一进程必须进行 PID 1 进行的所有调用并按照跟踪文件中显示的顺序进行。将不胜感激一些帮助。谢谢...
I have a file with records of the type "PID, time of call, system call" and calls made by different processes are interleaved. Now, I am writing a simulator to replay the system calls and need a call made by say PID 1 to be made by a different process from a call made by say PID 2. Moreover the same process must make all the calls made by PID 1 and in the same order as appears in the trace file. Would be gratefull for some help. Thank you...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种简单的方法是创建一个包含一个 PID 成员的链表。对于每个调用,您可以遍历列表(如果未找到 PID,则添加一个节点)并使每个节点保存一个文件句柄或可以向进程提供数据的内容。
如果您的 PID 不是“随机”数字,而是 1、2、3、4 等...您始终可以使用(指针)数组执行相同的操作,以避免遍历列表所需的时间。
不确定这对你来说是否足够,但你又没有真正提供太多细节......
A simple way would be to make a linked list with one PID member. For each call you could traverse the list (and add a node if the PID is not found) and make each node hold a filehandle or something where you can feed the process with data.
If yor PID's are not "random" numbers but 1,2,3,4 etc... you can always do the same thing with an array (of pointers) to avoid the time it takes to traverse the list.
Not sure if this is enough for you but again you don't really give much details...