跳至主要内容

博文

目前显示的是 五月, 2016的博文

Who request reading?

Origin 一个问题:一个进程要读取文件,在底层用的是DMA的方式,DMA完成文件读取以后要通过中断让CPU去处理,但是CPU和中断处理程序根本不知道进程的,他怎么去和它进行关联,如何去唤醒那个等待的进程? A problem: A process want to read a file. This computer use DMA to handle io request. DMA will finish the reading/writing then interrupt CPU to make CPU handle the next step. But CPU and interrupt handler of io have no idea which process request for the io, how could they wake up that waiting process? What I have done in my os lab github repository of my os lab Process: system call write(int fildes, const void *buf, size_t nbyte) is invoked context switch happens: move to kernel state, because a system call is invoked user process send a message(IPC in my os lab) to FM(file manager – controll the service related with file) and suspend itself FM combine the information in file table(file descriptor lead us to file ) to find file info FM send message to corresponding driver(ide – disk driver, tty – terminal driver, memory) – in our case, is hard disk drive – ide FM su