Article Directory
- 1.1 Resource management functions and objectives of the operating system
-
- 1. Definition of operating system
- Second, the composition of the operating system
- 3. Some popular operating systems
- Fourth, the position of the operating system in the computer system
- 5. Resource management technology of the operating system
- Six, Linux operating system experimental environment construction
- Seven, the goal of the operating system
- 1.2 Functions of the operating system
- 1.3 Main features of the operating system
- 1.4 Development and Classification of Operating Systems
- 1.5 User interface of the operating system
- 1.6 Structural design of the operating system
1.1 Resource management functions and objectives of the operating system
1. Definition of operating system
Operating System (OS for short) is a system software that manages system resources, controls program execution, improves man-machine interface, provides various services, rationally organizes computer workflow, and provides a good operating environment for users to effectively use computers .
What resources does the computer system have?
Hardware resources:
- CPU
- Memory
- external storage
- I/O device
Software resources:
- program
- data
The most important service provided by the operating system is that of running programs.
The operating system provides the user with:
- memory allocation service
- Equipment Allocation and Handling Services
- Processor Scheduling Service
- file access service
Second, the composition of the operating system
computer hardware system | operating system |
---|---|
CPU | Process Management Module |
Memory | storage management module |
I/O device | Device Management Module |
external storage | File System Management Module |
3. Some popular operating systems
Some popular operating systems:
- OF THE
- Windows 3.0 was released on May 22, 1990
- Windows 3.1 was released on March 18, 1992
- The Chinese version of Windows 3.2 was released in 1994
- Windows 95 launched on August 24, 1995
- Windows 98 was released on June 25, 1998, and its version number is 4.1
- Windows 2000
- Windows 2003
- Windows XP
- Windows 7
- Windows 8
- Windows 10
- open linux
- ubuntu
- Fedora (based on Red Hat Linux)
- Kylin operating system (Chinese version of Ubuntu Kylin)
- Rain forest wind OS (StartOS starting point operating system) (Linux kernel, Windows interface)
1.UNIX
- A multi-user, multi-tasking operating system was developed in 1969 at AT&T's Bell Labs in the United States.
- AT&T licenses the Unix source code to academic institutions for research or teaching purposes for free, forming many "Unix variants", such as IBM's AIX, Hewlett-Packard's HP-UX, SUN's Solaris, and Silicon Valley Graphics' IRIX
- AT&T, aware of the commercial value of Unix, terminated the Unix source code authorization, and declared copyright rights to the previous Unix and its variants
2.Linux
- A free and open source UNIX-like operating system first released on October 5, 1991 by Linus Torvalds, a sophomore in Finland. (20 years since the birth of UNIX)
- Linux can run on servers and other large platforms, such as mainframes and supercomputers.
- More than 90% of the world's 500 fastest supercomputers run Linux distributions or variants, including the fastest top 10 supercomputers that run operating systems based on the Linux kernel.
- Linux is also widely used in embedded systems, such as mobile phones, tablet computers, routers, TVs and video game consoles.
- The Android operating system, widely used on mobile devices, is built on top of the Linux kernel.
3.Windows
- Microsoft operating systems, from 16-bit, 32-bit to 64-bit.
- From the original windows1.0 to windows95, NT, 97, 98, 2000, Me, XP, Server, Vista, Windows 7, Windows 8, Windows10.
- In 2004, Windows had approximately 90% market share of terminal operating systems.
4.Android
- Android, a semi-open source operating system based on Linux, mainly used for mobile devices, led and developed by Google
- In October 2008, the first Android smartphone was released
- In the first quarter of 2011, Android's global market share surpassed Nokia's Symbian system, which has dominated for more than ten years, for the first time, becoming the world's largest smartphone operating system
- In November 2012, Android accounted for 76% of the global smartphone operating system market, and the Chinese market share was 90%
Fourth, the position of the operating system in the computer system
5. Resource management technology of the operating system
1. Resource reuse
Resource multiplexing refers to the sharing of physical resources by multiple processes , including space -division multiplexing in which resources are divided into smaller units and time-division multiplexing in which resources are used in turn in time-sharing .
Processes are independent entities that are entitled to system resources.
Examples of resource reuse:
- Space division multiplexing: memory partition or paging allocation
- Space division multiplexing: block allocation of external memory
- Time-division multiplexing: time-division multiplexing of processors
2. Resource virtualization
Resource virtualization uses one type of thing to simulate another type of thing, creating the illusion that another type of thing has more quantity or capacity.
Examples of resource virtualization:
3. Resource abstraction
Resource abstraction is a resource management technology that uses software to encapsulate complex hardware or software facilities and simplifies resource application interfaces.
Resource abstraction instance:
- Virtual input device - keyboard
- Virtual output device - monitor
Six, Linux operating system experimental environment construction
The first, physical installation,
installs Ubuntu as a bootable mode.
The second, virtual installation,
installs Ubuntu on a virtual machine VMware Workstation (VM)
Seven, the goal of the operating system
1. User-friendly
2. Expand machine function
3. Manage system resources
4. Improve system efficiency
5. Build an open environment
1.2 Functions of the operating system
1. Processor management function
1. Process control and management: including process creation, operation, blocking, termination, etc.
2. Process synchronization and mutual exclusion
Resource coordination relationship between processes:
- Synchronization - waiting between processes, waking up the cooperative relationship
- Mutual exclusion - resource competition, mutual exclusion relationship between processes
3. Process communication and deadlock
Information exchange relationship between processes:
- Communication - the exchange of information between processes
- Deadlock - processes directly or indirectly wait for each other to send unlock signals
4. Thread control and management
Thread creation, running, suspending, terminating, etc.
5. Processor scheduling: sub-job scheduling, mid-range scheduling, low-level scheduling, etc.
2. Storage management function
1. Storage allocation
Allocate the required memory space for each process and the operating system itself , and reclaim the returned memory space.
2. Storage sharing
3. Address translation and storage protection
- Address translation: When loading a program into memory to create a process, it is necessary to convert the logical address in the program into a physical address.
- Storage protection: A process in memory can only be accessed in its own address space, and cannot access the address space of other processes or the operating system.
4. Storage expansion
The internal and external memory are unified through the virtual memory technology, and a part of the external memory is used as an auxiliary space for accommodating the process, so that the existence space of the process is expanded.
3. Device management function
1. Equipment allocation
Allocate shared devices among multiple processes, ensuring efficient device utilization, no deadlocks, and no starvation.
2. Buffer management
Buffers are used to transfer data in bulk between devices and processes.
3. Device driver
The device driver is a layer of abstraction of the device hardware, used to send commands to the device and communicate with the device.
4. Device independence
Device independence is actually program independence, the property that programs are independent of devices. The same program can be used for many different devices.
5. Implement virtual devices
Virtual device is a technology that uses one device to simulate another device. The purpose is to transform exclusive devices into shared devices, transform online processing into batch processing, so as to improve the parallel working potential of CPU and devices, reduce process waiting time, and improve process operation. efficiency.
4. File management function
1. Provide a logical organization method for files
- Whether the structure of the file content is a stream of bytes or a sequence of records .
2. Provide a physical organization method for files
- When files are stored in units of physical blocks, how to establish the order of physical blocks to reflect the logical order of file contents.
3. Provide file access methods
- File sequential access, random access, or indexed access.
4. How to use the provided file
5. Realize file directory management
- The directory is used to retrieve files, and its structure affects the efficiency of file search.
6. Implement file access control
- Specify the permitted accessors of files and the types of file access operations that each visitor is allowed to perform, so as to realize safe access to files.
7. Realize file storage space management
- Manage the free space of the external storage, so as to know the capacity and location of the free space in time, and establish the necessary data structure for the allocation and recovery of file storage space.
5. Network and communication management functions
1. Online resource management function
2. Data communication management function
3. Network management functions: including: fault management, security management, performance management, accounting management and configuration management.
1.3 Main features of the operating system
1. Concurrency
- Concurrency: Refers to two or more events or activities occurring within the same time interval.
- Parallelism: Refers to two or more events or activities occurring at the same time.
Concurrency of the operating system: The concurrency of the operating system refers to the existence of several running programs (including operating system programs and user programs) in the computer system at the same time, and these programs are executed alternately and interspersed.
Benefits of concurrency:
- Concurrent program execution can drive different components to work simultaneously
- Reduce or eliminate parts and parts waiting for each other
- Improve system resource utilization, improve system throughput, and improve system efficiency
2. Sharing
Sharing means that the resources in the operating system (including hardware resources and information resources) can be shared by multiple concurrently executing processes, rather than being exclusively occupied by one of the programs.
There are two ways to share resources:
1. Mutually exclusive access
Also known as sequential access, certain resources in the system are only allowed to be accessed by one process at a time.
The essential meaning of mutual exclusive access or sequential access is that several tasks that share resources use resources sequentially, rather than alternately and interspersedly
2. Simultaneous access
Also known as concurrent access, multiple processes are allowed to alternately and interspersed concurrent access to certain resources at the same time.
The essential meaning of simultaneous access or concurrent access is that several tasks sharing resources use resources alternately and interspersed
3. Asynchronicity
Asynchrony is also called randomness. In a multi-programming environment, the execution of the program is not consistent to the end, but "stop and go". It is unpredictable when to "go" and when to "stop".
4. Virtuality
Virtuality is a feature of operating system resource management technology. Virtual resource management technology is resource virtualization, which turns a physical entity into multiple logical counterparts, or turns multiple physical entities into a logical one. counterpart.
①Virtual processor: Turn one physical processor into multiple logical processors
②Virtual memory: Turn part of the memory and external memory into a larger logical memory
③Virtual device: Use part of the disk and management software to transform the slow online exclusive device into a batch virtual shared device
④Virtual file system: an abstract file system framework that represents the common characteristics of different file systems, so that one operating system supports multiple different file systems
1.4 Development and Classification of Operating Systems
1. Manual operation stage
2. Management process stage
How computers operate during the hypervisor phase
Features of Computer Operation in Hypervisor Stage
- Job control language replaces mechanical operation
- Offline operation instead of online operation
- Automatic batch jobs
3. Multiprogramming and the formation of the operating system
Multiprogramming concept: Multiprogramming refers to the method of allowing multiple programs to enter the main memory of a computer system at the same time and start to perform alternate calculations.
The hardware basis of multiprogramming: interrupt and channel technology
Multiprogramming study
Example 1. Single program running problem
There is a data processing problem P1. It is required to input 500 characters from the input machine (it takes 78ms). After processing by the CPU for 52ms, the result of 2000 characters is stored on the tape (it takes 20ms). Repeat until all the input data is processed. . Try to draw a timing diagram of hardware work and calculate the CPU utilization.
untie:
Processor utilization rate: 52/(78+52+20)≈35%
Example 2. Multiprogramming problem
On the basis of Example 1, while calculating P1, the computer also accepts another calculation problem P2: input 2000 characters from another tape drive 2 (it takes 20ms), after 42 ms of processing, from the line printer The above outputs two lines (takes about 88ms). Try to draw a timing diagram of hardware work and calculate the CPU utilization.
untie:
Processor utilization: (52+42)/(78+52+20)≈63%
Benefits of multi-programming : Multi-programming improves the utilization of CPU, memory and I/O devices, improves system throughput, brings into play the parallelism of the system, and improves efficiency
The number of tracks of multiprogramming : factors such as the capacity of internal memory, user response time, and the type of resources used by the program affect the number of tracks of multiprogramming.
The sign of the formation of the operating system : the emergence of multi-channel batch operating system, time-sharing operating system and real-time operating system marks the formal formation of the operating system.
Fourth, the classification of the operating system
1. Batch operating system
The user compiles the application problem to be calculated into a program, and gives it to the operator together with the data and operation instructions, and the operator collects a batch of operations and inputs them into the computer. Then, it is up to the operating system to schedule and control the execution of jobs. An operating system that processes jobs in batches is called a batch operating system.
The working mechanism of the batch operating system:
The main features of the batch processing system:
(1) Users work offline: After the user submits the job until the result is obtained, the user no longer interacts with the computer and his job, which is not conducive to debugging and modifying the program.
(2) Batch processing jobs
(3) Multi-program operation
(4) Long job turnaround time
2. Time-sharing operating system
An operating system that allows multiple online users to use a computer system for computing at the same time is called a time-sharing operating system.
Schematic diagram of the working principle of the time-sharing operating system:
Time slice concept : The host CPU takes turns serving each end user for a short period of time, which is called a time slice.
The selection principle of the time slice length : the time slice length of the time-sharing operating system should be reasonably selected according to factors such as machine speed, number of users, response requirements, and system overhead.
The main features of the time-sharing system:
(1) Simultaneity: Several end users use the computer online at the same time.
(2) Independence: Each user feels as if he owns a computer.
(3) Timeliness: Each user can control his own program in time.
(4) Interactivity: human-computer interaction, online work, easy to debug and modify programs.
3. Real-time operating system
When external events or data are generated, they can be received and processed at a fast enough speed, and the processed results can control the monitored production process or respond quickly to the processing system within the specified time, and control all real-time tasks to run in a coordinated manner operating system.
Working mechanism of real-time operating system:
Three typical real-time systems:
① Process control system
- Production Process Control System
- missile guidance system
- aircraft autopilot system
- Artillery automatic control system
②Information inquiry system
The computer accepts service requests and questions from hundreds of terminals at the same time, and makes answers and responses in a short time.
Such as information retrieval system.
③ Transaction processing system
Computers must not only respond to end users in a timely manner, but also frequently update files or databases in the system.
Such as banking system.
④Universal operating system
If an operating system has all or both functions of batch processing, time-sharing and real-time processing, the operating system is called a general-purpose operating system.
Popular operating systems such as Windows and Linux have batch processing, time-sharing processing functions and weak real-time processing functions, so they belong to general-purpose operating systems.
1.5 User interface of the operating system
1. Program interface
1. Concept of program interface
The program interface is also called the application programming interface API (Application Programming Interface), which is used by programmers to call the services and functions of the operating system in the form of program statements or instructions when programming.
The program interface is composed of a group of system calls (System Call), which is an integral part of the operating system and is used to manage and control the shared use of software and hardware resources in the system.
2. The concept of system calls
A system call is a process (function) established in the kernel to expand machine functions, enhance system capabilities, and facilitate user use. It is the only way for user programs or other system programs to obtain operating system services . System calls are also called generalized instructions.
System calls are implemented in assembly language or C language.
System calls of the operating system:
3. Classification of system calls
Some system calls of UNIX/Linux and Windows:
4. The concept of trapping or exception handling mechanism
In the operating system, the mechanism that realizes the system call function is called trapping or exception handling mechanism.
5. Visit management instruction (trapped instruction or abnormal interrupt instruction)
A machine instruction that interrupts the processor due to a system call is called an access instruction (trapped instruction or abort instruction).
6. System call processing
7. The difference between a system call and a procedure (function) call
2. Linux program interface experiment
1. Familiar with Linux C language editing program gedit
2. Familiar with Linux C language compiling and linking program gcc
3. Familiar with the usage of Linux system call function
4. Familiar with how to run Linux programs
3. Operation interface
1. Definition of operation interface
The operation interface, also known as the job-level interface, is a collection of operation control computer work and service provision methods provided by the operating system for users.
Important differences between operational interfaces and programmatic interfaces:
- The operation interface can be used without compiling
- The program interface needs to be compiled before it can be used
2. Type of operation interface
(1) Operation control command: It consists of a set of commands and command interpreter, also known as command interface or online user interface.
Command format: verb-object structure
Command Verb Command Object Parameters and Execution Mode Parameters
Execution of Operational Control Commands
(2) The job control language provided by the batch processing system
Job Control Language (JCL) consists of a set of job control cards, or job control statements, or job control operation commands, also known as an off-line user interface. Offline users can control jobs offline through the job control language.
The difference between online and offline job control
(3) Graphical user interface
Graphical user interface (GUI) uses technologies such as windows, icons, menus, and mice to intuitively and realistically represent system functions, various applications, and files with graphical symbols. Users can select windows, menus, dialog boxes, and scroll Articles complete various controls and operations on their jobs.
Such as Windows Explorer and Linux graphical desktop.
(4) Implementation methods such as new user interface
The maturity of virtual reality interface, multi-sensory channel user interface, naturalized user interface, and intelligent user interface technology will bring greater convenience to the application of the operating system.
4. Linux operation interface experiment
Familiar with common operating commands of Linux files and directories,
such as: pwd, ls, mkdir, cd, cp, cat, rm, etc.
1.6 Structural design of the operating system
1. The main components of the operating system
1. Kernel
The operating system kernel is a layer of software that abstracts the hardware for the first time , also known as the hardware abstraction layer , which is used to hide the complexity of the hardware and provide a concise and unified hardware-independent interface for the upper-layer software.
2. Process
A process is a running process of a program to complete a specific task.
3. Thread
A thread is an execution flow in a process . A process can contain multiple execution flows, and each execution flow undertakes a computing task.
4. Monitor
A monitor is an object used to manage shared resources. The monitor encapsulates a data structure and a set of procedures for synchronizing and mutually exclusive operations on shared resources.
Second, the structure of the operating system
1. Monolithic structure
An operating system consists of a collection of processes linked into one large executable binary program.
2. Hierarchy
Hierarchical structure is to divide the operating system into kernel and several modules (or processes), these modules (or processes) are arranged into several layers according to the calling order of functions, and there can only be one-way dependency or one-way call relationship between each layer, That is, the low layer serves the high layer, and the high layer can call the functions of the low layer.
3. Client/server and microkernel structure
The client/server and microkernel structure divides the operating system into two parts, one part is the process running in the user mode and active in the client/server mode; the other part is the kernel running in the kernel mode. Except for the kernel part, other parts of the operating system are divided into several relatively independent processes.
3. Operating system operating model
1. The relationship between the operating system operating model and the kernel structure The
corresponding relationship between the operating system kernel structure and the operating model is approximate, not absolute.
2. Non-process mode (kernel module call mode)
The functions of an operating system running in non-process mode are organized into a set of routine programs, and operating system service routines are executed in combination with user process codes in the form of system calls to form a single process in form . This mode is also known as kernel module call mode or system call mode .
Non-process mode (kernel module call mode) running process:
The process image composition structure of non-process mode:
2. Process mode
The process mode organizes the operating system into a group of system processes , that is, the function of the operating system is the result of the operation of these system processes. These system processes are also called servers or server processes . They form a client/server process with user processes or other server processes. server relationship.
Process mode system structure: