1、嵌入式操嵌入式操作系统研究简介作系统研究简介(部分举例)(部分举例)陈香兰 2008.3.5提纲提纲n嵌入式操作系统的多样性n嵌入式内存扩容技术举例嵌入式市场的多样性导致嵌入式操作系统嵌入式市场的多样性导致嵌入式操作系统的多样性的多样性n嵌入式嵌入式Internet应用应用信息家电信息家电军事方面军事方面嵌入式微处理器嵌入式微处理器n1000多种硬件处理器多种硬件处理器,MPU、MCU、DSP、SOClARM RISCARMlTMS320 DSPTIlTrimediaPhilipslStrongARMIntel,ru SA1110(已被PXA250替代)lXscaleIntel,ARM V5T
2、E兼容产品,如PXA250lMIPS RISCMIPSlDragonBallMotorala典型的嵌入式操作系统典型的嵌入式操作系统n近近200种操作系统种操作系统,VxWorks,QNX,WinCE,Palm OSn面向SOC的RTOS:Symbian的Epoc、ATI的Nucleus、Express logic的Threadxn开放源码的OS:uCLinux,uC/OS,RTEMSn典型性能指标:l内核大小:几K几百Kl调度时间片:几十msl实时进程/线程响应时间:2040us?l普通进程响应时间:20us几百ms?嵌入式操作系统的多样性嵌入式操作系统的多样性n多地址空间 vs.单地址空间
3、n有MMU vs.没有MMUn多进程 vs.单进程多线程n多用户 vs.单用户n模块化+动态加载 vs.静态联编n标准C库支持 vs.部分C库支持n是否可配置n是否可移植n是否易编程n是否支持实时调度n低功耗嵌入式内存压缩技术研究嵌入式内存压缩技术研究nL.Yang,R.P.Dick,H.Lekatsas,and S.Chakradhar,“CRAMES:Compressed RAM for Embedded Systems,”Proc.Int.Conf.Hardware/Software Codesign and System Synthesis,pp.9398,Sep.2005.l Not
4、es:NEC used this technology in their cellphones in June 2007.lOperating system technique to double usable memory in embedded systems without changing applications,or hardware,and with little or no performance or power penalty.l已获专利nmotivation:l内存是稀缺资源,没有硬盘提供交换区l在嵌入式环境中,加大内存增加成本增加体积、功耗l硬件设计赶不上应用的变化n解
5、决思路l不增加硬件、不改变硬件l在现有内存容量的基础上,动态增加有效的内存容量n方法:l压缩,利用交换技术和缺页技术n限制:需要MMU的支持nMain problemslDoes the technique allow existing applications to execute without performance and energy consumption penalties?lCan new applications with working data sets that were originally too large for physical memory be autom
6、atically made to execute smoothly?lWhat compression algorithm should be used,and when should compression and decompression be performed?lHow should the compressed RAM area be managed to minimize memory overhead?lHow should the technique be evaluated for use in embedded systems?nMethodslTake advantag
7、e of the operating system(OS)virtual memory swapping mechanism lMultiple compression techniques and memory allocation methods were experimentally evaluated;Bzip2,zlib default,zlib level1,zlib level9,RLE,LZRW-1A,LZOlDynamically adjust the size of the compressed area during operation based on the amou
8、nt of memory requirednImplementationla loadable Linux kernel modulelThis technique can easily be ported to other modern OSs.不带不带MMU的内存扩展技术的内存扩展技术nL.Bai,L.Yang,and R.P.Dick,“Automated Compile-Time and Run-Time Techniques to Increase Usable Memory in MMU-Less Embedded Systems,”in Proc.Int.Conf.Compile
9、rs,Architecture&Synthesis for Embedded Systems,pp.125135,Oct.2006.lNotes:Compiler-assisted on-line data compression technique permits substantial increases in usable memory on MMU-less embedded systems,such as sensor network nodes.nmotivation:l内存是稀缺资源,没有MMUn分析:lWhat MMU does?n思路:lSoftware MMU(MEMMU)
10、l压缩n方法:lCompile-time compresslRuntime uncompressn适用于:l内存非常小的系统,而且不带MMUl例如:无线传感器nMain problem:lTransparent to userlIntelligently determine which pages to compress and when to compress them to minimize performance and energy penalties.This is particularly challenging for low-end embedded systems witho
11、ut MMUs.lControl the organization of compressed and uncompressed memory regions and the migration of data between them to maximize the increase in usable memory while minimizing performance and energy penalties.lDesign a compression algorithm that has low performance overhead,low memory requirements
12、,and a good compression ratiomethodnMEMMU divides physical RAM into three regions:lthe reserved region,OS,MEMMUlthe compressed region,applicationland the uncompressed region.Applicationnthe size of each region is decided bylcompile-time analysis of application memory requirements land estimated comp
13、ression ratio.The application view nWith MEMMUSoftware-maintainednHandle-based Data AccesslVirtual address page numlMapping array1.If maps to uncompressed region,2.If has not been accessed before(no mapping)Allocate an uncompressed page,and map May be need replacement3.If maps to compressed region Decompressed,move,new map May be need replacementnTo be transparent:lThose routines runtime librarylNeed compiler transformationsn换入/换出抖动?n压缩区域,页面大小不一致碎片?交换技术和缺页技术交换技术和缺页技术虚拟空间物理内存交换区缺页换入换出MMU,TLB,页表