Operating system-related knowledge

Source: Internet
Author: User
Tags semaphore

Introduction of operating system

1, from the point of view of resource management, the operating system has 5 major functions: Process management, job management, storage management, device management, file management.

2, the operating system from the function of the operating system can be divided into: Batch processing system, time-sharing system, realtime system, network operating system, distributed operating system.

3. Time-sharing operating system allows multiple users to use a single computer simultaneously.

4, the operating system has 4 basic features: common (simultaneous sex), sharing, uncertainty, and virtual nature.

5, terminal processing: Save Interrupt Program Site-"Analysis of the source of interruption--" to the implementation of the corresponding interrupt handler-"Resume the interrupt program site, continue to execute the interrupted program."

6. The state of the processor execution is divided into the kernel state and the User state (visual State).

7, the operating system is the management of hardware resources, control program implementation, improve human-machine interface, reasonable organization of computer workflow and for users to use the computer to provide a good operating environment of a system software.

8, multi-channel program design features are multi-channel, macro-parallel, micro-serial.

9, WINDOWS95/98 is a single user multi-tasking operating system, Windows NT is a multi-user multitasking operating system, DOS is a single user operating system.

II. Process Management

1, the sequence of the implementation of the characteristics of: sequential, closed, can be in the present. The characteristics of concurrent execution of programs: discontinuity, loss of sealing, non-reproducibility.

2, the process is the program and its data in a computer run, is the system scheduling and resource allocation of independent units.

3, the characteristics of the process: dynamic (is the most important feature of the process), concurrency, Independence, asynchrony, interactivity, structure (from a structural perspective, the process entity is composed of program segment, data segment and process Control block PCB3 part).

4, a process can execute one or more programs, a program can also create multiple threads.

5, Process creation events are: User login, job scheduling, service delivery, application requests.

6, the process terminates the event has: the normal end, the abnormal end, the outside intervention.

7, the process blocking (waiting) events are: The request system to provide services, start a certain operation, new data has not arrived, no new work to do.

8, why have the concept of process, but also to propose the concept of threading?

Because the process is a resource owner, so the process of the creation, revocation and switching process, the system must pay a large time and space overhead, and because of this, in the system set up the number of processes should not be too much, the frequency of switching between processes should not be too high, thus restricting the degree of co-development of further improvement. Because the thread is an entity in the process, it is the basic unit that can be scheduled and dispatched independently by the system, it basically does not have the system resources, makes the execution more efficient, improves the concurrent execution of many programs, and reduces the overhead of the system.

9. One thread can create and destroy another thread, and multiple threads in the same process can execute concurrently.

10. Thread Properties:

Each thread has a unique identifier and a thread description table. Different threads can execute the same program, that is, when the same program is called by different users, the operating system creates different threads for them. Each thread in the same process shares the memory address space of the process. A thread is a separate dispatch unit for the processor.

11, the operating system only allows a process to use resources called critical resources. The part of the process that accesses the critical resource is the critical section.

12, the use of the critical area principle:

Free entry: When no one process is in the critical section, a process is allowed to enter the critical section.

Busy waiting: When a process enters the critical section, other processes that want to enter must wait.

Limited wait: When a process leaves the critical section, if a process is found waiting to enter the critical section, the process is awakened to avoid the process entering a "dead wait".

Let's wait: when the process cannot enter the critical section, the CPU resources should be freed immediately to avoid being caught in a "busy wait".

13, initially, the semaphore S is an integer variable, in addition to the initial, the semaphore can only perform two atomic operations, that is, wait (s) and signal (s), also known as P (s) and V (s). is a process synchronization tool.

14, usually p operation means to request a resource, v operation means to release a resource, under certain conditions P operation represents the suspend process operation, v operation represents wake up the operation of the suspended process.

15, the way of communication between the process generally has the letter box communication, the message buffer communication and the pipeline communication and so on.

16, Deadlock: In the system, a process to request a resource, so that a number of processes in the absence of external forces can never go forward (continue to run) phenomenon. Most deadlocks are caused by concurrent processes sharing critical resources, and deadlocks are time-dependent and difficult to reproduce.

17, the system has a deadlock, the number of deadlocks is at least two.

18. There are 4 ways to resolve deadlocks: To prevent deadlocks, to avoid deadlocks, to detect deadlocks, to unlock deadlocks, where the first two are not allowed to deadlock, the banker algorithm is a representative algorithm for the avoidance of deadlock two proposed.

19, process synchronization refers to: multiple related processes in the order of execution coordination, these processes cooperate with each other, at some key points may need to wait or communicate with each other.

20, a computer has 6 interchangeable tape drives, used by n processes, each process in a period of time to require exclusive two tape drives for use, n up to 5 when the system will not be deadlocked.

The solution to this problem is generally from the worst point of view: that is to say that there are many processes to apply for the tape drive, assuming that there are 5 processes, a process to apply for a tape drive, then there is a tape drive, at this time just 5 of any one of the process can also apply for a tape drive to meet the operating conditions. But if there are 6 processes in the beginning and one process is requesting a tape drive, then there is no tape drive left, so no one can run at this time, so no more than 5.

21, a system has 11 printers, n processes to share printer resources, each process requires 3, when n does not exceed 5 o'clock, the system will not occur deadlock.

Thinking as above, consider the worst case scenario, 5 processes have requested 2 printers, then the 5 process of any process to apply for a printer to function properly. But if n=6, then assume that there are 5 processes to apply for 2 printers, a process to request a printer, there is no remaining printers, and now no one can continue to run.

3. Operation Management

1, processor scheduling can be divided into: Advanced scheduling, intermediate scheduling, low-level scheduling. All operating systems must be equipped with process scheduling (low-level scheduling).

2, in the interactive control mode, the user for the control job execution can use command language.

3, the Operation control language belongs to the offline operation control language.

4. Storage Management

1. Fixed partition: Pre-allocated main memory space is divided into several contiguous regions, each region is fixed, each region size is not necessarily equal, each partition can be loaded one and can only load one job.

2, the fixed partition is easy to implement, the overhead is small, the disadvantage is that the memory fragment can cause the space waste. The data structure used by the fixed partitioning method is a partitioned table that records the size and partition usage of the partition.

3, variable partition (dynamic partition): Memory is not pre-divided, when the job is loaded, according to the needs of the job and the use of memory space to determine whether to allocate memory.

4. The data structure used by the variable partition is the memory free block table which records the starting address and length of the free partition.

5. Comparison of sections and pagination

Fragmentation is the logical unit of information, determined by the logical structure of the source program and visible to the user. Section length can be set according to user needs, the beginning address can start from any address.

Paging is the physical unit of information, independent of the logical structure of the source program, and is not visible to the user. The page length can only begin with an integer multiple address of the page size.

6, virtual memory is an imaginary address space, but his size is not arbitrary large, in a 32-bit address length of the system, its virtual space maximum of 2^32 bytes.

7, the best adaptive algorithm of the white space is in the order of increasing size.

5. Equipment Management

1, the computer peripherals according to the characteristics of the input and output generally divided into two: first, storage-type equipment, but input.

2, the main goal of equipment management is: to provide a unified interface, user-friendly, to play the system of parallelism, improve the use of I/O equipment. To do this, Device Manager typically should have the following features:

Peripheral device interrupt processing, buffer processing, peripheral device allocation, peripheral drive scheduling, virtual appliances and their implementation.

6. Document Management

1, the File system functions:

Unified management of the storage space of the file, the implementation of storage space allocation and recycling.

Implements "Access by name" of the file.

Realize the sharing of file information and provide protection and confidentiality of files.

Provide users with a convenient interface.

system maintenance and provide relevant information to users.

Efficiency of file system execution.

Provides a unified interface to I/O.

2, the classification of documents:

Classification by file nature and use can be divided into: System files, user files and library files.

The classification by information retention period can be divided into: temporary files, permanent files and archive files.

The way files are saved can be categorized into: read-only files, read-write files, and executable files.

According to the logical structure of the file classification can be divided into: streaming files, record-type files.

By the physical structure of the file classification can be divided into: sequential (sequential) files, linked (concatenation) files, index files.

3, the establishment of document engineering:

Check the legality of the parameters, whether the file name conforms to the naming rules---"Check the same directory with the name of the file---" There is no idle location in the directory---"Fill in the contents of the directory entry: file name, user name, etc., access rights, length 0---" return

4. Open File

Any file file needs to be opened before it is used, that is, the FCB is sent to memory. The format is:

Search the directory according to the file path name, find the FCB main department---"legality of access according to open mode, shared description and user identity check---" according to the file number check system open File table, see whether the file has been opened, the words shared count plus 1, Otherwise, the main part of the FCB in the external memory is filled into the System Open File table empty table entry, the share count is set to 1---"In the user open File table to go to a blank table entry, fill in open mode, etc., and point to the System Open File table corresponding table entries.

5, the purpose of file protection is to prevent the file is stolen, there are two main methods: set the password and use the password.

6, from the user issued a file system call began to enter the file system, until access to the information on the file memory implementation, the implementation process can be broadly divided into the following levels: User interface, logical file control subsystem, File Protection subsystem, physical file control subsystem and I/O control subsystem.

7, operating system example analysis

1, UNIX is a universal, multi-user time-sharing, interactive operating system.

2, the UNIX operating system has the following characteristics:

UNIX Operating system support multi-user operation, multiple users can use the computer at the same time, the system's multi-task features greatly improve the utilization of system resources and user flexibility.

Most of the UNIX operating system code and utilities are written in C language, easy to expand, with good portability.

The UNIX operating system adopts a tree-structured file system, which is divided into basic file system and removable file volume, which has good security and sharing. Unix operating system files using a unified unformatted character stream, can be both sequential read and write files and can be random read and write, so that users can flexibly organize the contents of the file.

UNIX operating system to the common Files, directory files, external devices are processed according to the file, simplifying the system equipment, easy for users to use.

Flexible, rich system calls.

Powerful shell and rich software tools.

Operating system-related knowledge

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.