What is the microkernel and monolithic? [Huawei swan operating system - micro-kernel]

Microkernel and monolithic kernel compare

core architecture according to two categories: micro-kernel (microkernel) macro kernel (macrokernel) microkernel system has WindowNT, Minix, Mach, etc monolithic systems have Unix, Linux, etc.. comparison to compare the Minix and Linux microkernel and monolithic kernel is very interesting, because in those days the founder of the two systems has been debate over the merits of two kinds of kernel by

kernel of the two systems is achieved through the process of creating FORK be comparison, because the process involves the creation of system calls, memory management, file management . the main aspects of the systems can therefore be roughly seen by comparing the difference between the kernel FORK implementation.

represents the microkernel: Minix

in Minix, the operating system kernel , memory management, systems management has its own process table, each table section contains the domain you need. Corresponding representation is accurate, in order to keep pace in the process of creating or end, these three sections will be updated each table.

Coordinated by the memory manager.

After the system starts, kernel, mm, fs system processes running in the respective spatial main () function waits for a message loop

the While (TRUE)

{...

the receive (the ANY, & mm_in);

...}

When a FORK passed mm'main (), main () calls do_fork (), do_fork () function of the data segment and stack segment of the parent process creates an exact copy to the child, and the text segment of the parent process and child sharing process, then the process mm table mproc [] to add a new process, and sets each property. After addition the message sent to the kernel (sys_fork (...)) and fs (tell_fs (...)). , In sys_task kernel function () receives the system information, call do_fork (message * m_ptr), copy parent'proc struct to child . and set the property process in the kernel process table. tell_fs () is between the memory manager and file system interface, tell_fs (...) call _taskcall (...), the file manager receives the message FORK system call do_fork () function, copy parent'fproc struct to child. and the process of setting properties in a file process table. This property is set to complete the entire process.

During the process of creating a new Minix, you can see a great feature is that the entire system by function is divided into several sections, each module between the use of messaging communication, call other function modules daemon must be called by the target module.

representatives macro kernel: Linux

in Linux, the structure of the process is as follows:

struct task_struct {

pid_t pid;

pid_t pgrp;

...

/ * filesystem Information * /

struct fs_struct * FS;

/ * Memory Management info * /

struct mm_struct * mm;

...

};

in the definition of the structure of the Linux process, task_struct contains all the information, including information on the process of memory, file system situation. When creating a new process, the system call calls sys_fork do_fork (...) function.

Int do_fork (unsigned Long clong_flags, ...)

{

struct the task_struct * P;

p-> get_pid = PID (the clone_flags);

...

/ * Copy Process The Information All * /

copy_files (the clone_flags, P);

copy_fs (the clone_flags, P);

copy_mm (NR, the clone_flags, P);

...

}

in creating process, do_fork function to all the work is completed, the assigned PID ... number, copy parent data segment, stack segment, and so on. Linux process is the process of creating a complete process, direct call function other modules, instead of messaging.

Minix and Linux creates a new process can be seen in the process of comparing the difference between the two, Minix is based on the sub-module to transfer contact information between modules. Linux is an internal sub-module, but at run time, he is an independent binary large image communication between its modules by directly calling a function in other modules to achieve. The difference between monolithic and microkernel It was at that right, microkernel is a transit point for information, to complete their own little function, primarily pass a request for a function module to another module, and macro kernel is a big director, the memory management, file management and so on will fall all over.

In theory, thought better of some micro-kernel, microkernel system is divided into various small function blocks reduces the design effort, maintenance and modification system is also easy, but the communication efficiency loss caused by a problem. The degree of coupling between the macro kernel function block is too high resulting in modification and maintenance costs are too high, but at present there is not too big a problem for Linux, because Linux is still not too complicated, monolithic because it is a direct call, so efficiency is relatively high.

Guess you like

Origin www.cnblogs.com/lizhen416/p/11330991.html