. Net developer interview questions-Multithreading

Source: Internet
Author: User
Tags net thread

Recently many people in the garden talked about the recruitment interview, especially the problem of multithreading many times. multithreading is also a question I like to ask during the interview. I would like to share it with you (only. Net)

 

Why do you like to ask this question during the interview?

Because this is a good understanding of the depth of the subject knowledge, in the context of modern CPU is multi-core, multithreading as a technology that can make full use of CPU resources is more and more widely used.

In addition, this problem can be distinguished by common application developers (add, delete, modify, and query) and those with a certain degree of technical depth/expertise.

(In addition, I have never eaten pork. I have never seen a pig run. This is a little strange)

 

Background:

Interview with. Net senior and middle-level software engineers/architects (I may not know the target level of the other Party in advance. I should confirm during this interview that multithreading is not a prerequisite for junior/intermediate developers)

(Different people may not have the same understanding of the same position. The definition on my side is the same as that on my previous blog. http://www.cnblogs.com/PurpleTide/archive/2012/05/16/2502547.html)

This is just a question for a technical interview. It is not a complete interview, and this question is not mandatory. If the interviewer is not good at this aspect, he may not ask it at all.

This is just a simple technical interview question, just like "What are the differences between interfaces and abstract classes". I just want to confirm the technical foundation, experience, expression and communication skills of the other party, analyze scenarios and explore user needs.

 

The following is my general interview process (not all, but 60% will be listed below. All questions are not fixed and will be arranged based on the situation of the other party)

 

1. Do you know multithreading?

A. Understand (briefly describe the requirements, and select one of 2, 3, and 4 in the level and direction of the answer)

B Does not understand (Conclusion 1)

2. Briefly describe the thread pool and Use Cases

A accurately describes the significance and application scenarios of the thread pool, and provides an in-depth introduction to the thread resource consumption. [it is best to list a variety of similar designs for comparison] (to issue 4)

B accurately describedPoolAnd can describe the corresponding use scenarios. For example, many short-term operations will use the thread pool to avoid the thread resource consumption (to problem 3)

C can describe the application scenario, but cannot explain the cause systematically (Conclusion 2)

D can introduce the thread pool systematically, but cannot describe the Application Scenario (Conclusion 0)

3. Describe the meaning of multithreading and introduce when to use multithreading.

A can accurately describe the meaning and advantages and disadvantages, such as [performance, logical independence, extra performance consumption, thread scheduling and Switching] (to question 4, it seems that the technical details/bottom is good, continue to ask technical details)

B can describe a scenario that uses multiple threads accurately, but cannot systematically describe the meaning of multiple threads (to question 5, would you like to know if this scenario is actually designed and solved by him, or is it just one of the developers)

C. I can't say anything, or I can't come up with an idea (Conclusion 2)

4. describe several commonly used multi-thread synchronization methods and introduce the applicable scenarios based on your experience. 

A Can't Say Anything (Conclusion 0/2 is too strange. The previous problem is back-to-back? Synchronization cannot be implemented here)

B knows the lock keyword, and others do not understand (Conclusion 2)

C knows the lock autoresetevent semaphores and other common Synchronization Methods in. net. Occasionally, it can be said that cross-process synchronization (Conclusion 3 -)

D. Know all common synchronization methods such as the spinlock monitor event. I know that some methods are suitable for some scenarios, but I can't tell the reason (to Problem 5 or conclusion 3)

E know the user mode and kernel mode. have some details about the two, understand the resources held by a thread, and describe the differences and use cases of different Synchronization Methods, introduce the internal principle of Monitor (Conclusion 4 or problem 5)

5. Introduce why multithreading is used in the design based on your project and why this solution is selected.

A has no specific use cases (Conclusion 0/2/3)

B can introduce the application scenario from a certain angle and express why this scenario was used at the beginning (to conclusion 3)

C, as a member of the team, has participated in a large project, so there is a very suitable use scenario, but I have only talked about pig and I have not eaten pig (Conclusion 3)

D. He can systematically describe and introduce some suitable application scenarios, and introduce why he used this design based on his project experience, at the same time, we can also propose optimization suggestions so that we can do better (Conclusion 4) [we may propose a scenario for him to design the site based on his experience]

 

Preliminary conclusion 0: this person may have prepared an interview question in advance, or has been introduced by others, but he has never used it. Next I will ask him about other technical problems (especially the details ), are you sure you want him to brag?

Preliminary conclusion 1: capability <= intermediate developers [I have never eaten pork. I 'd like to see Pig]

Preliminary conclusion 2: The capability is near the intermediate developer. [I have had a lot of practical experience, but I don't know why, but I don't know why.]

Preliminary conclusion 3: The capabilities are between intermediate developers and senior developers. [I know something, but I don't know more details. The tasks explained by others can be completed smoothly, however, it is a little difficult to do well. You need the architect to help control the design.]

Conclusion 4: The capability is between senior developers and architects. [I have a deep understanding of multithreading and can select a suitable solution when designing the architecture, ability to systematically describe the meaning of multithreading and provide technical support to other team members]

 

All conclusions are not fixed. Generally, some questions are added, or the interviewer is allowed to ask questions freely. I hope the interviewer can fully show his technical skills at this point.

Some technical details that may be asked: (if you have mentioned above, you will not ask)

1. If you are a leader/manager, how can you solve the multi-thread bug in the product (your team members may be very general and may write some bugs)

2. Io thread and worker thread (window and. Net)

3. Background thread and foreground thread

4. stackoverflow troubleshooting (querying the thread stack)

5. Thread Pool configuration and impact scope (whether to optimize. NET applications through configuration)ProgramPerformance)

6. Have you run debug for multi-threaded programs?

How to troubleshoot the root cause of CPU 100% in a process (assuming it only appears in the production environment)

How to handle unexpected data

8. Do you know about TLS Thread Local Storage (callcontext may be asked)

9. In the classic case, the scheduled task is executed every minute, using thread + while (true) or timer

10. Resource Consumption of A. Net thread

11. Similarities and Differences between. NET and window threads

12 performance differences between several common concepts

13 Asp.net thread mechanism and some key configurations

14. Some common multi-threaded design scenarios such as thread1-queue-theads

15 What are the relationships and differences between multithreading and Asynchronization?

 

This article describes some of my favorite multithreading problems to determine whether the interviewer has sufficient capabilities and technical depth.

By the way, let's see if he has the ability to analyze and solve problems systematically and have enough knowledge. By the way, let's take a look at the experience and knowledge system of the interviewer.

In addition, so many descriptions test the other party's ability to express and communicate (this is an important capability of the architect)

Of course, there must be omissions, deficiencies, or misjudgments .. please discuss them together.

 

Additional information (thanks for your comments)

1. this is not a complete interview. The complete interview is more about checking whether the interviewer is suitable for the position of our company. It includes personality, problem-solving ability, learning ability, and teamwork, current technical level

This is just a technical detail,Many people comment on how the interview should be... that is the entire interview process, rather than a specific interview question and process. This question only looks at the interviewer's technical foundation, experience, communication and presentation skills, and problem analysis skills, there is also whether the real scenario can be mined with feedback.

2. the range of the target position is relatively large. It depends on the interviewer's ability/answer to give him a suitable position. Most people generally answer questions for 2 or 3 minutes, so he has nothing to say ......(Most people who only answer questions for a few minutes can't dig too many things)

3. The senior positions we have previously recruited have some requirements for high performance/architecture design, while multithreading is very important in this field.

4. this is just a simple technical question, and there is nothing to answer. After all, not everyone has done multithreading before; everyone has their own direction. but if I am a senior engineer who doesn't know multithreading, I can't say that ....

5.This is just a question/link in the interview. Generally, the weight is no more than 10%. It is impossible to make hire decisions with only a slightly biased technical question.

 

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.