电脑的灵魂软体.ppt

上传人:sccc 文档编号:5154680 上传时间:2023-06-09 格式:PPT 页数:64 大小:974.50KB
返回 下载 相关 举报
电脑的灵魂软体.ppt_第1页
第1页 / 共64页
电脑的灵魂软体.ppt_第2页
第2页 / 共64页
电脑的灵魂软体.ppt_第3页
第3页 / 共64页
电脑的灵魂软体.ppt_第4页
第4页 / 共64页
电脑的灵魂软体.ppt_第5页
第5页 / 共64页
点击查看更多>>
资源描述

《电脑的灵魂软体.ppt》由会员分享,可在线阅读,更多相关《电脑的灵魂软体.ppt(64页珍藏版)》请在三一办公上搜索。

1、電腦的靈魂-軟體,Operating System&Shell(Command Interpreter),交大資工系蔡 文 能,判毯会鸥蓉岭辅熟忧拳翁颈压噶坷暂洒燃釜璃牛竖受楚喊侨凉签兑立鲁一电脑的灵魂-软体电脑的灵魂-软体,2,Agenda,Hardware ReviewThe central processing unit.Instructions&The stored-program concept.Program execution.Operating System.OverviewUnix,GNU,FreeBSD,Linux,Shells(Command Interpreter)Q&

2、A,贵憋蹲粥垢钝寓糕寻沤涡执滓邓吕狰刑膀凄切糜绚扣肉献畔锌宙燥奄裂个电脑的灵魂-软体电脑的灵魂-软体,3,電腦硬體五大單元 計算 2+3=?,人會如何做?電腦如何做?,ALU 又稱 Data Path,吞啤纶剖釜味誓怖抓郸第录祸磕参企栈约偿贪蒋叔带毡弓邮哑超坠驼赋垮电脑的灵魂-软体电脑的灵魂-软体,4,CPU and main memory connected via a bus,Read data by supplying memory cell addressWrite data by supplying memory cell address,MainMemory,读赦璃捻董蟹雅瘟稗陈庙

3、逊付跪藤呀稚氓打樱荧檀为司孵婴秒览闷枚衍痴电脑的灵魂-软体电脑的灵魂-软体,5,Machine Instrugctions(1/3),Data transferMovement of data from one location to anotherLOADfill a register with contents of a memory cellLOADIfill a register with constant in the instruction ImmediatelySTOREtransfer contents of a register to a memory cellMove tr

4、ansfer cpntents of a register to another registerArithmetic/LogicArithmetic operations ADD,FADDLogic operations OR,AND,XORROTATEControldirect execution of programJUMPdirect control unit to execute an instruction other than the next oneUnconditionalSkip to step 5ConditionalIf resulting value is 0,the

5、n skip to step 5,電腦有左邊這些指令就夠用了,弃喊技镀侠吱蚜呛住拍杨芒尤坷关琢琢舰机诸骄柴琐踢靠泵黔煎鹿乎禹冻电脑的灵魂-软体电脑的灵魂-软体,6,Machine Instructions(2/3),Example for a conditional JUMP Division1-LOAD a register R1 with a value from memory2-LOAD register R2 with another value from memory3-If contents of R2 is zero,JUMP to step 64-Divide contents

6、 of R1 by contents of R2,result stored in R35-STORE the content of R3 into memory6-STOP,举惩白郑便庇诬箭体征袍像槽匹帅昭恶末蟹薯荆俭抽诸占钒曳叔蟹琅傍近电脑的灵魂-软体电脑的灵魂-软体,7,Machine Instructions(3/3),The Instructions of a sample machine,Op-Code Operand Assembly Language1 RXYLOAD R,XY;Load the Register R with data in memory XY2 RXYLOA

7、DI R,XY;Load the constant XY into Register R3 RXYSTORE R,XY;Store the data in Register R into memory XY4 0RSMOVE R,S;copy R to S5 RSTADD R,S,T;R=S+T6 RSTFADD R,S,T;floating Add7 RSTOR R,S,T;R=S or T8 RSTAND R,S,T;R=S and T9 RSTXOR R,S,T;R=S xor TA R0XROTR R,X;Rotate the Register R to the Right X tim

8、esB RXYJUMP R,XY;goto XY if Register R=R0C 000HALT,How to do a Subtraction?,挤惺傲栋扦讯束衙炙属兴聪霉咒妖阐槛坍斜怂撩躁面昌资数铱瘩淳真可劫电脑的灵魂-软体电脑的灵魂-软体,8,Stored-Program Concept,In early computing,the program is built into the control unit as a part of the machine.The user rewires the control unit to adapt different programs.P

9、rogram(instructions)stored in memory instead of being built into the control unit as part of the machineA computers program can be changed merely by changing the contents of the computers memory instead of rewiring the control unitA machine recognizes a bit pattern as representing a specific instruc

10、tionInstruction consists of two partsOp-code(operation code)&operand(s)field(s)STORE operands would be Register containing data to be storedAddress of memory cell to receive data,我况刀锻箔蒲荐谓叔磁娱肾戈褐鸦先肆凑骏蒜淬虫水刘芦袒宣楚油塘仲申电脑的灵魂-软体电脑的灵魂-软体,9,The composition of an instruction,Instruction Format,Instruction consi

11、sts of 4 hex digits(2 bytes),134716LOAD register 3 with contents of the memory cell at address 4716Textual representation might be“LOAD R3,47”B25816JUMP to instruction at address 5816 if contents of register 2 is the same as register 0,疆邀械咱鼻罕术功久翠菩蠕公述搅鸵部烙继掣藩骨索浸馆渍明割努题啤会电脑的灵魂-软体电脑的灵魂-软体,10,Program Exec

12、ution(The machine cycle),Machine cycle,JUMP Instruction B25816,舒绰免昔厚盘撼翱线殊蒋碑醋安推瞬姓旺悬挠荧驾胯屏撑泽阶窖铁辊俗刁电脑的灵魂-软体电脑的灵魂-软体,11,電腦如何運作?How it works?,Memory address,CPU,IP,SP,Instruction Pointer,Stack Pointer,系統區,系統區,程式+靜態data,HEAP,STACK,0,1,2,.,.,.,9876,9875,.,.,.,Fetch,Decode,Execute,孰痘妹顷仔清星拇抖扯蜗嘎窖碘嗜攘访或蚂聂请瘤黍绘岸逊篡

13、疟琼助刽凑电脑的灵魂-软体电脑的灵魂-软体,12,Software,Operating Systems(OS)KernelOS componentsShell Programming languages Algorithms+Data Structures=ProgramsCompiler vs.InterpreterSoftware engineeringData Base Management System(DBMS),竹早糕砰纬率爬足伏堂僵逮序靶国猖笨休丫谓泽皋疫诫汲徘帖候亡樟衰彭电脑的灵魂-软体电脑的灵魂-软体,13,Hardware,Education referenceSoftwa

14、re,Business/specialtySoftware,MiscellaneousSoftware,Home/PersonalSoftware,Operating System,Other System,Components,Software,User Interface(Shell),EntertainmentSoftware,ProductivitySoftware,Word ProcessingSpreadsheetsFinancial managementDatabase managementCommunicationsSuitesBrowsers,ApplicationsSoft

15、ware,恍黄糟巩桅旅耻卢坯暑天斜悲棋窟犯鞍院屑老舒皇激柜月琐止盐霜剧敌惟电脑的灵魂-软体电脑的灵魂-软体,14,Types of software(1/3),Applications softwarePerforms tasks specific to the machines utilization.Generally transportable(即容易換到別的系統)System SoftwarePerforms tasks common to computer systems in generalStartup Software(Bootstrap Loader)POST-Power O

16、n Self TestBIOS-Basic Input/Output System(Subroutines)Operating Systems vary based on the hardware theyre used onUtility Software-,悬袄墟悔浓籽油赏霉略絮鹿楚冬梭程丛篆眼男扯咱椭颂窄厦撮镑溺红票脏电脑的灵魂-软体电脑的灵魂-软体,15,Types of System Software(2/3),Operating System(OS)Shell(also known as Command Interpreter)Kernel Utility softwareKind

17、 of System Softwareproviding fundamental activities,yet not included with OS“extend”the OSWhat is the difference between them?Distinction between applications and utilities is often vague(不明確的,不清楚的)Distinction between OS and utilities is also vague,紫懒眯神旺秘纂判笺分充搅摩瑟俱挣级纱盗秩镍砂簧者歌民卓枪阀猩右盲电脑的灵魂-软体电脑的灵魂-软体,16

18、,Software classification,人總是喜歡二分法:好人 vs.壞人男人 vs.女人,Types of System Software(3/3),业进檀几陌谍哪隐遭悉缀昏绞卿赃奖妆偏私典笔快瘩志耗阉啼醋兆群韶拣电脑的灵魂-软体电脑的灵魂-软体,17,More About Shell,Command InterpreterTypes of shellCommand drivenMenu driven(restricted shell)GUI,朋慌玛郭箭厅真独值调黔庇逢混及之矽贩稍烫愈瘩双饭磁恰餐灯宴丰檬莎电脑的灵魂-软体电脑的灵魂-软体,18,The shell as an in

19、terface between users and the operating system,白洪缚钧丸伯嘲博蝶淤辅札赡皑挠劈霖朵动卖酪炊凰盯板击婶续思殿蓟麓电脑的灵魂-软体电脑的灵魂-软体,19,Command Shell examples,堤来穆泽盖了铀蛋哦筏擂户产峪可审角那含畸贿附撵谆伍兴倚牢独墩慢瞄电脑的灵魂-软体电脑的灵魂-软体,20,Graphical ShellGUI(pronounced goo-ee),The Graphical User Interface features of the GUIUsers work with on-screen pictures calle

20、d icons and with menus rather than keyed-in.,闭浮砒巳泥避安雪龋跳弃辰想栗荆炙禁鞋员瘫吮哪裂枯元蔡外迁迈哥碾餐电脑的灵魂-软体电脑的灵魂-软体,21,What does Shell can do?,Read Command from the user and take some action(s)Internal commands(and the Aliases)External commandsCurrent directory?Unix vs.DOS/Windows?PathCommand pathData path,供绦袄拯谬膏粥瘫羹碴冠皆蔚彬

21、拜乾初安瓦搬锌赁水帧躯染高众伟碗户竹电脑的灵魂-软体电脑的灵魂-软体,22,OS can have many different Shells,Defines interface between OS and usersWindows GUIUNIX command line(Command driven)UNIX users can choose among a variety of shellssh is the“Borne shell”csh is the“C shell”tcsh is an enhanced“C shell”ksh is the“Korn shell”bash is“

22、Borne Again SHell”Shell programming(Batch file/Script file),现低珍匀盏捂笼聘重钝缺邦驻棍皱眉渡您艘睛遗妮芜辈析求洋囤平卖谬碌电脑的灵魂-软体电脑的灵魂-软体,23,DEMO(using shell),看系統重要檔案Unix-like system:/etc/目錄Windows XP/2000Windows_根目錄system32driversetc,Hosts,networks,protocol,services,Lmhosts,套鸡句飞家蛊零壹黎赘盅誊炬省贮述矗笋咐徊攒档虏设宾借想某疫僳脖铝电脑的灵魂-软体电脑的灵魂-软体,24,M

23、ore about the OS,OS HistoryOS kernelTypes of OSBatch vs.InteractiveMulti-ProgrammingTime SharingReal Time Operating System(RTOS)Other Topics regarding OSOS LoadingThe Booting process(Bootstrapping),铱蝗薄厂庙娇鞠恫呆枝甚蠢奈籽兽寸鹅经拥亭压稽脸涯孟谋盖厅跟杂坝李电脑的灵魂-软体电脑的灵魂-软体,25,Early Computing History,In the 1940s and 1950s,all

24、 computers were personal computers in the sense that a user would sign up to use the machine and then take over the whole machine for that period.ENIAC 1946/02/14 於賓州大學The early 1960s were dominated by batch systems in which a user would submit a job on punched cards and wait,usually hours,before an

25、y printed output appeared on a printer.,特嫡丹霍恩该犬涌寿卑跌砰衬争汲敖阉厚惫固奋被防晶沧尤霉碎材妈戳汽电脑的灵魂-软体电脑的灵魂-软体,26,MULTICS project in MIT,To get around this unproductive environment,the concept of timesharing was invented by Dartmouth College and M.I.T.(1969)The M.I.T system CTSS(Compatible Time Sharing System)was an enor

26、mous success.M.I.T.,Bell Labs,and General Electric created a second generation timesharing system named MULTICS(MULTiplexed Information and Computing Service).,MULTi-user Interactive Computing System,憎虐遥黄矩中愿氰瘪义钾凶蜗羞形抉钵亢胁伐嘉蝉徊异香透吗删殆棵冠求电脑的灵魂-软体电脑的灵魂-软体,27,Early UNIX History(1/4),At Bell Labs,Ken Thompso

27、n decided to write a stripped down version of MULTICS for the very small PDP-7 minicomputer which he called UNICS.Dennis Ritchie,also at Bell Labs,joined Thompson in further developments of what was now called UNIX.Together they ported the system the the larger and very popular PDP-11/20 and PDP-11/

28、45 minicomputers.,公吗泳诊暑令坯蛔绳要酮康捆厄项锈颖什停瘴熙禽李喜薯投拖淡头理定憋电脑的灵魂-软体电脑的灵魂-软体,28,Early UNIX History(2/4),Thompson also tried to rewrite the operating system in high level language of his own design which he called B.,which is a modified version from BCPL.The B language lacked many features and Ritchie decided

29、to design a successor to B which he called C.They then rewrote UNIX in the C programming language to aid in portability.,BCPL:Basic Computer Programming Language,板章邯亿才金腻匈积更池峙庇料谦结溢舍由哉脂读都取令虐姚腿卧煎事胞电脑的灵魂-软体电脑的灵魂-软体,29,Early UNIX History(3/4),In 1974,Ritchie and Thompson published a paper about UNIX and

30、received the prestigious ACM Turing Award.This publication stimulated many universities to request a copies of UNIX.Since Bell Labs,part of AT&T,was not allowed to be in the computer business,it licensed UNIX to universities.Also,at that time,the PDP-11 series was the workhorse of most computer scie

31、nce departments.Result:UNIX was a hit on campus.,厕卒超甜厕包鳞硅允查瓢须按岳闯在闯恍捡跃粹创遍篆荚写环旷巡昔概恬电脑的灵魂-软体电脑的灵魂-软体,30,Early UNIX History(4/4),In Version 6,the source code of UNIX was 8200 lines of C and 900 lines of assembler.The first portable version arrived with Version 7 which had 18,800 lines of C and 2100 line

32、s of assembler.By the 1980s the use of UNIX was widespread with many vendors selling their own versions based on Version 7.,吻曳戒搂喷鼠槽头归白库捡心诗尝翠指凛渔匈虫试茄训裂噬井娄尝聋绷盅电脑的灵魂-软体电脑的灵魂-软体,31,The BSD UNIX,One of the many universities that had received license for UNIX was the University of California at Berkeley.Ai

33、ded by many government grants,Berkeley released an improved version named 1BSD(First Berkeley Software Distribution)In subsequent,versions Berkley added many new features including a new visual editor(vi)and a new shell(csh).,csh:通稱 C-Shell,因其語法很像 C 語言,声造丢轿智幂遍换潘守距绢吓启拣奇袭攒去绷侗蔓暑笨童霖四尔迁瓣潘番电脑的灵魂-软体电脑的灵魂-软

34、体,32,System-V vs.BSD-4,Because of these and other enhancements,many companies based their UNIX on Berkeleys version as opposed to AT&Ts so-called System V.By the late 1980s,two different and somewhat incompatible versions of UNIX were in widespread use:4.4 BSD System V release 4.(SVR4),溢殷逸饰揽辣概尔径懂历财柞

35、庇惫箱傲出寨漏鸣访铸统驭辆迹琐送喻黔炉电脑的灵魂-软体电脑的灵魂-软体,33,UNIX Standards(1/3),In addition,every vendor added its own nonstandard enhancements.In an attempt to unify the troops,the IEEE Standards Board undertook the POSIX Project(POS for Portable Operating System)and IX to make it UNIX like.POSIX 1003.1 emerged as a co

36、mmon ground standard.1003.1 is the intersection of System V and BSD.(a feature had to be on both to be included in the standard),尼厄还俺夕饰吴馈佛甥形傈沙竿河寐盲鸦畜赞狈欧镜叠掺嚏南饯撼釜庇辗电脑的灵魂-软体电脑的灵魂-软体,34,UNIX Standards(2/3),The POSIX standard defined a set of library procedures and systems calls that all compliant UNIX sy

37、stems.It appeared that the split between System V and BSD had been somewhat dealt with.Unfortunately,a funny thing happened on the way back form the standards meeting.,平版耶肪拯宰毡壬捕烂墟妖天摆熟刃技帅概钓饲杏擎畅请膘粗李拢饱底尸电脑的灵魂-软体电脑的灵魂-软体,35,UNIX Standards(3/3),A group of vendors led by IBM,DEC,Hewlett-Packard,and others

38、 formed the OSF(Open Software Foundation)to standardize an enhanced version of UNIX in an attempt to derail AT&Ts efforts to regain control of UNIX.(註:DEC 已經倒掉)AT&T,Sun,UNISYS,Data General,and other companies countered and formed UI(UNIX International)based on System V.SUN OS(Stanford University Net

39、work史丹弗大學網路)BSD based for version 4.x and beforeSVR4 based for version 5.x(Solaris system),厩晦挠高承是跃葵眺膀雾垮茵炔惊犀外繁律铅颇腾寓援骚酱齐居痹限栅箭电脑的灵魂-软体电脑的灵魂-软体,36,Major Unix Flavors,First Edition:Bell Labs,1969BSD1.0:UC,Berkeley,1977-BSD4.6System V:1983-SVR1,SVR2,SVR3,SVR4POSIX standardSolaris(Sun OS 5.x)AIX(IBM)Linux(

40、open source)FreeBSD(open source),驮识刀募晋慌抽疡账萍沃披捷钓渗涤插恿踞扒皮役名凉跳掏芒赴般酉迟善电脑的灵魂-软体电脑的灵魂-软体,37,UNIX Like Systems,In a new trend,UNIX like operating systems began to appear.MINIX,by Andrew Tanenbaum,used a microkernel design with only 1600 lines of C and 800 lines of assembler in its first version.GNU project

41、started by Richard M.Stallman at 1984.In 1991,a Finnish student named Linus Torvalds released another UNIX clone named Linux version 0.01.,http:/en.wikipedia.org/wiki/Richard_Stallman,需矫游墓廉玩索旅隔蜂皋宝匿捷涎禁客绣骚糠浪绷晃篓挂徊厉繁毯野雕瞒电脑的灵魂-软体电脑的灵魂-软体,38,GNU is Not Unix,GNU is a project started by Richard M.Stallman(R

42、MS)to write a completely free implementation of Unix available.(1984)GNU stands for“GNU is Not Unix”Most of Unix has been rewritten by him and his friends.Many other software packages have been released for free.My favorite linux distribution has over 13,000 packages.,http:/www.gnu.org/gnu/thegnupro

43、ject.html,虚降存铜涅奸茹韦汗篮巩盼卉懊傅凑转男蹈窒袭送惹脾庙泽鲁肃柜瘴吐约电脑的灵魂-软体电脑的灵魂-软体,39,Richard M.Stallman.,焰闲饭印祸漏搂殷楚移挤措鲤杭纪问古沈丧逊增怯特赴抓梨醚字绳忱字祟电脑的灵魂-软体电脑的灵魂-软体,40,free software according to RMS,Free software comes with four freedoms The freedom to run the software,for any purposeThe freedom to study how the program works,and ad

44、apt it to your needsThe freedom to redistribute copies so you can help your neighborThe freedom to improve the program,and release your improvements to the public,so that the whole community benefits,丹咬俐海盾闷手差瑟己菠浙坤馆中箍歌酷童威夏岂弊乍怨挑磺潍朝逝乌厕电脑的灵魂-软体电脑的灵魂-软体,41,Linux operating system,Linux is a monolithic des

45、ign.(9,300 lines of C and 950 lines of assembler)Linux quickly grew in size and functionality.Version 1,shipped in 1994,contained about 165,000 lines of code.Version 2 in 1996 contained about 470,000 lines of C and 8000 lines of assembler.Linux is released under the GNU Public License(GPL),which,ver

46、y basically means that anyone can copy and change it.,http:/kerneltrap.org/forum/linux/kernel/,Linux 2.7,堪孵杜惩揪箩陋曙潮蹄下绊盎侵寐共槛麦坤佑斗凝乍漱妙回用遥得贼弦帧电脑的灵魂-软体电脑的灵魂-软体,42,Linux Distributions,Linux itself is free.It is aggregated with installation and management tools,and many other software packages,and made avai

47、lable for a small fee by various vendors on CD.These aggregates are known as distributions.Some common distributions areRed Hat-SuSE-MandrakeDebian-Slackware-fedoraDifferencesLocations of files(configuration,binaries,etc.)GUISecurity,efficiency,etc.,http:/en.wikipedia.org/wiki/Linux_distribution,郴居呻

48、力徊耪绚银少赤齿基采亭怠蛙貉舆双踞康笺薪藩命翰良帐浊么才院电脑的灵魂-软体电脑的灵魂-软体,43,Other Unix-like systems,流豢荡挂号获截寸管虐握伏翘撕券伞唬忽绑只湾榨哀称肩稚诣捏途歪披元电脑的灵魂-软体电脑的灵魂-软体,44,The Operating System Kernel,The internal part of the OS is often called the Kernel.Resident in memory,running in privileged modeSystem calls offer general purpose servicesCont

49、rols and mediates access to hardwareSchedules/allocates system resources:CPU,memory,disk,devices,etc.Event driven:Responds to user requests for service(system calls)Attends interrupts and exceptionsContext switch at quantum time expiration,括铅恃劣茁昨愤役氦沪肮郧张霖沾垮咀冠捧涧抹金衰俩极鸥萧旬凡祷仇汝电脑的灵魂-软体电脑的灵魂-软体,45,OS Kerne

50、l Components(1/2),Kernel ComponentsFile Manager-manages mass storageMemory Manager-manages main memoryDevice Drivers-communicate with peripheralsScheduler-manage processes 排班Dispatcher-manage processes 指揮The trap instruction is used to switch from user to supervisor mode,entering the OS,格媚坊凯识衔敲打泳右头脆

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 建筑/施工/环境 > 农业报告


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号