What did CMB ask? So awkward? Proper arrangement

Before, a small partner asked the bank’s financial technology job interview to share with you a representative interview situation of CMB. From the overall experience, the first two technical aspects are similar to most Internet company interviews. In the technical aspect, there are more questions about projects, but the questions are basically regular questions. If there is preparation in the early stage, the problems should not be big. HR asked awkwardly. .

Me

one side

On the one hand, use Niuke remote interview.

1 Introduction

Routine, personal basic interests, what do you do, what problems you encounter, how to solve it, etc., try to get closer to the job position

2 Project introduction

Project introduction, role, ask a few questions based on your project, if the interviewer is good, will ask questions on derivative projects

3 sql statement

4 Single thread and multi thread

3287f7ae7a58b82155fe5ae9fa16cee5.pngSingle thread and multi thread

ok summarizes what are the characteristics of the process thread (can not run off the interview)

  • Any one thread error in the process will cause the entire process to crash

Suppose the previous pseudo code is modified to
X=5+2
Y=8/0
Z=5*2

At this time, Y is obviously wrong. When the thread executes to Y, it will report an error. The process crashes and the other two threads have no result.

  • When a process is closed, the operating system will reclaim the resources occupied by the process

For example, we will use many good Chrome plug-ins. When the browser is started and these plug-ins are opened, memory will be occupied. When the Chrome browser is closed, the memory will be recovered.

  • Isolation of content between processes

This mechanism is to prevent multiple processes from reading and writing confusion, so communication between processes requires IPC (message queue, shared memory, etc.).

  • Sharing process data between threads

583dc71a50ed075bef50117faf025733.pngThread sharing data

From the above figure, we can know that threads 1, 2 and 3 write data to ABC respectively, and thread 2 is responsible for processing the three types of ABC reading data and displaying

Now we basically understand threads and processes. We imagine in detail, can a certain treasure-level system architecture resist such a large amount of traffic from the beginning, of course not. The monolithic architecture of the first small yellow page evolved with the complexity and diversified primary keys of the requirements.

5 How to avoid deadlock

  • First introduce what is deadlock

When two threads wait for each other to release resources, it is prone to deadlock

  • Necessary conditions for deadlock

Mutually exclusive: resources cannot be shared and can only be used by one process

Request and wait: the process has obtained some resources, but it is blocked when requesting other resources, and the currently obtained resources are not released

Non-preemption: After some processes have obtained resources, the system cannot forcibly hand-paint them, but needs to release them after they are used up

Circular waiting: Several processes form a circular chain, each of which occupies the resources requested by the other party.

Knock on the blackboard: please write a deadlock program yourself

  • Deadlock avoidance

Method 1: Avoid multiple locks. That is to avoid the same thread to lock multiple locks

Method 2: Have the same locking sequence. This means that if multiple threads lock multiple Locks, they should ensure that they request locks in the same order

Method 3: Deadlock detection. Rely on some algorithmic mechanisms to achieve deadlock prevention mechanisms

Method 4: Use time lock. It means to realize the automatic release of the lock by setting the time of the lock

6 stack implementation queue

I don’t know how many times I have encountered this topic, and I don’t know how many of you can tear it out by hand. Double stack idea is enough

7 Why do we need timewait

  1. Reliably terminate the TCP connection.

  2. Ensure that late TCP packets have enough time to be recognized and discarded. There is an article in the front that specifically introduced this problem.

8 Three handshake and four waved why four times

9 See the results of the program, the constructor

10 Know ELF? Probably talk about

Use readelf to view more detailed content and draw a picture

543bcffa12d16db4871e6bbdf8827b3f.png

11 Spin lock

It means that when a thread is acquiring a lock, if the lock has already been acquired by other threads, the thread will wait in a loop, and then continuously determine whether the lock can be acquired successfully, and will not exit the loop until the lock is acquired.

