Chapter4 - Software

4.01 Types of software and interrupts

System software and application software

features of system software and applications software::

System software::

  1. Controls and manages the operation of the computer hardware.
  2. Provides a platform on which all software can run properly.
  3. Provides a human computer interface (HCI).
  4. Controls the allocation and usage of resources (software and hardware).

application software::

  1. Used to perform various tasks on a computer.
  2. Allows the user to perform specific tasks on a computer.
  3. Meets the requirements of the user.

Application Software

Word processor:: Word processing software is used to manipulate a text document, such as an essay or a report.

Spreadsheet(excel):: Spreadsheet software is used to organise and manipulate numerical data (in the form of integer, real, date and so on).

Database:: Database software is used to organise, manipulate and analyse data.

Control and measuring software:: Control and measuring software is designed to allow a computer or microprocessor to interface with sensors so that it is possible to:: measure physical quantities in the real world (such as temperatures). control applications (such as a chemical process) by comparing sensor data with stored data and sending out signals to alter process parameters (e.g. open a valve to add acid and change the pH).

APPS:: Apps is short for applications – a type of software. They normally refer to software which runs on mobile phones or tablets.

Photo editing software:: Photo editing software allows a user to manipulate digital photographs stored on a computer.

Video editing software:: Video editing software is the ability to manipulate videos to produce a new video.

Graphics manipulation software:: Graphics manipulation software allows bitmap and vector images to be changed. Bitmap images are made up of pixels which contain information about image brightness and colour.

System Software

compilers:: A compiler is a computer program that translates a program written in a high-level language (HLL) into machine code (code which is understood by the computer) so that it can be directly used by a computer to perform a required task.

linkers:: A linker (or link editor) is a computer program that takes one or more object files produced by a compiler and combines them into a single program which can be run on a computer.

Device drivers:: A device driver is the name given to software that enables one or more hardware devices to communicate with the computer's operating system.

Operating System(OSs)::The operating system (OS) is essentially software running in the background of a computer system.

Utilits:: Utility programs are software that are designed to carry out specific tasks on a computer.

Utilits Programs

virus checker:: A small program that replicates itself and can delete or modify important files. Antivirus software looks for malware ‘clues’ or recognises it from a database of known viruses.

defragmenter:: Defragmentation software tidies up the hard disk drive as it begins to reach its maximum capacity.

Disk repair:: Disk repair software verifies if an error has been found in the disk directory; it will then attempt to correct the error if possible.

File compression:: File compression can either be lossy or lossless.

Back-up software:: Back-up files are essential in case files/data become corrupted or lost and are needed to recover the data.

Security:: The security system manages access control to a computer.

Device drivers:: Device driver is the name given to software that enables one or more hardware devices to communicate with a computer’s operating system.

Screensavers:: Screensavers are moving or still images on a computer screen that are initiated after a period of inactivity.

操作系统

ENIAC大型机 -> (操作系统)需要对计算机硬件进行管理、分配和调度

DOS (Disk Operating System) 操作系统. 命令行界面(CLI)

Windows 操作系统, 图形化界面 (GUI)

操作系统功能

操作系统本质上是运行在计算机上的软件/程序,作为硬件基础上的第一层软件,操作系统是硬件和各种软件沟通的桥梁。其功能大致可分为两个部分:

管理计算机硬件与软件资源 向用户提供一个与系统交互的操作界面

Human computer interface::

The human computer interface (HCI) is necessary to allow a human being to communicate with a computer.

The two most common types of HCI are the command line interface (CLI) and graphical user interface (GUI).

Memory management

Memory management is essentially management of the primary storage (RAM) and the data being moved between RAM and HDD/SSD. It keeps track of all the memory locations.

This part of the OS carries out memory protection to prevent two competing applications from using the same memory locations at the same time. This would otherwise lead to a potential computer crash, security issues or loss or corruption of data.

Security management

Security management ensures the integrity, confidentiality and availability of data.

This can be achieved by::

  1. overseeing software updates when they become available
  2. ensuring the latest version of software is always being run (which often contains revised security fixes
  3. running antivirus software and using a firewall to check all traffic to and from the computer
  4. maintaining access rights for all users
  5. carrying out data recovery and system restore.
Hardware peripheral management

Hardware management uses device drivers to allow input and output to take place. It manages the queues and buffers to ensure data is being handled correctly and that the CPU performs to its maximum.

File management

File management maintains file directories and file naming conventions. It can perform file maintenance tasks such as open, close, delete, rename, copy and so on.

File management also ensures access rights are maintained as part of security and correct memory allocation of the data when it is read from the HDD/SSD and saved temporarily in RAM.

Multitasking

Multitasking allows a computer to carry out more than one task simultaneously.

  1. all resources are allocated specific processor time
  2. all processes can be interrupted as and when necessary
  3. priorities are used so that a given resource is used in the most efficient manner and that the required resources are made available as and when necessary.
Management of user accounts

User account management allows more than one user to log into the computer by ensuring each user’s data is stored in a separate part of memory.

Each user logging onto a computer is given a user account area, which is protected by a username and a password.

Each user can customise their screen layout and manage their own files and folders. An administrator oversees the management of user accounts.

Running of applications

  1. When a computer starts up, part of the operating system is loaded into RAM (this is called booting up the computer).
  2. This routine is handled by the Basic Input Output System (BIOS) which is a type of firmware – a program that provides low-level control of devices.
  3. The BIOS is stored on a flash memory chip called an EEPROM (electrically erasable programmable ROM) and its task is to tell the CPU where the operating system can be found.
  4. Although BIOS is stored on EEPROM, BIOS settings are stored on a complementary metal oxide semi-conductor (CMOS) chip, which is always connected up to a power supply (battery). The user is allowed to alter the factory settings by changing CMOS contents, such as changing the clock speed.

Interrupts

interrupts

An interrupt is a signal sent from a device or software (or it can be an internal signal) to the microprocessor. This will cause the microprocessor to temporarily stop what it is doing so it can service the interrupt.

Once an interrupt signal is received, the microprocessor either continues with its existing task or temporarily pauses the task in order to service the interrupt. To determine the order of servicing interrupts, each interrupt is given an interrupt priority.

Buffers are also used to allow several tasks to be done at the same time.

Buffers are areas of memory that hold data temporarily; they prevent slower processes affecting CPU performance and also allow the CPU to carry out several tasks at the same time.

interrupts examples::

  1. software interrupts
    1. divide by zero error
    2. can’t find .exe file
    3. two processes trying to access the same memory location at the same time
  2. hardware interrupts
    1. printer has paper jam or has run out of ink
  3. timing signal error
    1. a clock issue and operations are not synchronised
  4. input/output hardware processes
    1. HDD is requesting new data
  5. user interaction
    1. pressing keyboard keys
    2. clicking a mouse button

4.02 Types of programming language, translators and integrated development environments

编译和解释

编译器是一种计算机程序,负责把一种编程语言编写的源码转换成另外一种计算机代码,后者往往是以二进制的形式被称为目标代码(object code)。这个转换的过程通常的目的是生成可执行的程序。

解释器是一种计算机程序,它直接执行由编程语言或脚本语言编写的代码,并不会把源代码预编译成机器码。

表现:

  1. 编译器把源代码转换成其他的更低级的代码(例如二进制码、机器码),但是不会执行它。
  2. 解释器会读取源代码,并且直接生成指令让计算机硬件执行,不会输出另外一种代码。

性能:

  1. 编译器会事先用比较多的时间把整个程序的源代码编译成另外一种代码,后者往往较前者更加接近机器码,所以执行的效率会更加高。时间是消耗在预编译的过程中。
  2. 解释器会一行一行的读取源代码,解释,然后立即执行。这中间往往使用相对简单的词法分析、语法分析,压缩解释的时间,最后生成机器码,交由硬件执行。解释器适合比较低级的语言。但是相对于预编译好的代码,效率往往会更低。如何减少解释的次数和复杂性,是提高解释器效率的难题。
  3. 编译 Compile:把整个程序源代码翻译成另外一种代码,然后等待被执行,发生在运行之前,产物是「另一份代码」。
  4. 解释 Interpret:把程序源代码一行一行的读懂然后执行,发生在运行时,产物是「运行结果」。

不同语言的编译和解释

Java

Java程序也需要编译,但是没有直接编译称为机器语言,而是编译成为字节码,然后在JVM上用解释方式执行字节码。

ava通过解释器解释执行字节码,这样的执行方式相对较慢,尤其是遇到一些运行频繁的代码块或者方法时。于是后来JVM引入了JIT即时编译器(just in time),当JVM发现某些代码运行频繁时就会认定为热点代码“hot spot code”,为了提高运行效率,就会把这些代码编译成为平台相关的机器码然后进行优化,JIT就是用来完成这项工作的。

总结: Java就是先编译(高级语言→字节码),后解释(字节码→机器码),在解释的过程中也可能进行编译(JIT编译热点代码)。

Python

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 的运行机制

都说解释器慢,Python也有想办法提高一下运行速度的,那就是使用pyc文件。这点参考了JAVA的字节码做法, 但并不完全类同。

我们编写的代码一般都会保存在以.py为后缀的文件中。在执行程序时,解释器逐行读取源代码并逐行解释运行。 每执行一次,就重复一次这个过程,这其中耗费了大量的重复性的解释工作。为了减少这一重复性的解释工作, Python引入了pyc文件,pyc文件是将py文件的解释结果保存下来的文件,这样,下次再运行的时候就不用再解 释了,直接使用pyc文件就可以了,这无疑大大提高了程序运行速度。

High-level languages and low-level languages

A computer program is a list of instructions that enable a computer to perform a specific task.

high-level languages (HLLs):: used by the majority of programmers as they make it much easier and quicker to develop and maintain programs. (Visual Basic, Python and Java)

low-level languages (LLLs):: programmers who need to develop special routines that make best use of memory, the computer’s instruction set and hardware. Most programs are written in assembly language, which is translated into machine code.

Assembly Languages

Translators

Advantages and disadvantages of compilers and interpreters

Integrated development environment(IDE)

An integrated development environment (IDE) is a suite of software development tools used by programmers to aid the writing and development of programs.