kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: sironhide0null@gmail.com (zerons)
To: kernelnewbies@lists.kernelnewbies.org
Subject: signals, syscalls and schedule()
Date: Fri, 25 Nov 2016 10:32:50 +0800	[thread overview]
Message-ID: <26bda631-e316-316e-e0f5-1dcb9b2753a2@gmail.com> (raw)

Hi all.
I have several doubts about signals and syscalls.

When a signal handler gets involved?
About signal, I think I have figured it out, maybe?
I checked the source code, and found that when call `prepare_exit_to_usermode`
-> `exit_to_usermode_loop`, then `do_signal` gets involved. So when switch to
user mode, the signal handler get called before restart the syscall if needed.
That means when return from a syscall or the process scheduled, we could handle
the signal.

Interruptible syscalls, they check the process signal state by themselves and
return -ERESTARTSYS or -EINTR, is that why we call them interruptible syscalls?

When a syscall running, and then the time slice runs out, does it switch to a
new process or wait until the system call returns? If switch to a new process,
when the interrupted process runs again, is it still in kernel mode to finish
the syscall? Is that to say, a signal is handled when return from a syscall or
the process scheduled and it is in usermode?

                 reply	other threads:[~2016-11-25  2:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=26bda631-e316-316e-e0f5-1dcb9b2753a2@gmail.com \
    --to=sironhide0null@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).