Ok, seeing here, they are all talents, Xiaolan sings a song for everyone, big brothers and sisters, happy! . . . . Not happy to hit me!

2 Two sides (50 minutes)

The two-sided technical interview started in the afternoon of the same day. The entire technical interview has a thorough question on the project. Therefore, the project written on the resume of the small partner must be thoroughly understood. Whether it is our company or other companies, it is basically inseparable from two sides. Ask the project

1 Introduction

2 Project introduction

  • Background of the project

  • what have you done

  • What's the difficulty

  • All the knowledge points of the project are asked and extended for you (very good)

3 What is a smart pointer

The smart pointer class associates a counter with the object pointed to by the class, and the reference count keeps track of how many objects of the class share the same pointer. Every time a new object of the class is created, the pointer is initialized and the reference count is set to 1; when the object is created as a copy of another object, the copy constructor copies the pointer and increments the corresponding reference count; assigns a value to an object When the assignment operator decreases the reference count of the object pointed to by the left operand (if the reference count is reduced to 0, delete the object), and increases the reference count of the object pointed to by the right operand; when the destructor is called, the constructor decreases Reference count (if the reference count decreases to 0, delete the base object). Smart pointers are classes that simulate pointer actions. All smart pointers will overload -> and * operators. Smart pointers have many other functions, and the more useful one is automatic destruction. This is mainly to use the limited scope of the stack object and the destructor of the temporary object (implemented by the limited scope) to release memory.

Other answer angles:

  • The design idea of ​​smart pointer

  • Why abandon auto_ptr

  • Why is unique_ptr better than auto_ptr

  • How to choose only pointer

4 IO-intensive and cpu-intensive

CPU-intensive types usually need to perform a large number of CPU computing tasks. At this time, it is enough to keep the number of threads and the number of CPU cores equal, otherwise more thread context switching is easy. In web system development, it is more likely to be IO operations such as database queries, and the CPU will be idle for a while.

5 Two threads print 26 letters sequentially (notification mechanism)

public class Print_letter implements Runnable{
    char ch = 97;

    @Override
    public void run() {
        while (true){
            synchronized (this){
                notify();
                try {
                    Thread.currentThread().sleep(1000);
                }catch (InterruptedException e){
                    e.printStackTrace();
                }

                if (ch < 123){
                    System.out.println(Thread.currentThread().getName() + " " + ch);
                    ch++;
                    try {
                        wait();
                    }catch (InterruptedException e){
                        e.printStackTrace();
                    }
                }
            }
        }
    }

    public static void main(String[] args) {
        Print_letter t = new Print_letter();
        Thread t1 = new Thread(t);
        Thread t2 = new Thread(t);
        t1.start();
        t2.start();
    }
}

6 The underlying implementation of map in c++, red-black tree talk about it

The key values ​​stored in the red-black tree form are ordered, and the insertion and deletion of the red-black tree can be done in O(logn).

Red-black tree in nature

  • Each node of the red-black tree is either red or black

  • The root node of the red-black tree must be black

  • All external nodes of the red-black tree are black

  • All two child nodes of the red-black tree with red nodes must be black nodes

  • The number of black nodes on the path of the red-black tree from the root to any external node is the same

Speaking of map, also talk about hashmap and treemap.

C++中unordered_map的底层是用哈希表来实现的,通过key的哈希路由到每一个桶(即数组)用来存放内容。通过key来获取value的时间复杂度就是O(1)。因为key的哈希容易碰撞,所以需要对碰撞做处理。unordered_map里的每一个数组(桶)里面存的其实是一个链表,key的哈希冲突以后会加到链表的尾部,这是再通过key获取value的时间复杂度就变成O(n),当碰撞很多的时候查询就会变慢。为了优化这个时间复杂度,map的底层就把这个链表转换成了红黑树,这样虽然插入增加了复杂度,但提高了频繁哈希碰撞时的查询效率,使查询效率变成O(log n)。

