Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating Systems Chapter 7 天津大学软件学院. 计算机导论 A computer is a system made of two major components: hardware and software. Computer hardware is the physical.

Similar presentations


Presentation on theme: "Operating Systems Chapter 7 天津大学软件学院. 计算机导论 A computer is a system made of two major components: hardware and software. Computer hardware is the physical."— Presentation transcript:

1 Operating Systems Chapter 7 天津大学软件学院

2 计算机导论 A computer is a system made of two major components: hardware and software. Computer hardware is the physical equipment. Software is the collection of programs that allows the hardware to do its job. Computer software is divided into two broad categories: the operating system and application programs.

3 计算机导论 Application Software (应用软件) : programs for performing tasks particular to the machine’s utilization System Software (系统软件) : performs those tasks that are common to computer system in general system software provides the environment in which the application software resides (为应用软件提供运行环境) utility software: consists of software units that extend the capabilities of the operating system (扩展操作系统的功能)

4 计算机导论

5 操作系统能干什么 —1 例 : 在计算机上看 DVD 1. 将影碟放入 DVD 驱动器 2. 执行 DVD 播放软件 – 操作系统从磁盘某个目录将播放程序调入内存 – 操作系统创建一个进程, 执行该播放程序 3. DVD 播放软件读取 DVD 驱动器中的内容 4. 将数据送到屏幕和声卡的驱动程序 5. 用户享受 DVD

6 计算机导论 操作系统能干什么 —2 DVD 驱动器 = ⇒ I/O 设备管理 执行 DVD 播放软件 – 磁盘上的播放程序 : = ⇒ 文件系统 – 创建播放进程 : = ⇒ 进程管理、内存管理 驱动屏幕和声卡 : = ⇒ I/O 设备管理 用户用鼠标进行操作 : = ⇒ 人机接口

7 计算机导论 7.1 DEFINITION An operating system is so complex that is difficult to give a simple universal definition. Instead, here is some common definition:  An operating system is an interfacebetween the hard- ware of a computer and the user (program or humans). (人机之间的接口)  An operating system is a program (or a set of program) that facilitates the execution of other programs (使其它程序执 行更有效的程序).  An operating system acts as a general manager supervising the activity of each component in the computer system (管理计算机系统中每个部件的活动).

8 计算机导论 Two major design goals of an operating system are 1. Efficient use of hardware (有效地使用硬件). 2. Easy to use resources (容易的使用资源).

9 计算机导论 7.3 COMPONENTS A modern operating system has at least four duties: memory manager, process manager, device manager and file manager. The user interface is responsible for communication outside the operating system (like a public relations department). memory manager :内存管理 process manager :进程管理 device manager :设备管理 file manager :文件管理 user interface :用户界面

10 计算机导论 DEVICE MANAGER

11 计算机导论 USER INTERFACE

12 计算机导论 Getting it Started The booting process

13 计算机导论 涉及到的课程: 必修课:操作系统原理, UNIX/LINUX 操作系统 选修课:嵌入式操作系统

14 Programming Languages Chapter 9 天津大学软件学院

15 计算机导论 9.1 EVOLUTION To write a program for a computer, you must use a computer language. A computer language is a set of predefined words that are combined into a program according to predefined rules (syntax) Over the years, computer languages have evolved from machine language to natural languages. A time line for computer languages is presented in Figure 9.1.

16 计算机导论 00000000000001000000000000000000 0101111000001100110000100000000000000010 11101111000101100000000000000101 11101111100111100000000000001011 1111100010101101 110111110000000000010010 01100010110111110000000000010101 1110111100000010111110110000000000010111 1111010010101101110111110000000000011110 0000001110100010110111110000000000100001 1110111100000010111110110000000000100100 011111101111010010101101 1111100010101110110001010000000000101011 0000011010100010111110110000000000110001 1110111100000010111110110000000000110100 000001000000000000111101 Program in machine language 12345678910111213141516 The only language understood by a computer is machine language.

17 计算机导论 DSEGSEGMENT PARA 'Data' dw ? arraydw 3,5,13h,23h,37h,49h,52h,65h,78h,99h,105h countequ $-array_head ndw 32h DSEG ENDS CSEG SEGMENT PARA 'Code' assume cs:CSEG, ds:DSEG,ss:SSEG MAIN: mov ax,dseg mov ds,ax mov es,ax mov ax,n mov si,0 mov cx,count repeat:mov bx,array[si] cmp bx,ax jae insert;n 较小,则转插入操作 mov array[si-2],bx ; 数组元素前移 1 字单元 inc si loop repeat insert:mov array[si-2],ax ; 将 n 加入到数组中 mov ax,4C00H int 21h CSEG ENDS END MAIN ;set entry point12345678910111213141516 Program in symbolic language

18 计算机导论 /* This program reads two integer numbers from the keyboard and prints their product. */ #include int main (void) { // Local Declarations int number1; int number2; int result; // Statements cin >> number1; cin >> number2; result = number1 * number2; cout << result; return 0; }// main Program in C++ language 123456789101112131415161718

19 计算机导论 9.2 BUILDING A PROGRAM There are three steps in this process: 1.Writing and editing the program (source program) 2. Compiling the program (object program) (translation) 3. Linking the program with the required library modules

20 计算机导论 The translation process 相关的课程: 编译技术(选修) 编译原理

21 计算机导论 9.3 PROGRAM EXECUTION To execute your program you use an operating system command to load your program into primary memory and execute it. Getting the program into memory is the function of an operating system program known as the loader. It locates the executable program and reads it into memory. When everything is ready, control is given to the program, and it begins execution.

22 计算机导论 9.4 CATEGORIES OF LANGUAGES Today, computer languages are categorized according to the approach they use in solving a problem and the category of problems they solve. ( 根据解决问题的方法和解决问题的种类 ) We divide computer languages into five categories : procedural (imperative) languages (过程化), object-oriented languages (面向对象), functional languages (函数型), declarative languages (说明性), and special languages (专用).

23 计算机导论 PROCEDURAL (IMPERATIVE) LANGUAGES FORTRAN ( FORmula TRANslation ) COBOL (COmmon Business-Oriented Language) Pascal (structured programming approach) C

24 计算机导论 OBJECT-ORIENTED LANGUAGS In object-oriented programming, the objects and the operations to be applied to them are tied together. C++ Java

25 计算机导论 FUNCTIONAL LANGUAGES LISP (LISt Programming) Scheme DECLARATIVE (LOGIC) LANGUAGES A declarative language uses the principle of logical reasoning to answer queries. Prolog ( PROgramming in LOGic)

26 计算机导论 SPECIAL LANGUAGES HTML (超文本链接标示语言) HTML (Hypertext Markup Language) : An HTML file is made of text and tags. A tag is enclosed in two angle brackets and usually comes in pairs. An HTML file (page) is stored on the sever and can be downloaded by a browser. SQL (Structured Query Language ,结构化查询语言 )

27 计算机导论 相关课程 必修: –C/C++ 程序设计 – 汇编语言程序设计 选修: –C# 程序设计语言 –Java 语言程序设计

28 计算机导论 作业 7-21——7-28 7-37——7-40 7-46 9-31——9-35 9-38 , 9-39 9-41 , 9-42 , 9-43 , 9-469-55

29 计算机导论  An operating system facilitates the execution of other software, acts as the general manager of a computer system, and ensures the efficient use of hardware and software resources.  The evolution of operating systems has included batch operating system, time-sharing system, singer-user operating system, parallel system and distributed systems.  The operating system oversees the memory manager, the process manager, the device manager, the file manager, and the user interface.  In monoprogramming, most of memory capacity is dedicated to one single program.  In multiprogramming, more than one program is in memory at the same time. SUMMARY

30 计算机导论  In partitioning, memory is divided into variable length sections, each of which holds one program.  In paging, memory is divided into equally sized sections called frames and the program is divided into equally sized sections called pages. Pages of program need not be contiguous, but all pages must be present in memory for execution.  Demand paging is similar to paging except that all pages need not be in memory.  Demand segmentation is similar to paging except that, instead of equally sized sections, the program is divided to match the program divisions.  Demand paging and demand segmentation can be combined to further improve the efficiency of a computer system. SUMMARY (continued)

31 计算机导论  The sum of the size of all the programs in memory is virtual memory.  A program is a nonactive set of instructions written by a programmer and stored on disk or tape.  A job is a program that is selected for execution.  A process is a job residing in memory.  A state diagram shows the relationship between a program, job, and process. A job can be in the hold, terminated, read, running, or waiting state. A process can be in one of the latter three states.  The job scheduler creates a process from a job and changes a process back to a job.  The process scheduler moves a process from one state to another. SUMMARY (continued)

32 计算机导论  Jobs and processes wait in queues.  Deadlock is a situation in which a process is unable to execute due to unrestricted use of resources by other processes.  Starvation is a situation in which a process is unable to execute due to too many restrictions on resources.  The device manager controls access to I/O devices.  The file manager controls access to files.  The user interface is software that accepts requests from processes and interprets them for the rest of the operating system.  Windows 2000, UNIX, and Linux are three popular operating systems. SUMMARY (continued)

33 计算机导论  The only language understood by a computer is machine language  A symbolic language uses symbols to represent various machine language instructions. Symbolic languages are also called assembly languages.  A high-level language is portable from one computer type to another and frees the programmer from hardware concerns. BASIC, Pascal, Ada, C, C++, and Java are high- level languages.  The steps to building a program include writing, editing, compiling, and linking code.  There are five categories of computer languages: procedural, object-oriented, functional, declarative, and special. SUMMARY

34 计算机导论  In a procedural language, an algorithm is translated into code. The code manipulates data and controls the execution of instructions. FORTRAN, COBOL, Pascal, C, and Ada are all procedural languages.  In an object-oriented language such as C++ and Java, the objects and the operations applied to the objects are tied together.  C++ uses the concepts of encapsulation, inheritance, and polymorphism.  In a functional language, the algorithm is mathematical in nature. LISP and Scheme are functional languages.  A declarative language uses the principles of logical reasoning. Prolog is a declarative language. SUMMARY (continued)

35 计算机导论  A special language cannot be categorized into one of the other four groups. HTML, PERL, and SQL are special languages.  C is considered the mother of languages such as C++, Java, and PERL. SUMMARY (continued)


Download ppt "Operating Systems Chapter 7 天津大学软件学院. 计算机导论 A computer is a system made of two major components: hardware and software. Computer hardware is the physical."

Similar presentations


Ads by Google