An operating system is an example of a type of soft ware called ‘system software’. This distinguishes it from application software, which is created to perform a specific task for a computer user rather than just helping to run the system.
GUI - 图形化界面
CLI - 命令行界面
命令行界面是在图形用户界面得到普及之前使用最为广泛的用户界面,它通常不支持鼠标,用户通过键盘输入指令,计算机接收到指令后,予以执行。也有人称之为字符用户界面(CUI)。
通常认为,命令行界面(CLI)没有图形用户界面(GUI)那么方便用户操作。因为,命令行界面的软件通常需要用户记忆操作的命令,但是,由于其本身的特点,命令行界面要较图形用户界面节约计算机系统的资源。在熟记命令的前提下,使用命令行界面往往要较使用图形用户界面的操作速度要快。所以,图形用户界面的操作系统中,都保留着可选的命令行界面。
Linux - 纯命令行界面 + 可选择的GUI界面
Windows - 纯GUI界面+自带的命令提示符程序cmd
办公、娱乐、设计、绘图、排版、管理选择GUI;服务器维护、大数据、人工智能等等,可以选择CLI。
GUI和CLI各有各的优点和适用范围,可能不存在谁一定优秀谁一定差的特点。
Allow the user to get the software and hardware to do something useful
Program development tools associated with a programming language allow a programmer to write a program without needing to know the details of how the hardware, particularly the processor, actually works.
When a program has started to run it is described as a process. In a modern computer system, a process will not be able to run to completion without interruption.
The resource management provided by the operating system aims to achieve the best possible efficiency in computer system use. The two most important aspects of this are:
Include Monitor screen, keyboard, printer, webcam etc.
Errors can arise in the execution of a program either because it was badly written or because it has been supplied with inappropriate data. Whatever the cause of an error, the operating system should have the capability to interrupt a running process and provide error diagnostics where appropriate In extreme cases, the operating system needs to be able to shut down the system in an organised fashion without loss of data
Another utility program, which can be a component of a disk formatter, performs disk contents analysis and, if possible, disk repair when needed.
磁盘碎片指的是硬盘读写过程中产生的不连续文件。硬盘上非连续写入的档案会产生磁盘碎片,磁盘碎片会加长硬盘的寻道时间,影响系统效能。 比如虚拟内存使用了硬盘,硬盘上便会产生磁盘碎片, 所以磁盘碎片会加长硬盘的寻道时间,影响系统效能。
因为在文件操作过程中,Windows系统可能会调用虚拟内存来同步管理程序,这样就会导致各个程序对硬盘频繁读写。
还有一种情况就是当中间的一个簇(由扇区组成)内容被删除后,新写入一个较小的文件,这样在这个文件两边就会出现一些空间,这时候再写入一个文件,两段空间的任意一部分都不能容纳该文件,这时候就需要将文件分割成两个部分,碎片再次产生了。
虽然说磁盘碎片对于正常工作影响并不大,但是会显著降低硬盘的运行速度,这主要是硬盘读取文件需要在多个碎片之间跳转,增加了等待盘片旋转到指定扇区的潜伏期和磁头切换磁道所需的寻道时间。(传统机械硬盘)
A perfectly functioning disk will, while in use, gradually become less efficient because the constant creation, editing and deletion of files leaves them in a fragmented state.
The cause of this is the logical arrangement of data in sectors, which does not allow a file to be stored as a single block of data.
When File B is deleted, the sector remains unfilled because it would require too much system CPU time to rearrange the file organisation every time there is a change.
A defragmenter utility program reorganises the file storage to return it to a state where all files are stored in one block across a sequence of sectors. For a large disk this will take some time. It will be impossible if the disk is too full because of the lack of working space for the rearrangement.
A file compression utility program can be used regularly by an operating system to minimise hard disk storage requirements.
Compression is most important when transmitting data.
A virus-checking program should be installed as a permanent facility to protect a computer system.
It is necessary for a virus checker to be regularly updated and for it to scan all files on a computer system as a matter of routine.
静态库和动态库分别应用在静态链接方式和动态链接方式中,所谓静态链接方式是指在程序执行之前完成所有的链接工作,把静态库一起打包合入,生成一个可执行的目标文件(EXE文件)。
所谓动态链接方式是指可执行目标文件在执行过程中才去加载调用相关功能函数,即在需要时才按需调用,是动态使用的。
库是已经提前写好的、现有的,可以复用的代码,本质上来说库是一种经过编译生成的可执行代码的二进制形式,可以被操作系统载入内存执行。库分为两种:静态库(.a、.lib)和动态库( .so、.dll)。
DLL最初用于节约应用程序所需要的磁盘和内存空间。早前,在传统的非共享库中,一部分代码简单地附加到调用的程序中。如果两个程序同时调用同一个子程序,就会出现两份那段代码。相反,许多应用共享的代码能够切分到一个DLL中,在硬盘上存为一个文档,在内存中只需使用一个实例。
DLL是一个动态链接库,它在运行时由加载程序链接。这使它比LIB有优势,LIB是一个静态库。它们在运行时编译,不仅节省了内存,而且提高了性能。
DLL的主要用途是打开和遍历其他不同程序的功能。它们不能直接运行,需要额外的代码才能打开它们。当然,它们是有用的,但是这些类型的文件通常不会从编码人员或其他技术人员那里打开,因为它们对用户来说没有太多内容,在浏览它们时出现任何错误都会导致问题。
DLL文件与EXE文件比较,但它们之间的主要区别是DLL文件不能像EXE一样直接打开和执行。它们对编码人员非常有用,因为他们不必从头开始编写代码,并且使用前一个代码来节省时间和精力。
DLL优点:
DLL 缺点:
The ‘programs’ in a program library are usually subroutines created to carry out particular tasks. A programmer can use these within their own programs.
DLL advantages:
DLL disadvantages:
编译器是一种计算机程序,负责把一种编程语言编写的源码转换成另外一种计算机代码,后者往往是以二进制的形式被称为目标代码(object code)。这个转换的过程通常的目的是生成可执行的程序。
解释器是一种计算机程序,它直接执行由编程语言或脚本语言编写的代码,并不会把源代码预编译成机器码。
表现:
性能:
编译器会事先用比较多的时间把整个程序的源代码编译成另外一种代码,后者往往较前者更加接近机器码,所以执行的效率会更加高。时间是消耗在预编译的过程中。
解释器会一行一行的读取源代码,解释,然后立即执行。这中间往往使用相对简单的词法分析、语法分析,压缩解释的时间,最后生成机器码,交由硬件执行。解释器适合比较低级的语言。但是相对于预编译好的代码,效率往往会更低。如何减少解释的次数和复杂性,是提高解释器效率的难题。
编译 Compile:把整个程序源代码翻译成另外一种代码,然后等待被执行,发生在运行之前,产物是「另一份代码」。
解释 Interpret:把程序源代码一行一行的读懂然后执行,发生在运行时,产物是「运行结果」。
Java程序也需要编译,但是没有直接编译称为机器语言,而是编译成为字节码,然后在JVM上用解释方式执行字节码。
ava通过解释器解释执行字节码,这样的执行方式相对较慢,尤其是遇到一些运行频繁的代码块或者方法时。于是后来JVM引入了JIT即时编译器(just in time),当JVM发现某些代码运行频繁时就会认定为热点代码“hot spot code”,为了提高运行效率,就会把这些代码编译成为平台相关的机器码然后进行优化,JIT就是用来完成这项工作的。
总结: Java就是先编译(高级语言→字节码),后解释(字节码→机器码),在解释的过程中也可能进行编译(JIT编译热点代码)。
Python有好几种版本的解释器:
CPython:官方版本的解释器。这个解释器是用C语言开发的,所以叫CPython。CPython是使用最广的Python 解释器。我们通常说的、下载的、讨论的、使用的都是这个解释器。
Ipython:基于CPython之上的一个交互式解释器,在交互方式上有所增强,执行Python代码的功能和CPython 是完全一样的。CPython用>>>作为提示符,而IPython用In [序号]:作为提示符。
PyPy:一个追求执行速度的Python解释器。采用JIT技术,对Python代码进行动态编译(注意,不是解释),可以显著提高Python代码的执行速度。绝大部分CPython代码都可以在PyPy下运行,但还是有一些不同的,这就 导致相同的Python代码在两种解释器下执行可能会有不同的结果。
Jython:运行在Java平台上的Python解释器,可以直接把Python代码编译成Java字节码执行。
IronPython:和Jython类似,只不过IronPython是运行在微软.Net平台上的Python解释器,可以直接把Python 代码编译成.Net的字节码。
都说解释器慢,Python也有想办法提高一下运行速度的,那就是使用pyc文件。这点参考了JAVA的字节码做法, 但并不完全类同。
我们编写的代码一般都会保存在以.py为后缀的文件中。在执行程序时,解释器逐行读取源代码并逐行解释运行。 每执行一次,就重复一次这个过程,这其中耗费了大量的重复性的解释工作。为了减少这一重复性的解释工作, Python引入了pyc文件,pyc文件是将py文件的解释结果保存下来的文件,这样,下次再运行的时候就不用再解 释了,直接使用pyc文件就可以了,这无疑大大提高了程序运行速度。
Execution of the program can only begin when the compilation has shown no errors.
This can take place automatically under the control of the compiler program if data for the program is available.
The advantages and disadvantages to a programmer of creating interpreted or compiled programs:
The advantages and disadvantages to the user of interpreted or compiled programs.
Whether an interpreter or a compiler is used, a program can only be run on a particular computer with a particular processor if the interpreter or compiler program has been written for that processor.
If there is an option available the choice of an interpreter is justified when a program is being developed because:
The choice of a compiler is justified when the programmer is confident that the program is as near error-free as possible because:
Each different type of computer has to have a Java Virtual Machine created for it. Then when a programmer writes a Java program this is compiled first of all to create what is called Java Byte Code. When the program is run, this code is interpreted by the Java Virtual Machine. The Java Byte Code can be transferred to any computer that has a Java Virtual Machine installed.
Prettyprint refers to the presentation of the program code typed into an editor.
This feature displays hints (or a choice of keywords) and available identifiers that might be appropriate at the current insertion point of the program code.
When a line has been typed, some editors perform syntax checks and alert the programmer to errors.
When working on program code consisting of many lines of code, it saves excessive scrolling if you can collapse blocks of statements.
Debugging - finding and correcting errors, often called ‘bugs’, in a program
Windows系统、Linux系统 和 Mac OS操作系统 历史由来 与 区别?