7 根据简历,hadoop spark flink区别

大数据框架。难免就会涉及到分布式集群相关的知识点。所以如果是后台开发的同学,建议至少的看几篇博客去了解下分布式相关原理和一些大数据框架原理。书籍<hadoop权威指南>最新版即可,如果是博客,可以参看厦门大学大数据实验室出的教材,理论结合实战且有代码结合

8 根据简历,为什么使用oracle数据库,为什么不用hbase或者mysql这些

简单的说就是在海量数据的处理能力上更有优势,并且在完整的存储解决方案。至于为什么不用hbase,这完全是对知识广度的考察,正好之前也用过。hbase优点

  • Hbase单表可百亿行

  • 面向列存储,支持独立检索且可以动态增加列

  • WAL机制保证数据写入的时候不会因为集群异常而导致写入数据丢失Replication机制。

10 根据简历,你的流量获取是实时的还是离线处理的

11 根据简历,kafka几个topic,有没有出现消费者消费不过来

12 根据简历。为什么使用hdfs

HDFS是一种分布式文件系统层,可对集群节点间的存储和复制进行协调。HDFS确保了无法避免的节点故障发生后数据依然可用,可将其用作数据来源,可用于存储中间态的处理结果,并可存储计算的最终结果。

13 线程池用过没,需要注意哪些事项

这里主要是考察大家对于各种连接池的理解。提前创建一定数量的连接,需要的时候直接使用即可,不用每次频繁的创建连接。常用的连接池有redis连接池,HTTP连接池等。这里会涉及到最大的连接数和最小的连接数。那么连接数的大小一般怎么控制?

  • 当前连接数小于最小连接数,那么就创建连接

  • 如果连接池有空闲则复用

  • 如果此时当前连接数大于最大连接数,考虑设置超市等待,异常处理

14 说一下什么是缓冲区溢出

缓冲区溢出是指当计算机向缓冲区内填充数据时超过了缓冲区本身的容量,溢出的数据覆盖在合法数据上。

  危害:在当前网络与分布式系统安全中,被广泛利用的50%以上都是缓冲区溢出,其中最著名的例子是1988年利用fingerd漏洞的蠕虫。而缓冲区溢出中,最为危险的是堆栈溢出,因为***者可以利用堆栈溢出,在函数返回时改变返回程序的地址,让其跳转到任意地址,带来的危害一种是程序崩溃导致拒绝服务,另外一种就是跳转并且执行一段恶意代码,比如得到shell,然后为所欲为。通过往程序的缓冲区写超出其长度的内容,造成缓冲区的溢出,从而破坏程序的堆栈,使程序转而执行其它指令,以达到***的目的。

  造成缓冲区溢出的主原因是程序中没有仔细检查用户输入的参数。

15  线程绑核了解不

16 sql语句

17 你还有什么问题?

18 后续有同事联系你

3 三面hr面

1 自我介绍

2 独生子?他们在哪里工作,是做什么的

3  对公司的期许

4 未来的规划

5 本科成绩如何,硕士成绩如何 担任过班干部?拿过奖学金?

6 拿了几个offer了,为什么不去,为什么选择面试我们

7 对于公司比较在意哪几个方面

8 有女朋友吗,在哪里工作

9 能简单介绍项目吗

10 课余在哪里学习技术

11怎么看待薪水和加班

12 有什么需要问我的吗

  • 公司有入职培训吗,培训地点是统一的还是各个分中心(反问我,你希望的是怎么样的)

以上问题的顺序可能不对,二面面试官帅气,三面面试官漂亮。接下来的小伙伴加油!

4 知识复盘

  • 网络编程------Linux高性能服务器编程(游双)

  • Operating system------Linux kernel design and implementation

  • Back-end development-core technology and practice of back-end development

  • Algorithm------Sword refers to offer+leetcode100


Guess you like

Origin blog.51cto.com/14984904/2545757