The face is a recommendation related department, the specific name forgotten;

It takes about 50 minutes for each side to finish one side after another. On the one hand, mainly around my resume of the project, one is my extracurricular practice project – simple high-performance network communication engine, the other is my internship project – a high concurrency environment of the local cache. The question that the interviewer raises is very fine, dig deeper, feel really listen very seriously! Also did two code questions, basic knowledge did not ask. The two code questions are as follows:



The first question asks you to fulfill two requirements:

1. You can control the running and termination of run externally.

2. Each time the stop function can immediately terminate the program, without sleep, to achieve a perfect exit;

The first one is relatively easy, and the second one, I said that we can use the signal to inform, but I have not used, do not know how to write. The interview suggested that you could modify the hibernation wait, so I suggested using the cv.wait_for() function of the conditional variable to CV. Notify_one () on each stop.

The second question I thought was an advanced algorithm, I said I only know the method of violence. He suggested that the complexity could be reduced by preprocessing, so he added some sorting and pruning.

I thought one side hung, but soon about two, large probability is because the project answer is good;

The second interview was serious but more serious, and began digging for details about my local cache, asking the following questions:

1. What is the query time complexity of hashMap? Does it have to be order one?

2. What is the load factor of a HashMap? Why is it set to this value?

3. Why is the hash bucket number of hashmap set to 2 ^ n -1?

4. How is the HashMap you use thread safe? How to be efficient while being thread safe? Do you know its locking range?

If the QPS is too high and multiple queries are running on the same bucket at the same time, queuing and locking will be time-consuming, which will seriously affect the performance. Open multiple hashmaps at the same time, and then hash the query into the corresponding hashmap.

6. Would you please implement this solution? (So I spent the rest of my time writing this.)

In the case of him giving me advice while I write it, the interviewer says the interview is over when the code is written;

A feeling: I feel that byte’s interview is really nice. The interviewer is very thoughtful and pays much attention to inspiring the interviewer to think and solve problems, and the seriousness is very unusual. Unlike most manufacturers, they are more focused on the ability to recite questions. I feel that I can learn a lot from an interview. After 2 face finish have no message, feel big probability to hang, however have a chance I still can again face!