From: Jeff D. <jd...@ka...> - 2000-09-22 16:39:30
|
vb...@is... said: > The tracing thread is the replacement for the scheduler? No. The tracing thread is what virtualizes everything. It intercepts system calls and gets UML processes in and out of the kernel. The scheduler is where it's always been, in kernel/sched.c:schedule(). > Tasks get > scheduled by the hosting machine? True? No, except in the trivial sense that UML processes have host processes under them, and those processes get scheduled by the host. schedule() in a UML ensures that there is only one runnable process at a time (on a UP virtual machine). That process is made runnable in the host and all of the others are stopped, and can't be scheduled by the host. So, whenever the host decides to give a UML some cycles, those cycles will go to whatever process the UML has scheduled (or maybe the tracing thread if it needs to do something). > Except for the ptrace > (TRACEME) part, what else is required for a task to be a UML proces? It needs to be started by a UML, its signal handlers need to be set up correctly... Look at arch/um/kernel/process.c:trampoline(). > Does the UML kernel keep seperate task_structs? Of course. Native kernels do this, so UML has to. > How is the memory > allocation/organisation handled (so who does this and when do you > allocate it at the host kernel?) The kernel and its memory is present in the address space of every UML process. They get there by being mapped into the initial address space (that of the tracing thread) shared. When new processes are created, they are cloned CLONE_VM, which preserves the sharedness of that memory. The kernel itself is linked to load at 0x10000000, getting it out of the way of its processes, which are going to load at 0x8000000. "Physical" memory is a file mapped in at 0x50000000. kmalloc works from that pool of memory. Pages from that file are mapped into kernel and physical virtual memory areas as mappings are changed. So, vmalloc gets some physical memory with kmalloc, locates some kernel virtual memory to map it into, and the appropriate pages from the physical memory file are mapped into that area by the arch layer. Jeff |