Messages in this thread | | | Date | Tue, 11 Jan 2005 02:49:19 -0800 (PST) | From | selvakumar nagendran <> | Subject | pipe_wait illustration needed |
| |
Hello linux-experts, I can't understand this function pipe_wait defined in linux/fs/pipe.c line by line,especially the lines after add_wait_queue. If the process is added to the wait queue and schedule() is called then after that a new process will be selected and will be given the CPU. So, the current process will be out of the way. Then, how can the kernel reach the line remove_wait_queue. Also, how the scheduler will know that the pipe event has occurred and it's safe to set the process state to TASK_RUNNING?
Thanks, selva ---------------- /* Drop the inode semaphore and wait for a pipe event, atomically */ void pipe_wait(struct inode * inode) { DECLARE_WAITQUEUE(wait, current); current->state = TASK_INTERRUPTIBLE; add_wait_queue(PIPE_WAIT(*inode), &wait); up(PIPE_SEM(*inode)); schedule(); remove_wait_queue(PIPE_WAIT(*inode), &wait); current->state = TASK_RUNNING; down(PIPE_SEM(*inode)); }
__________________________________ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |