From: selvakumar nagendran <kernelselva@yahoo.com>
To: linux-kernel@vger.kernel.org
Subject: pipe_wait illustration needed
Date: Tue, 11 Jan 2005 02:49:19 -0800 (PST) [thread overview]
Message-ID: <20050111104919.64122.qmail@web60603.mail.yahoo.com> (raw)
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
next reply other threads:[~2005-01-11 10:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-11 10:49 selvakumar nagendran [this message]
2005-01-12 1:59 ` Robert White
2005-01-12 4:42 ` selvakumar nagendran
2005-01-12 20:39 ` Robert White
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050111104919.64122.qmail@web60603.mail.yahoo.com \
--to=kernelselva@yahoo.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®