共享内存操作系统使用精心设计的锁来保护各种共享数据,对这些数据的访问需要首先获得对应的锁,当内核中同时有多个流程(系统调用、内核线程或中断处理程序等)试图获得同一个锁时会产生竞争,相关流程越多竞争就越激烈.随着系统中处理单元数目的增长,这些流程的数量也在不断增加,此时,对锁的竞争会影响系统的整体性能,甚至成为瓶颈.另一方面,操作系统与应用程序在同一处理器核上交替运行,因为硬件cache容量有限,导致操作系统的代码和数据经常替换掉应用程序的代码和数据.当应用程序重新被调度运行时,需从更慢速的cache,甚至从内存中读取这些代码和数据,从而降低了性能.通过在一台16核AMD节点上的相关测试,以上问题得到了量化验证,并针对这些问题提出了一种异构操作系统模型.在此模型下,应用程序和操作系统分别运行在不同的处理器核上,实验显示这种模式可以有效降低对锁的竞争和对cache的污染.
The shared memory operating system provides a lot of shared data structures protected by different locks. Contentions on these locks are relative to the number of active progresses (system call, kernel thread and interrupt handler) which depend on the number of processing elements. As more cores are integrated into a package, there are more and more processing elements available to the operating system. Therefore, contentions on the locks will decrease the performance of the whole system and even become a bottleneck. On the other hand, kernel runs on the same core with some application. Limited by the capability of hardware cache, the kernel code and data of the operating system may replace those of the application in the cache. Once the application gets opportunity to run, it will retrieve data from the slower cache or even from the memory subsystem to continue its execution. In such way, the performance of the application will be decreased greatly. This paper proves the existence of the above problems through several experiments on a 16-core AMD platform. Then, we propose a heterogeneous operating system focusing on these problems. In our opinion, the application and the operating system kernel run on different processing cores in order to decrease the possibility of contention and the pollution to the cache.