1、LessonInterfacesInterfaces121.What is API?2.What is the user interface?Warm-up Exercises Warm-up Exercises application program interface应用程序接口user interface 用户界面keep track of 记录specify 详细说明make file 生成文件random access 随机存取disk drive 磁盘驱动器Word Word PreparationPreparationfree storage 空闲记忆区archive 存档res
2、ponse codes 响应码tape drive 磁带驱动器graphical user interface图形用户界面shell 外壳程序Word PreparationWord PreparationThe interfaces to the world include the application program interface and the user interface.Application Program InterfaceJust as drivers provide a way for applications to make use of hardware subs
3、ystems without having to know every detail of the hardwares operation,application program interfaces(APIs)let application programmers use functions of the computer and operating system without having to directly keep track of all the details in the CPUs operation.Lets look at the example of creating
4、 a hard disk file for holding data to see why this can be important.Text应用程序接口(API)使应用程序编程人员可以利用计算机和操作系统的功能,而不必直接跟踪CPU操作的所有细节A programmer writing an application to record data from a scientific instrument might want to allow the scientist to specify the name of the file created.The operating system
5、might provide an API function named MakeFile for creating files.When writing the program,the programmer would insert a line that looks like this:MakeFileIn this example,the instruction tells the operating system to create a file that will allow random access to its data,will have a name typed in by
6、the user,and will be a size that varies depending on how much data is stored in the file(2).Now,lets look at what the operating system does to turn the instruction into action.TextThe operating system sends a query to the disk drive to get the location of the first available free storage location.1.
7、With that information,the operating system creates an entry in the file system showing the beginning and ending locations of the file,the name of the file,the file type,whether the file has been archived,which users have permission to look at or modify the file,and the date and time of the files cre
8、ation.2.The operating system writes information at the beginning of the file that identifies the file,sets up the type of access possible and includes other information that ties the file to the application.TextIn all of this information,the queries to the disk drive and addresses of the beginning a
9、nd ending point of the file are in formats heavily dependent on the manufacturer and model of the disk drive.Because the programmer has written her program to use the API for disk storage,she doesnt have to keep up with the instruction codes,data types,and response codes for every possible hard disk
10、 and tape drive.The operating system,connected to drivers for the various hardware subsystems,deals with the changing details of the hardware-the programmer must simply write code for the API and trust the operating system to do the rest.Text她不必涉及每个磁盘与磁带驱动器的指令代码、数据类型和响应代码APIs have become one of the
11、most hotly contested areas of the computer industry in recent years.Companies realize that programmers using their API will ultimately translate into the ability to control and profit from a particular part of the industry.This is one of the reasons that so many companies have been willing to provid
12、e applications like readers or viewers to the public at no charge.They know consumers will request that programs take advantage of the free readers,and application companies will be ready to pay royalties to allow their software to provide the functions requested by the consumers.Text他们知道,客户会请求程序利用免
13、费阅读器。应用程序公司要准备支付版税,使其软件提供客户请求的功能User InterfaceJust as the API provides a consistent way for applications to use the resources of the computer system,a user interface(UI)brings structure to the interaction between a user and the computer.In the last decade,almost all development in user interfaces ha
14、s been in the area of the graphical user interface(GUI),with two models,Apples Macintosh and Microsofts Windows,receiving most of the attention and gaining most of the market share.The popular,open-source Linux operating system also supports a graphical user interface.TextThere are other user interf
15、aces,some graphical and some not,for other operating systems.Unix,for example,has user interfaces called shells that present a user interface more flexible and powerful than the standard operating system text-based interface.Programs such as the Korn Shell and the C Shell are text-based interfaces t
16、hat add important utilities,but their main purpose is to make it easier for the user to manipulate the functions of the operating system.There are also graphical user interfaces,such as X-Windows and Gnome,that make Unix and Linux more like Windows and Macintosh computers from the users point of vie
17、w.TextIts important to remember that in all of these examples,the user interface is a program or set of programs that sits as a layer above the operating system itself.The same thing is true,with somewhat different mechanisms,of both Windows and Macintosh operating systems.The core operating-system
18、functions,the management of the computer system,lie in the kernel of the operating system.The display manager is separate,though it may be tied tightly to the kernel beneath.The ties between the operating-system kernel and the user interface,utilities and other software define many of the difference
19、s in operating systems today,and will further define them in the future.Text用户界面是位于操作系统上层的一个或一组程序。User InterfaceA set of routines that an application program uses to request and carry out lower-level services performed by a computers operating system.The aspects of a computer system or program which
20、 can be seen(or heard or otherwise perceived)by the human user,and the commands and mechanisms the user uses to control its operation and input data.Key TermsApplication Program InterfaceThe use of pictures rather than just words to represent the input and output of a program.A program with a GUI ru
21、ns under some windowing system(e.g.The X Window System,MacOS,Microsoft Windows,Acorn RISC OS,NEXTSTEP).The program displays certain icons,buttons,dialogue boxes,etc.in its windows on the screen and the user controls it mainly by moving a pointer on the screen(typically controlled by a mouse)and sele
22、cting certain objects by pressing buttons on the mouse while the pointer is pointing at them.This contrasts with a command line interface where communication is by exchange of strings of text.Key TermsGraphical User InterfacePlural Unices.An interactive time-sharing operating system invented in 1969
23、 by Ken Thompson after Bell Labs left the Multics project,originally so he could play games on his scavenged PDP-7.Dennis Ritchie,the inventor of C,is considered a co-author of the system.The turning point in Unixs history came when it was reimplemented almost entirely in C during 1972-1974,making i
24、t the first source-portable OS.Unix subsequently underwent mutations and expansions at the hands of many different people,resulting in a uniquely flexible and developer-friendly environment.By 1991,Unix had become the most widely used multi-user general-purpose operating system in the world.Many peo
25、ple consider this the most important victory yet of hackerdom over industry opposition(but see Unix weenie and Unix conspiracy for an opposing point of view).Key TermsUNIX Operating SystemUnix is now offered by many manufacturers and is the subject of an international standardisation effort called?.
26、Unix-like operating systems include AIX,A/UX,BSD,Debian,FreeBSD,GNU,HP-UX,Linux,NetBSD,NEXTSTEP,OpenBSD,OPENSTEP,OSF,POSIX,RISCiX,Solaris,SunOS,System V,Ultrix,USG Unix,Version 7,Xenix.Unix or UNIX?Both seem roughly equally popular,perhaps with a historical bias toward the latter.UNIX is a registere
27、d trademark of The Open Group,however,since it is a name and not an acronym,Unix has been adopted in this dictionary except where a larger name includes it in upper case.Since the OS is case-sensitive and exists in many different versions,it is fitting that its name should reflect this.Key TermsUNIX
28、 Operating SystemQuestionsp What are the functions of the API and the user interface?p What is the difference between the API and the user interface?p What is the functions of MakeFile?p Korn Shell and C shell add some important functions,what are their main purposes?Exercise Translate the text into ChineseExerciseSimple writingp Please describe the functions of the API and the user interface.Exercise THANK YOU!