-
Notifications
You must be signed in to change notification settings - Fork 2
/
other.txt
49 lines (31 loc) · 1.64 KB
/
other.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---其他相关面试问题汇总---
// 编译 运行
1、程序使用 make -j n 编译后运行出错,不用 -j 参数 程序运行正常,尝试分析下可能的原因
2、gcc 编译多线程程序时 -lpthread 和 -pthread 有什么不同?
// shell & bash
1、shell 脚本中以 #!/bin/bash 开头 和 #!/usr/bin/env bash 开头有什么不同?需要考虑什么情况?
(tips:主要是有的发行版可能不适用bash作为默认sh)
2、shell中的 set -x有什么作用?
(tips:打印出每个命令的执行结果)
3、shell中的 set -e有什么作用?
(tips:当程序执行遇到错误时,停止执行)
4、shell函数中的local有什么作用?
5、怎样将stdou和stderr同时重定向到某文件?
(tips: &> )
6、pip 的安装方式 curl https://boostrap.pypa.io/2.6/get-pip.py | python
7、shell中怎样进行字符串前缀匹配?
(tips: [[ $STR == "test*" ]] )
8、shell 中字符串比较大小?
(tips:和上面一样,使用 [[ a > b ]] 来进行比较)
9、Makefile中的 ?= 表示变量如果没有定义,那么进行声明加初始化操作,这里和Go语言的 := 很像
// CPU
1、现代处理器上每秒执行的指令数和什么相关?
(tips:假设CPU主频为 1G HZ,那么一个时钟周期为1纳秒,执行一条指令一般需要
一个到多个时钟周期。
具体执行中,需要考虑CPU的指令预取,多发射,乱序执行,
以及流水线中的stall)
// 其他
1、MB 和 MiB 这两个单位有什么区别?
(tips:MiB单位以 1024 为基准,MB单位以1000为基准
1 KiB = 1024 Bytes
1 KB = 1000 Bytes)