"Operating system common knowledge Summary"-turn

Source: Internet
Author: User

1, process is the execution process of the program in the concurrency process

2. Characteristics of the process: structural characteristics dynamic concurrency Independence asynchrony

3. Critical section refers to the code that accesses critical resources in each process

4, the basic unit of application resources in the operating system is the process, in the CPU is the basic unit of execution is a thread , process is composed of program segment, data segment, PCB

5, the critical resources should be mutually exclusive access to achieve sharing

6,P.V operation is a low-level process communication primitive

7, for the recorded signal volume, in the execution of a p operation, the value of the semaphore should be reduced by 1, when its value is less than 0 o'clock the process should be blocked , when the V operation, the value of the semaphore should be added 1, when its value is less or equal to 0 o'clock, should wake up the process in the blocking queue .

8,n a process to share a critical resource, (n-1) to

9, short job first algorithm, T1<T2<T3 average turnaround time is: T1+2XT2/3+T3/3

10, response than rp= (wait time + request service time)/Request Server time = response Time/Request Service time

11 thinking refers to the process of multiple processes in the course of contention for resources, resulting in an impasse, when the process is in such a state of deadlock, if there is no external force, they will no longer move forward.

The avoidance of deadlocks is based on preventing the system from entering an unsafe state.

the root cause of deadlocks is the improper allocation of resources and insufficient resources , and the four prerequisites for deadlocks are: mutex conditions, request and hold conditions, non-deprivation conditions, and loop-waiting conditions , which the banker algorithm uses to avoid deadlocks

12, if there are N processes in the system, up to (N-1)

13, if the system uses the rotation method to dispatch the process system to adopt the deprivation type dispatch

the scheduling algorithm, which considers both job waiting time and job execution time, is the response-priority scheduling algorithm.

15, the orderly allocation strategy of resources can break the deadlock "loop Wait"

16, not all unsafe states will inevitably turn to a deadlock state, but when the system is not safe to enter the state after the status of the possibility of entering the deadlock state,

17, Relocation: The logical address used in the job address space becomes the physical address of the memory

18, support program placed in discontinuous memory storage management method has the sub-allocation, the segmented allocation, the section page allocation page type storage main characteristic is does not have the job all simultaneously to load the continuous area of main memory

19, suitable for multi-channel program operation of the storage management, storage protection is to prevent the interference of each operation

20, when using page-based storage management, relocation of the work by the address converter

The address Image table in the section-page storage Management is a table of each job or process, one page table per segment

22, in the virtual page Storage Management scenario, the task of paging the page into memory is to handle

23, the main difference between segmented management and paging management is that paging management has storage protection, and segmented management does not

24, in the unit underestimated partition allocation, can be different but the pre-fixed

The I/O control mode that does not use interrupt mechanism is the program I/O mode

26,spooling technology enables exclusive devices to be transformed into virtual devices that can be shared

disk anti-counterfeiting in the data from the disk read, called the transmission time

28, shared devices are devices that are concurrently accessed by multiple processes running at the same time

29, through the function of the software expansion, the original exclusive device love caused by a number of shareable devices, virtual equipment

30,DMA mode if I/O device does not complete by CPU

31, the device Independence User program is independent of a specific physical device characteristics

32, a virtual appliance transforms a physical device into multiple corresponding logical devices

33, channel is a special processor, the channel is divided into the way of transmitting data: Byte multichannel, array selection channel, array multichannel

The data structures involved in the channel are device controller, controller control block, channel control block, System equipment table

34, disk cache is set in memory to increase I/O disk speed

35, the disk space address has the disk number, the cylinder number, the sector area code composition. The time to access the disk has seek time, rotation wait time, read and write Time

36, the operation of the system segment with parameters translated into device Operations command is done by the device-independent operating system

37, write control command to device register is done by device driver

38, find device driver is done by device independent operating system software

39, device management functions are device allocation, buffer management and implementation of physical I/O device operations

40, according to the intrinsic characteristics of the device, the device can be divided into exclusive devices, shared devices and virtual equipment

41, the introduction of buffer technology can improve the processor execution program and device input and output operation of the parallel program file management

The organization of physical files is determined by the operating system , and the sequential access of files is accessed by the logical number of the files.

43, the system through the tree-type directory structure to solve the problem of duplicate name

in Unix operating systems, input is considered a special file .

45, the main task of opening the file operation is to copy the specified directory to the memory specified area

46, the file pathname refers to the collection of symbol names from the root directory to the path that the file is experiencing

47, according to the logical structure, the file has two main categories: records are files, streaming files, the main purpose of the file system is to achieve the name of the file access

48 Continuous structure files must be in a continuous distribution mode, and the link structure file and index structure file can take the discrete allocation method

49, file system, if the physical structure of the file uses continuous structure information about the physical location of the file including the first block address and file length

50, bit diagram can be used for disk space management, in the file system, for file Protection, generally use password, password and access control                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     

1, the process is a separate function program on a data set on a single execution process . A thread is an execution entity or an execution unit within a process .

The difference between a process and a thread:

(a) The address space of the different processes is independent, while threads within the same process share the same address space. The thread of one process is not visible within another process.

(b) In the threading operating system, the process is the unit of resource allocation and dispatch, the thread is the unit of dispatch and allocation of the processor, the resource is allocated to the process, and the thread has very little resources, so the switching cost is lower than the process switching.

2. deadlock in a multi-channel program system , the system is in a deadlock state when each process in a set of processes waits indefinitely for a resource that is occupied by another process in the reorganization process and is never freed .

Causes of deadlocks:

(a) limited resources provided by the system;

(b) Improper sequencing of processes.

Necessary conditions for deadlock: Mutually exclusive condition, inalienable condition, request and hold condition, cyclic wait condition

3. Perform the following sequence of access page numbers: 1,2,3,4,1,2,5,1,2,3,4,5 Test Description adopts Advanced (1) fifo:9 (2) lru:10 times (3) Opt:7 times

4, what is the basic function of the operating system?

1. Processor management. In the case of multi-channel program or multi-user, to organize multiple jobs at the same time, it is necessary to solve the problem of scheduling strategy, allocation implementation and resource recovery of processor allocation.

2. Storage Management. The primary task of storage management is to allocate, protect, and expand and manage internal storage.

3. Device Management. involves the allocation and management of channels, controllers, input, and device independence.

4. Information management (file System Management) is the management of the software resources of the system.

5. User interface. The operating system also provides users with a user-friendly interface. In general, the operating system provides two ways of interfacing to serve the user.

5, grading scheduling is divided into 4 levels:

(1) Job scheduling

(2) Switching schedule

(3) Process scheduling

(4) Thread scheduling.

6. Try to write the difference between program and process

(1) A process is a dynamic concept, and a program is a static concept.

(2) The process has parallel features, and the program does not reflect execution so there is no parallel feature

(3) The process is the basic unit of competition for computer system resources, and the procedure does not reflect the implementation will not compete computer system resources

(4) Different processes can contain the same program, as long as the program corresponds to a different set of data.

7. What is the basic principle of page-style management?

(1) The virtual space of the process is divided into pages of equal length.

(2) The memory space is also divided into pages of equal length according to the size of the page.

(3) Using the request paging or pre-tuning technology to achieve unified management of internal and external memory.

8. What are the functions of process scheduling?

(1) record the execution of all processes in the system.

(2) The process of selecting the possessive processor

(3) Process context switch

9. What are the characteristics of batch processing operating system, time-sharing operating system and RTOs?

(1) Batch processing operating system features: batch processing, high system throughput, high resource utilization, users can not directly interfere with the execution of the job.

(2) The characteristics of time-sharing operating system: Multi-path, independence, timeliness and interactivity.

(3) Real-time operating system features: timely response, rapid processing, high reliability and security, does not require system resource utilization.

10. How is the memory under Windows managed?

Windows provides 3 ways to manage Memory: virtual memory, which is best used to manage large objects or arrays of structures, and memory-mapped files that are best used to manage large data streams (typically from files) and to share data between multiple processes running on a single computer; memory stacks, Ideal for managing large numbers of small objects.

Windows manipulates memory in two layers: physical memory and virtual memory.

Where physical memory is managed by the system and does not allow direct application access, only one 2G address space is visible to the application, and memory allocations are made through the heap. For each process has its own default heap, when a heap is created, the corresponding size of the address block is preserved through virtual memory operations (the system consumes very little of the actual memory). When allocating a piece of memory on the heap, the system finds a free block in the Address table of the heap (if it is not found, and the heap creation attribute is extensible, the heap size is expanded), and the physical object (on physical memory or on the swap file of the hard disk) is submitted for all memory pages contained in the free block. Upon submission, the system will uniformly allocate memory for all processes, and if there is insufficient physical memory, the system attempts to place a portion of the process temporarily inaccessible to the swap file to free up some of the physical memory. When memory is freed, only the page that resides in the heap is unblocked (the corresponding physical object is dismissed), and the address space continues to be preserved.

If you want to know if an address is occupied/can be accessed, simply query the virtual memory state of this address. If it is a commit, you can access it. If it is reserved, or not retained, a software exception is generated. In addition, some memory pages can set various properties. If it is read-only, writing to memory also produces a software exception.

11, Windows message scheduling mechanism is (C)

A) instruction queue; B) instruction stack; C) message queue; D) message stack

Analytical:

The order in which message queues are processed. First of all, Windows is not processed in the order of first in and out of the queue, but with a certain priority. The priority is implemented through the status flags of the message queue. First, the highest priority is the message (via SendMessage) that other lines Cheng over, followed by processing the enlistment message queue message, processing the QS_QUIT flag again, processing the virtual input queue, processing WM_PAINT, and finally Wm_timer.

12. Describe the basic characteristics of real-time system

Achieve specific tasks, real-time and reliability, in a specific time period.

The so-called "real-time operating system", in fact, refers to the operating system, its various resources can be dynamically allocated as needed. Because various resources can be dynamically allocated, their ability to process transactions is stronger and faster.

13. features of interrupts and polling

The way the program polls the I/O devices is a way to manage the I/O devices of the early computer system. It periodically turns to all kinds of equipment and asks if there are any processing requirements. After a turn of inquiry, if requested, it will be dealt with. After processing the I/O device requirements, the processing machine returns to work. Although polling takes time, polling is much faster than I/O devices, so there is generally no problem that cannot be handled in a timely manner. Of course, there is a limit to the number of input that can be dealt with faster processors. And, after all, the program polling takes up a considerable portion of CPU processing time, so program polling is a less efficient way, and is rarely used in modern computer systems.

program interruption is usually referred to as interruption, refers to the CPU in the normal operation of the process, due to pre-arranged or occur a variety of random internal or external events, so that the CPU interrupts the running program, and go to the response of the service program to deal with.

Polling-low efficiency, long wait time, not high CPU utilization.

Interrupt--Easy to miss some problems, high CPU utilization.

14. What is a critical section ? How to resolve conflicts ?

  The program that accesses critical resources in each process is called a critical section, allowing only one process to enter the critical section at a time , and not allowing other processes to enter.

(1) If a number of processes require access to an idle critical section, only one process is allowed to enter at a time;

(2) At any time, no more than one process is in the critical area. If a process has entered its own critical section, all other processes attempting to enter the critical area must wait;

(3) The process of entering the critical area should be exited within a limited time so that other processes can enter their critical areas in time;

(4) If the process does not enter its own critical section, you should give up the CPU, to avoid the process "busy" phenomenon.

15, talk about the sub - paragraph and paging

Page is the physical unit of information, paging is for the realization of discrete distribution, to reduce the amount of memory, increase the utilization of memory, or paging is simply due to the need for system management, not the needs of users.

A segment is a logical unit of information that contains a set of information that is relatively complete in its meaning. The purpose of segmentation is to be able to better meet the needs of users.

The size of the page is fixed and determined by the system, the logical address is divided into page number and in-page address two parts, is implemented by the machine hardware, so that a system can only have one size of the page. The length of the segment is not fixed, it is decided by the user to write the program, usually by the editor in the source program editing, according to the nature of the information to be divided.

Paging Job address space is one-dimensional, that is, a single linear space, programmers only need to use a memory, can represent an address. The job address space of the segment is two-dimensional, when the programmer identifies an address, it needs to give both the segment name and the address in the paragraph.

16. Say what you know about how to keep the process in sync ?

The main methods of inter-process synchronization are atomic operation, semaphore mechanism, spin lock, enhancement, rendezvous, distributed system and so on.

17. Commands commonly used in Linux

Show file directory command ls as LS

Change the current directory command CD such as Cd/home

Create subdirectories mkdir such as mkdir Xiong

Delete subdirectories command rmdir such as Rmdir/mnt/cdrom

Delete File command rm like Rm/ucdos.bat

File copy command CP such as Cp/ucdos/fox

Get help info command man like man ls

Displays the contents of the file less MWM.LX

Redirect and pipe type such as type Readme>>direct, append the contents of the file Readme to the text direct

18. What are the properties of Linux files? (Total 10 people)

-rw-r--r--that is the permission symbol, the total is----------these few bits.

The first short horizontal is the file type identifier:-Represents a normal file, C denotes a character device (character), B represents a block device (blocks), D represents a directory (directory), and L represents a linked file (link) , followed by the first three consecutive short Shan user rights bit (user), the second three consecutive short Shan group permission bit (group), the third three consecutive short Shan other permission bits (other). Each permission bit has three permissions, R (Read permission), W (Write permission), and X (Execute permission). If each permission bit has permission to exist, then the full permission is:-rwxrwxrwx; If the permissions are empty----------。

The permissions can be set with the chmod command, with the format bit: chmod ugoa+/-/=rwx filename/directory. For example:

A file AAA has full NULL permissions----------。

chmod U+RW aaa (to set read and write permissions to user permission bits, whose permissions are expressed as:-rw-------)

chmod g+r aaa (Set the permissions for the group to be readable and its permissions expressed as:----r-----)

chmod UGO+RW aaa (for users, groups, other users or groups to set permissions for read-write, permissions expressed as:-rw-rw-rw-)

If AAA has full permissions-rwx rwx rwx.

