From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julian Stecklina Subject: Some comments on multiple threads in Mini-OS Date: Tue, 15 May 2007 13:57:02 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hello, this is based on the Mini-OS in the xen-3.0.4-testing.hg repository, so if any of this has been obsoleted, please say so. :) Multithreading in the Mini-OS (on x86) has some problems: a) a stack overflow overwrites the pointer to the thread's "struct thread". Perhaps one could a segment register to point to the thread control block? b) GCC seems to use ESP as general purpose register now and then. This makes get_current() or current return bogus values. A workaround to that is to not inline get_current() or use the pointer to a local variable (which is an approximation to the current stack pointer) to compute the struct thread pointer. c) All threads are limited to the same stack size. d) and yes, it's cooperative, but I can live with that. Just my 2 cents and patches are on their way once I have updated my stuff to unstable. Regards, Julian