开发者

Replaying file system calls

开发者 https://www.devze.com 2023-04-04 17:08 出处:网络
I have a collection of file system I/O calls of the format processidsystem-call For example 1open(A) 1read(A)

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号