Operating System interview questions

Source: Internet
Author: User

Microsoft Asia Technical Center interview questions !!!
1. Differences between processes and threads.
A thread is an execution unit in a process and a schedulable entity in the process.
Differences from processes:
(1) scheduling: A thread is the basic unit of scheduling and allocation, and a process is the basic unit of resource ownership.
(2) concurrency: not only can concurrent execution be performed between processes, but also between multiple threads of the same process.
(3) Owning resources: a process is an independent unit of resources. A thread does not own system resources, but can access resources belonging to a process.
(4) system overhead: when a process is created or withdrawn, because the system allocates and recycles resources for it, the overhead of the system is significantly greater than the overhead when a thread is created or withdrawn.

 

In network programming, a concurrent server is designed to use multiple processes and multiple threads. What is the difference?
1. Process: The child process is a replica of the parent process. The child process obtains copies of the data space, heap, and stack of the parent process.
2. Thread: A thread is a concept closer to the execution body than a process. It can share data with other threads of the same process, but has its own stack space, it has an independent execution sequence.
Both of them can increase the concurrency of the program and improve the program running efficiency and response time.
The use of threads and processes has their own advantages and disadvantages: the thread execution overhead is small, but it is not conducive to resource management and protection. The process is the opposite. At the same time, threads are suitable for running on SMP machines, while processes can be migrated across machines.

 

6. List the synchronization mechanisms of several processes and compare their advantages and disadvantages.
Atomic operation
Semaphore mechanism
Spin lock
Management, integration, Distributed System

7. Communication between processes
Shared Storage System
Message Transmission System
Pipelines: Based on file systems
11. Cause of process deadlock
Illegal resource competition and process Promotion order
12. Four Conditions for deadlock
Mutual Exclusion, request persistence, non-deprivation, loop
13. deadlock handling
Ostrich policy, prevention policy, avoidance policy, detection and deadlock Removal
15. What are the Process Scheduling Policies in the operating system?
FCFS (service first), priority, time slice rotation, multi-level feedback

 

6. List the synchronization mechanisms of several processes and compare their advantages and disadvantages.
Atomic operation
Semaphore mechanism
Spin lock
Management, integration, Distributed System

7. Communication between processes
Shared Storage System
Message Transmission System
Pipelines: Based on file systems
11. Cause of process deadlock
Illegal resource competition and process Promotion order
12. Four Conditions for deadlock
Mutual Exclusion, request persistence, non-deprivation, loop
13. deadlock handling
Ostrich policy, prevention policy, avoidance policy, detection and deadlock Removal
15. What are the Process Scheduling Policies in the operating system?
FCFS (service first), priority, time slice rotation, multi-level feedback

 

Interview question: What is the difference and connection between a thread and a process? Does a thread have the same stack? Does the DLL have an independent stack?
The process is dead, but only a collection of resources. Real program execution is completed by threads. When the program starts, the operating system creates a main thread for you.

Each thread has its own stack.
Whether there is an independent stack in the DLL. This question is hard to answer, or whether the question itself has a problem. Because the code in the DLL is executed by some threads, only the thread has a stack. If the code in the DLL is called by the thread in the EXE, does it mean that the DLL does not have its own stack? If the DLL code is executed by a thread created by the DLL itself, does the DLL have an independent stack?

The above is about the stack. For the heap, if each dll has its own heap, it is best to delete it from the DLL if it is dynamically allocated from the DLL, if you allocate memory from the DLL and delete it in the EXE or another DLL, it is very likely that the program will crash.

 

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.