嵌入式操作系统 内存管理机制及改进

VIP免费
3.0 陈辉 2024-11-19 5 4 1.1MB 66 页 15积分
侵权投诉
摘 要
在以计算机技术、通讯技术相结合的信息时代的快速发展和互联网的广泛应
用的形势下,随着后PC时代的到来3C(ComputerCommunicationConsumer)
合一的趋势已经形成。在自动控制领域内,嵌入式软件必然成为重要成员,嵌入
式操作系统也将成为软件业的热点。嵌入式操作系统是嵌入式系统发展到一定阶
段的产物,是为了满足日益复杂的嵌入式系统设计的要求而产生的。随着微处理
器功能的不断提升,嵌入式操作系统的应用范围也变得越来越强大。对基于特定
嵌入式操作系统上的软件设计研究已成为了近年来的热点,并且对于嵌入式操作
系统在实际工程中的推广应用有着重要的意义。
本文首先介绍了嵌入式操作系统的产生、发展、特点、选型以及现今国外一
些有影响的嵌入式操作系统。接着论文重点分析了实时多任务嵌入式操作系统
μC/OS-II的系统内核结构,并详细分析了其任务管理、中断处理、时钟节拍和时间
管理、任务的同步与通信等基本功能如何实现。
简洁而高效的内存管理是操作系统理论及其设计实现中一个恒久的话题。操
作系统发展至今,从当初简单的前后台系统到如今复杂的多用户多任务环境,内
存管理的完善与否一直是评价一个操作系统好坏的重要标准。研究了μC/OS-II的内
存管理,发现当对一个申请到的内存块进行越界写操作或产生了指向空闲内存块指
针区(头几个字节)非法指针时可能会破坏它指向下一个空闲内存块的指针,这样,
空闲内存块链表就会被破坏。出于安全性要求,必须将控制信息与用户使用的空
闲内存块分开,内存块的控制信息属于系统数据,必须对其进行保护。利用μC/OS-II
的就绪表(Ready List) 中任务的调入和删除原理,构造一个内存管理表,实现内存
块的分配和释放。由此,μC/OS-II在内存管理中存在的安全性问题得到了解决。
后,针对现有的工作,提出了一些需进一步研究探讨的任务。
关键词:嵌入式操作系统 μC/OS-II 内存管理 内存分区 内存块
ABSTRACT
With the development of computer technology and communication technology in
information era and the broad application of Internet it is clear that 3C(computer
communication and consumer)will converge in the near future. In automation control
field, embedded software will be one of the most important elements. In addition, the
real-time embedded operation system (RTOS) will get more attention. The embedded
operating system is the result of embedded system that developed to a certain level, and
it is generated to meet the design requirement of expanding complex embedded system.
With the development of micro-processor function, the application extent of embedded
operating system is getting stronger and stronger. The software design and research has
been the hotspot recently, which based on customizing embedded operating system, and
it will has great significance for the embedded operating system popularizing to actual
project.
First, this thesis introduces the birth, development, characteristic and selection of
embedded operating system, and then introduces several overseas influential embedded
operating systems now. Then the thesis emphatically analyses the kernel structure of the
real-time and multitasking embedded operating system μC/OS-II and analyses
concretely how μC/OS-II perform its basic function such as the management of task
interruption, clock ticks and time management and the synchronization and
communication of task.
How to manage the memory tersely and efficiently is a lasting topic in the theory
and design of computer operating system(OS).As far as now, the OS have become an
administrator of a system which has multi-users and multi-tasks at the same time from a
simple fore-back ground software. In the process of OS development, whether the
memory management is perfect is always an import standard to verify an OS excellent
or terrible. By study the memory management of μC/OS-II, I find when the pointer
which point to the next free memory block and which stored in the free memory blocks’
first several bytes will be destroyed when an allocated memory block is written over the
edge of it by accidentally, or is pointed to its pointer area (the first several bytes) by the
illegal pointer, so the free memory block list will be destroyed. For safety, must extract
the control information from the free memory blocks, the memory control information
must be protected because it belongs to the system data. Then, apply the way of place
and remove a task in the task ready list of μC/OS-II, achieve allocating and releasing the
memory block by constructing a memory management list. From this, the safe problem
of μC/OS-II memory management is solved in the new method. Lastly aiming at the
work, put forward some task which need to be studied and discussed in the future.
Key word Embedded Operating System μC/OS-II memory
management memory partition memory block
目 录
摘 要
ABSTRACT
第一章 绪 论 ...................................................................................................................1
§1.1 课题研究的目的和意义 ...................................................................................... 1
§1.2 本领域国内外的动态及水平 .............................................................................. 3
§1.3 本文的研究工作 .................................................................................................. 4
第二章 嵌入式操作系统 .................................................................................................5
§2.1 嵌入式操作系统简介 .......................................................................................... 5
§2.1.1 嵌入式操作系统定义 ....................................................................................5
§2.1.2 嵌入式操作系统的发展 ................................................................................6
§2.1.3 嵌入式操作系统的特点 ................................................................................7
§2.2 嵌入式操作系统的选型 ...................................................................................... 7
§2.3 常见的几种嵌入式操作系统 .............................................................................. 9
§2.3.1 VxWorks ......................................................................................................... 9
§2.3.2 Windows CE ................................................................................................... 9
§2.3.3 嵌入式 Linux ............................................................................................... 10
§2.3.4 μC/OS-II ........................................................................................................11
第三章 μC/OS-II 的内核结构 .......................................................................................12
§3.1 μC/OS-II 的体系结构分析 ................................................................................. 12
§3.2 μC/OS-II 的内核分析 ......................................................................................... 13
§3.2.1 临界区的处理机制 ......................................................................................13
§3.2.2 任务管理 ......................................................................................................14
§3.2.3 μC/OS-II 的中断处理 ...................................................................................20
§3.2.4 μC/OS-II 的时钟节拍和时间管理 ...............................................................22
§3.2.5 μC/OS-II 任务的同步与通信 .......................................................................25
§3.2.6 μC/OS-II 的初始化和启动 ...........................................................................33
§3.3 本章小结 ............................................................................................................ 36
第四章 μC/OS-II 的内存管理机制分析 .......................................................................38
§4.1 内存控制块 ........................................................................................................ 38
§4.2 建立一个内存分区,OSMemCreate() ............................................................. 40
§4.3 分配一个内存块,OSMemGet() ...................................................................... 42
§4.4 释放一个内存块,OSMemPut() .......................................................................43
§4.5 查询一个内存分区的状态,OSMemQuery() ..................................................44
§4.6 本章小结 ............................................................................................................ 45
第五章 μC/OS-II 内存管理的改进及实现 ...................................................................46
§5.1 μC/OS-II 中内存管理存在的问题 ..................................................................... 46
§5.2 μC/OS-II 内存管理改进的基本方案 ................................................................. 47
§5.3 μC/OS-II 内存管理改进的实现 ......................................................................... 49
§5.4 本章小结 ............................................................................................................ 56
第六章 总结和展望 .......................................................................................................57
§6.1 总结 .................................................................................................................... 57
§6.2 本文下一步工作和展望 .................................................................................... 58
参考文献 .........................................................................................................................59
在读期间公开发表的论文和承担科研项目及取得成果 .............................................62
...............................................................................................................................63
第一章 绪 论
1
第一章 绪 论
随着信息技术的飞速发展,特别是互联网的普及,微电子技术的突破,嵌入
式系统在各行各业的应用程度达到了前所未有的状况。嵌入式系统已经广泛地
透到科学研究、工程设计、军事技术、各类产业和商业文化艺术以及人们的日常
生活等方方面面中。随着国内外各种嵌入式产品的进一步开发和推广,嵌入式技
术越来越和人们的生活紧密结合[1]。据美国嵌入式系统专业杂志 RTC 报道,21
纪初的十年中,全球嵌入式系统市场需求量具有比 PC 市场大 10 100 倍的商机。
在芝加哥举办的嵌入式系统会议上,专家一致认为,21 世纪嵌入式系统将无所不
在,为人类生产带来革命性的发展。除了良好的硬件平台外,一个优秀稳定的嵌
入式操作系统越来越被业界所重视,在很多应用中,特别是航空,航天,军事等
高科技领域正起着举足轻重的作用。2004 年年初,成功登陆火星的美国“勇气号”
上装载了 VxWorks 实时操作系统[2]“勇气号”从升空到着陆,以及火星巡游,都
是在该系统的指引下完成的。故而,发展强有力的嵌入式操作系统(Embedded
Real-Time Operating SystemERTOS,成了嵌入式系统发展的核心部分[2]世界
各国在这一领域展开了激烈的竞争,许多著名高等学府如加州大学等都在嵌入式
操作系统的研究上投入了大量的人力物力。
§1.1 课题研究的目的和意义
嵌入式系统是以应用为中心,以计算机技术为基础,并且软硬件可裁剪,适
用于应用系统对功能、可靠性、成本、体积、功耗有严格要求的专用计算机系统。
它一般由嵌入式微处理器、外围硬件设备、嵌入式操作系统以及用户的应用程序
等四个部分组成,用于实现对其他设备的控制、监视或管理等功能[3]
嵌入式系统没有统一的架构,软硬件的组合多样,技术密集,市场容量大,
有较大的创新空间。但由于在大多数应用场合对设备本身的体积有所限制,硬件
资源部可能像主机系统那样丰富,所以系统内核既要精简,又要保证功能完成的
实时性和稳定性[4]因此,设计和实现高效可靠的内核管理模块,如内存管理,
任务环境管理等是保证嵌入式操作系统快速发展的关键技术之一。
作为嵌入式系统(包括硬、软件系统)极为重要的组成部分的嵌入式操作系
统,在目前的嵌入式应用中用得越来越广泛,尤其在功能复杂、系统庞大的应用
中显得愈来愈重要,而且嵌入式操作系统大部分是嵌入式实时操作系统。
摘要:

摘要在以计算机技术、通讯技术相结合的信息时代的快速发展和互联网的广泛应用的形势下,随着后PC时代的到来,3C(Computer、Communication、Consumer)合一的趋势已经形成。在自动控制领域内,嵌入式软件必然成为重要成员,嵌入式操作系统也将成为软件业的热点。嵌入式操作系统是嵌入式系统发展到一定阶段的产物,是为了满足日益复杂的嵌入式系统设计的要求而产生的。随着微处理器功能的不断提升,嵌入式操作系统的应用范围也变得越来越强大。对基于特定嵌入式操作系统上的软件设计研究已成为了近年来的热点,并且对于嵌入式操作系统在实际工程中的推广应用有着重要的意义。本文首先介绍了嵌入式操作系统的产生...

展开>> 收起<<
嵌入式操作系统 内存管理机制及改进.pdf

共66页,预览7页

还剩页未读, 继续阅读

作者:陈辉 分类:高等教育资料 价格:15积分 属性:66 页 大小:1.1MB 格式:PDF 时间:2024-11-19

开通VIP享超值会员特权

  • 多端同步记录
  • 高速下载文档
  • 免费文档工具
  • 分享文档赚钱
  • 每日登录抽奖
  • 优质衍生服务
/ 66
客服
关注