[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: How to preempt a thread?
Hi,
On Tue, Nov 5, 2013 at 7:33 PM, Goswin von Brederlow <goswin-v-b@xxxxxx> wrote: Hi, Mirage only uses co-operative threads via Lwt. When the Lwt scheduler has run out of "threads" it calls a hypercall ("SCHEDOP_block") which takes the vCPU offline. When an interrupt fires the vCPU jumps into a C callback, which would normally do some work in a regular OS, but in Mirage it does nothing. When the callback returns we re-run the main loop. The main loop checks which interrupts have fired (this information is in a shared memory page) and signals any blocking lwt threads. The main loop runs the Lwt scheduler, and eventually blocks again.
This demonstrably works: we've got co-operative drivers, HTTP implementations etc. However there is no pre-emption so we can enter into infinite loops if we're not careful. The code tends to be fairly "threaded" (lots of Lwt.binds) so there are lots of opportunities for the Lwt scheduler.
At some point we ought to check out the multi-runtime patches so we can fire up multiple OCamls, one per vCPU. Perhaps it would be useful to implement some kind of watchdog which would reboot the OCaml runtime if it does get stuck.
Nope :/
This would indeed be very cool. IIRC the RPi opengl driver for Linux is just a shim which marshals opengl over shared memory to be interpreted by the broadcom firmware. If this is true then we could even get 3D on the console (eventually). However I'm sure it's best to walk before we try running :)
Cheers, Dave
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |