Operating System Pen Questions

Source: Internet
Author: User
1. Basic Points of knowledge:
1) The operating system is a collection of programs that control and manage computer hardware and software resources and organize multiple users to share multiple resources in a reasonable and effective way.

2) Basic functions of the operating system:

(1) Processor management. Key features include process control, process scheduling, process synchronization, and process communication.

(2) memory management. Key features include memory allocation, address mapping, memory protection, and memory expansion.

(3) Equipment tube, also called I/O management. Key features include buffer management, device allocation, device-driven, and device-independent handling.

(4) Document management. The main functions include the management of file storage space, general management of file operation, directory management, file read/write management and access control.

(5) User interface management. The user interface of the operating system is the interface between the operating system and the user, including the Control interface and program interface. 3) The basic features of modern operating systems: concurrency, sharing, virtualization, asynchrony, and uncertainty.
4) The so-called interruption refers to the system occurs after an event, the CPU suspends the executing program to perform the process of processing the event, the process of handling the interrupt event is called the interrupt handler, the part that produces the interrupt signal is called the interrupt source. Interrupt processing of the specific process: Save the site, analysis of the cause, the interruption of processing procedures, recovery site.
5) The process is a program with independent function on the data set can execute concurrently the operation activity, its basic characteristics: dynamic characteristics, concurrency characteristics, independence, mutual constraints. The composition of the process: program, data, and process control blocks. There are three basic scheduling states for a process: execution state, ready state, and blocking state.
6) The introduction of the process greatly improves the utilization of resources and the throughput of the system, and the purpose of introducing threads is to reduce the system overhead of program concurrency. A process is a unit of resource allocation, and a thread is the unit of a system dispatch.

7) The so-called deadlock is a stalemate between multiple processes. Cause of Process deadlock: resource competition and process advance order is illegal.

The 4 necessary conditions of deadlock: mutual exclusion, possession wait, inalienable, loop.

Deadlock handling: Ostrich Strategy, prevention strategy, avoidance strategy, detection and release of deadlocks. 8) A critical resource is a resource that only one process is allowed to use at a time. A critical section is a program segment that operates critical resources in a process.
2. The difference between a process and a thread.

A: A thread is an execution unit within a process and a scheduled entity within a process. Differences from the process:

(1) Dispatch: The thread acts as the basic unit of dispatch and allocation, and the process as the basic unit of resources.

(2) Concurrency: Not only can concurrent execution between processes, but also concurrent execution between multiple threads of the same process.

(3) Owning a resource: a process is an independent unit that owns resources, and threads do not own system resources, but they can access resources that belong to the process.

(4) Overhead: When you create or revoke a process, the overhead of the system is significantly greater than the cost of creating or revoking a thread, because the system allocates and reclaims resources for it. 3. Network programming in the design of concurrent servers, the use of multi-process and multi-threaded, what is the difference.

Analytical:

(1) Process: A child process is a replica of the parent process. A child process obtains a replica of the parent process data space, heap, and Stack (2) Thread: Relative to the process, a thread is a concept that is closer to the execution and can share data with other threads of the process, but has its own stack space and has a separate execution sequence.

Both can improve the concurrency of the program, improve the efficiency of program operation and response time. Threads and processes have advantages and disadvantages in use: the overhead of thread execution is small, but not for resource management and protection, while the process is the opposite. At the same time, threads are suitable for running on SMP machines, while processes can be migrated across machines. A: With multiple processes, each process has its own address space, and the thread shares the address space. All the other differences come from this: (1) Speed: threads generate faster, communication between threads is fast, switching is fast, and so on, because they are in the same address space. (2) Resource utilization: The resource utilization of threads is better because they are in the same address space. (3) Synchronization problem: whether the thread needs to use a synchronization mechanism when using public variables/memory, or because they are in the same address space.
4. What kinds of process scheduling policies are common in the operating system?
Answer: FCFS (first come first service), priority, time slice rotation, multi-queue, multilevel feedback queue.
5. How inter-process communication is implemented.
A: The most common methods of interprocess communication are: signal, semaphore, message queue, shared memory, pipeline. The signal is performed using a signal processor, and the semaphore is implemented using P and V operations. Message Queuing is an advanced inter-process communication method because it can really deliver messages between processes.
6. In Windows programming, the role of mutexes (mutexes) and Critical sections (critical section) is similar, please describe the main differences between the two.
A: The difference between the two is that the mutex is opened for mutual exclusion between processes, and the critical section is mutually exclusive between threads.
7. There are several ways in which the process enters the wait state.

A: (1) The CPU is dispatched to the higher priority thread (thread), and the thread enters the waiting (wait) state.

(2) The blocked thread gets the resource or signal and enters the waiting state.

(3) In the case of time-slice rotation, if the time slice is reached, it will enter the waiting state. 8. Try to describe the typical reason for the transition between the three basic states of a process.

A. A process that is in a ready state, when the process dispatcher assigns a processor to it, the process is changed from the ready state to the execution state.

B. The current process cannot execute due to an event, such as accessing a critical resource that is already occupied, which causes the process to become blocked by the execution state.

C. The current process is paused because the event slice is exhausted, and the process is changed from the execution state to the ready state. 9. Which basic guidelines should be followed by the synchronization mechanism.
A. idle let in; b. busy waiting; c. limited wait; d. Right to wait.
10. In a single processor environment, there are several ways of communication between processes.

A. Shared memory system communication mode;

B. Message delivery system communication methods;

C. Pipeline communication mode. 11. Try comparing Message Queuing with pipeline communication mechanism.

Answer: A. The so-called pipeline, is used to connect a read process and a write process to achieve their communication between the shared file, also known as pipe file, pipeline communication is a shared storage system.

B. Message Queuing communication mechanism belongs to the message delivery system communication mechanism, there is a communication link, there is a message format, there are a number of buffer queues, the use of a unique send primitive and accept the original language. 12. In the request paging system, what kinds of page substitution algorithms are often used.

A. Best permutation algorithm; b. FIFO algorithm; c. The most recent unused LRU replacement algorithm; d.clock permutation algorithm; E. In addition, there are minimal use of permutation algorithms and page buffering algorithms.

Original: http://www.mianwww.com/html/2011/11/11917.html

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.