I摘要作为学习操作系统的新手,商用的操作系统设计复杂,代码量大,不适合作为学习的蓝本,如果能够从零开始开发一个小型的操作系统雏形,不但可以全面深入地了解操作系统的工作原理,还可以为读大型开源操作系统的代码积累经验。这个取名为MyOS的从头开始开发的系统虽然结构简单,但是具备了内存管理、多任务控制、任务切换、基本输入输出管理并且运行在32位保护模式下,在用户接口方面,它采用的是图形界面和命令行界面混合的方式来与用户交互,在程序接口方面,设计了部分API,主要是针对于图形显示和计时器两方面,本文利用这些API,实现了“贪吃蛇”、“时钟计时器”两个例子程序。本文首先介绍操作系统运行所依赖的硬件系统组成,然后重点地介绍了操作系统的基本特征和主要功能,接着详细地说明了80386以上IntelCPU所运行的贯穿整个操作系统开发的32位保护模式,接下来简述了MyOS的开发环境和语言,以及MyOS的基本运行原理,然后重点介绍了MyOS的设计与实现,最后叙述MyOS的程序接口API,以及利用MyOS中的API设计的应用程序。关键词:操作系统,运行原理,32保护模式IIABSTRACTAsafreshmanwhowanttolearnOperatingSystemdeeply,commercialusingOSaretoocomplextolearn.So,ifwedevelopademoofOSfromblank,ifwestartfromscratch,wecannotonlyhaveagoodknowfortherunningprincipleofaOS,butalsoaccumulatemanyexperiencewhichareofsignificantimportancetoourfurtherstudyandresearchfortheoperatingsystem.ThisthesisisaboutaOperatingSystemwhichisdevelopedfromtheblank,andits’nameisMyOS.ThisMyOSissimpleinstructure,however,itpossessesthemanagementofmemeryandtaskandbasicinputandout,itsupportthemultitaskandrununderthe32bitprotectmode.Inaddition,itusingbothgraphicalinterfacesandcommandlineinterfacestointeractwithuser.AsfortheAPI,theMyOSgetsomeAPIforthegraphicaldisplayandtimer,bywhichwedevelopsomeprogramwhichmayrunontheMyOS.Thisthesisarecomposedbytheseelements.Firstofall,itdescribethehardwarewhichOperatingSystemrunon,andthen,itpresentthefundamentalcharacterandmainfunctionoftheOperatingSystem.Secondly,itilluminatestheprotectmodewhichisoneofthetwoimportantelementsofthethesis,andtheotheroneisparticularizethedesignandrealizationoftheMyOS,beforewhich,itwillbrieflytellyouthedevelopingcircumstanceandthedevelopinglanguage.Atlast,itdealswiththeAPIofMyOSandtheprogramdevelopedbasedontheseAPIs.Keywords:OperatingSystem,PrincipleofRunning,32bitProtectMode1目录摘要..........................................................................................................................................IABSTRACT...................................................................................................................................II第1章绪论.................................................................................................................................11.1选题背景和意义.............................................................................................................11.2国内外研究现状.............................................................................................................21.3主要研究内容.................................................................................................................3第2章操作系统运行环境及运行原理简述.............................................................................42.1计算机系统硬件组成简述.............................................................................................42.1.1总线.......................................................................................................................42.1.2I/O设备.................................................................................................................42.1.3主存.......................................................................................................................52.1.4处理器...................................................................................................................52.2操作系统的基本特性.....................................................................................................52.2.1并发性......................................................................................................................62.2.2共享性......................................................................................................................62.2.3虚拟性......................................................................................................................62.2.4异步性......................................................................................................................72.3操作系统的主要功能.....................................................................................................72.3.1处理机管理...........................................................................................................72.3.2存储器管理...........................................................................................................72.3.3设备管理...............................................................................................................82.3.4文件管理...............................................................................................................82.3.5用户接口...............................................................................................................92.3.6程序接口...............................................................................................................9第3章32位保护模式介绍......................................................................................................113.132位保护模式简述......................................................................................................113.1.1存储管理机制和地址转换机制简介...............................................................