linux-um archives
 help / color / mirror / Atom feed
* [uml-devel] How is Preemption implemented in User Mode Linux?
@ 2013-05-25 23:01 Hopsing K
  2013-05-26  8:08 ` richard -rw- weinberger
  0 siblings, 1 reply; 5+ messages in thread
From: Hopsing K @ 2013-05-25 23:01 UTC (permalink / raw)
  To: user-mode-linux-devel


[-- Attachment #1.1: Type: text/plain, Size: 1721 bytes --]

I'm running UML in Linux 3.2 (Debian) in SKAS0 mode. I compiled UML with
defconfig.
Now I try to  poked in the source to figure out how Preemption is done
in UML. I came so far to understand that there is a ptrace-ing parent and
for each UML process a userspace-slave process on the host:
arch/um/os-Linux/skas/process.c:userspace(). This routine also has the jump
to
interrupt_end() which calls schedule(). I saw that SIGALRM handler is
installed
for that ptrace-ing parent and the userspace() loop catches SIGALRM for the
traced slave. However I didnt see it being called. Only the ptrace-ing
parent
gets SIGALRM and the signal handler
arch/um/os-Linux/signal.c:hard_handler()
is called directly. With my understanding there must be some connection
between
hard_handler() and the call to interrupt_end() inside the userspace() loop,
but I
cannot find any, I cannot figure out how Preemption is initiated when the
SIGALRM arrives.
I wonder: Is all kernel code implementing cooperative threading ? Is there
no preemption when in kernel space?
If a userspace process runs a loop "while(1);" and therefore never calls out
to the kernel, how can another process been sheduled? The ptrace-ing
parent's
userspace() loop will never get control back.
I can also see a variable userspace_pid[0] that I assume is the active
slave-process and that there is only one such process running at any time,
the others are stopped?
I'm really curious how Preemption is done internally in UML, any insight
would
be welcome.
Some question at the side: can you call longjmp from within a signal
handler? My first assumption was that UML uses longjmp from within
the SIGALRM handler to implement preemption, butseems not to .
-- Thanks Konrad

[-- Attachment #1.2: Type: text/html, Size: 2234 bytes --]

[-- Attachment #2: Type: text/plain, Size: 421 bytes --]

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may

[-- Attachment #3: Type: text/plain, Size: 194 bytes --]

_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-27 21:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-25 23:01 [uml-devel] How is Preemption implemented in User Mode Linux? Hopsing K
2013-05-26  8:08 ` richard -rw- weinberger
2013-05-26 14:48   ` Hopsing K
2013-05-26 15:26     ` richard -rw- weinberger
2013-05-27 21:27   ` Rob Landley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox