MkLinux

microkernel : core collection of OS-neutral abstractions (tasks, threads, ...) upon which can be built OS servers. No file systems, network protocol services etc. ==> more portable and modular



Steps to port OSF MK to PowerMac

Development environment and compiler tool chain : cross-compiling on x86 with Linux and HP700 with OSF/1 using GCC 2.7.1(supports PowerPC code using ELF). Debugging on a remote station (serial line) using a crossed version of GDB

Device drivers (rather platform dependent -> device drivers of other platforms could be reused using some PowerMac-dependent DMA code)



Linux Server architecture

SINGLE Server (the entire Linux functionality is one single Mach task). Alternative : multi-server design, with smaller specialized tasks communicating thru Mach RPC. The development team chose the former approach : maximize code reuse of the existing monolithic kernel.

MULTI-THREADED server : rely on Mach threads and user-mode cthreads library (because it offers various synchronization primitives)

Mach 3 : uses a system call emulation facility which redirects control flow to an emulation library, that resides IN THE USER ADDRESS SPACE and communicates with the server via Mach RPC calls ==> good performance, but complex and a security issue.

INSTEAD : OSF MK extends the Mach exception mechanism : a system call from a user task raises an EXCEPTION and enters the microkernel. The microkernel sends an exception RPC to the Linux server.

Linux server : has to use the Mach VM interface ==> PERFORMANCE ISSUE (switch to microkernel for each Server access to user task memory)

Scheduling : is a microkernel duty. The Linux "schedule" is still used to scan the task list for runnable tasks, but no actual context switching. User tasks BLOCK when running in one of the Linux server threads, using Mach synchronization primitives, provided by the cthreads library.

in monolithic Linux, pending signals are delivered to a user process when it returns from kernel mode to user mode. A user process can enter kernel mode when issuing a system call (causes an exception) or when interrupted by hardware.

Linux Server : can never be interrupted by hardware ! ==> SERIOUS PROBLEM : a user process looping in user-mode without doing any system calls or exceptions is virtually unkillable because signals will never be delivered to it !

SOLUTION : FAKE INTERRUPTS to allow the Linux server to regain control on a user process even if it does not cooperate. A user thread can be suspended using the Mach thread_abort_safely service.

VM emulation : page management is totally hidden by the microkernel. A task can create memory objects and map them in address space.

Linux Server : to minimize changes, dumb emulation of the page table macros and routines. The Linux Server does not really use it (most of the time they are empty !), but it allows to compile more Linux code.

Dynamic Buffer cache : the Linux Server has no way to know that the system is short of memory. The microkernel does not report memory shortage. Classic problem of Mach servers : double paging


Linux Server on the PowerMac

It was first developped on the Intel platform. Once the microkernel was stable enough on the PowerMac, the two had to be married.

Major difference with native Linux : the Linux Server offers the full 32-bit address space, rather than the restricted 31-bit offered by native Linux

Disk I/O performance : POOR POOR POOR ! Due to extra overhead of the Mach device interfaces, there's only one block read per disk revolution :(