| The microkernel is committed to minimizing the functions provided by the kernel,implementing non-core functions such as drivers and file systems in user space outside the kernel,reducing the coupling between systems and improving portability.In recent decades,after the development of microkernel for three generations,people have put forward higher requirements for the security and performance of microkernel.The way and efficiency of inter-process communication(IPC)is critical to microkernels.The event-driven model has many advantages,and it would be revolutionary to design it as a way of inter-process communication.At present,most operating systems use a process/thread two-layer parallel running structure,which is powerless in the face of tasks that need to be serialized.Coroutines using cooperative scheduling seem useful.Modern operating systems mostly run on symmetric multiprocessors.Faced with data synchronization,locks are often required,which brings about the problem of operating efficiency.Lock-free processing is a way worth exploring.In response to the above problems,the main contents and contributions of this dissertation include:·An event-driven inter-process communication mechanism running in the microkernel is designed,the publish/subscribe mode is introduced into the kernel layer,and the concept of event source and event is introduced.In this design,any type of data is abstracted into events,and each type of event is generated by an event source.In addition to the constant event sources defined by the kernel,programs can also create event sources.Both event sources and events use reference counting to manage their lifecycle.·A universal scheduling mechanism is designed,which matches the purpose of event-driven.Preemptive scheduling is used between processes and appropriate scheduling algorithms are used,while cooperative scheduling coroutines are used within processes,and an event bus is defined as the management coroutines.The concept of "switching point" is introduced to the coroutine.When the coroutine runs to the switching point,the current coroutine is suspended,and the current process switches to the event bus to run.The use of locks is avoided because the operation timing can be controlled and operations on shared variables can be serialized.·The external interface is clearly set,and the relevant APIs(system calls)are defined.There are four types of operation subjects: event source,event,event bus,and coroutine.It covers as many needs as possible with generality without redundancy.The function of event-driven inter-process communication and scheduling is developed and implemented on the Zephyr operating system. |