chmod u-x aaa (remove user-executable permissions, rights expressed as:-rw-rwx rwx)

If you want to give the AAA permission to set-rwx r-x r-x, the command is:

chmod U=rwx,go=rx AAA

19, the physical layer of the OSI Layer1, link layer Layer2, Network layer Layer3 task.

Network layer: Select the most appropriate path for the message or packet through the communication subnet through the routing algorithm.

Link layer: Through a variety of control protocols, the error of the physical channel into error-free, can reliably transmit data frame data link.

Physical layer: The transmission medium is used to provide the physical connection to the data link layer, which realizes the transparent transmission of the bit stream.

20. What is interruption ? What does the CPU do when it interrupts ?

Interrupts are any unusual or unexpected processing events occurring within the system during the execution of the computer, causing the CPU to temporarily interrupt the currently executing program and go to execute the appropriate event handler. The process of executing or scheduling a new process is returned at the end of the pending processing.

21. Do you know the contents of the operating system are divided into several pieces ? What is virtual memory ? What 's his relationship with main memory ? does memory management belong to the contents of the operating system ?

The main components of the operating system: process and thread management, storage management, device management, file management. Virtual memory is some system page files, stored on disk, each system page file size is 4K, physical memory is also paged, each page size is 4K, so that virtual page files and physical memory pages can correspond, in fact, virtual memory is used for physical memory of the temporary storage disk space. Page files are memory pages, physical memory is called a physical page, the page file on disk is called Virtual page, physical page + virtual page is the sum of all the page files used by the system.

22. does the thread have the same stack ? does the DLL have a separate stack ?

Each thread has its own stack.

Does the DLL have a separate stack? The question is not answered, or whether the question itself is problematic. Because the code in the DLL is executed by some threads, only the thread owns the stack. If the code in the DLL is called by a thread in the EXE, does this mean that the DLL does not have a separate stack? If the code in the DLL is executed by a thread created by the DLL itself, does it say that the DLL has a separate stack?

The above is the stack, if for the heap, each DLL has its own heap, so if it is dynamically allocated from the DLL memory, preferably removed from the DLL, if you allocate memory from the DLL, and then in the EXE, or another DLL to delete, it is likely to cause the program to crash.

23. What is buffer overflow ? What's the harm ? What is the reason ?

A buffer overflow is when the computer fills the buffer with data that exceeds the capacity of the buffer itself, and the overflow data is overwritten with legitimate data.

Hazard: In the current network and Distributed system security, the widespread use of more than 50% is buffer overflow, the most famous example is the 1988 exploit the Fingerd vulnerability of the worm. In the buffer overflow, the most dangerous is the stack overflow, because the intruder can take advantage of the stack overflow, when the function returns to change the address of the return program, let it jump to any address, the harm one is the program crashes caused by the denial of service, the other is to jump and execute a piece of malicious code, such as getting the shell, Then do whatever you have. By writing content beyond its length to the program's buffer, the buffer overflows, thereby destroying the program's stack and allowing the program to execute other instructions in order to achieve the purpose of the attack.

The main reason for the buffer overflow is that the user input parameters are not carefully checked in the program.

24. What is a deadlock ? What are the conditions ? How to avoid deadlocks?

The concept of deadlock: in two or more concurrent processes, if each process holds a resource and waits for another process to release it or the resources that they now maintain, it cannot advance until this state is changed, saying that the set of processes has a deadlock. In layman's terms, it is a state in which two or more processes are blocked indefinitely and wait for each other.

The main causes of deadlocks are:

(1) Insufficient system resources;

(2) The sequence of progress is illegal.

The necessary conditions for creating a deadlock:

(1) Mutual exclusion (mutualexclusion), a resource can only be used by one process at a time;

(2) cannot seize (nopreemption), the process has obtained the resources, before the use of the end, can not forcibly deprived;

(3) Occupy and Wait (hold andwait), when a process is blocked by a request for resources, the acquired resources are kept in place;

(4) Annular Waiting (circularwait), a kind of cyclic waiting resource relationship between several processes is formed.

These four conditions are necessary for the deadlock, as long as the system has a deadlock, these conditions must be established, and as long as one of the above conditions is not satisfied, there will be no deadlock.

Deadlock and prevention: Understanding the cause of deadlocks, especially the four necessary conditions that generate deadlocks, can be avoided, prevented, and unlocked in the greatest possible way. Therefore, in the system design, process scheduling and other aspects of how to not let these four necessary conditions to set up, how to determine the rational allocation of resources algorithm, to avoid the process of permanent occupation of system resources. Also, prevent the process from consuming resources while it is in a wait state. Therefore, the allocation of resources should be given reasonable planning.

Deadlock processing strategy: Ostrich strategy, prevention strategy, avoidance strategy, detection and recovery strategy.

"Operating system common knowledge Summary"-turn

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.