本段 690 题 | 来源:fullstack + general + design | 知识点:操作系统与网络
1. 计算机网络(Computer Network)工作原理(Working Principle)。
- 知识点: 操作系统与网络 (主题: networking;标签: 网络原理)
- 类型: technical | 难度: easy | 子类型:
- 分类: general
- id: 6965b95fa9243c30c8824d25 | 官方: 是 | 付费: 否
答案:
答案将分散的机器(Machine)通过数据通信(Data Communication)原理连接起来,实现共享(Sharing)!
2. Java 中 ++ 操作符是线程安全的吗?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency;标签: ++, race condition, non-atomic)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965dbd6fa809e6d38860d5b | 官方: 是 | 付费: 否
答案:
答案不是线程安全(thread-safe)的操作。它涉及到多个指令,如读取变量值,增加,然后存储回内存,这个过程可能会出现多个线程交差。
3. int 和 Integer 哪个会占用更多的内存?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, data-types;标签: int, Integer, memory)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965dcf6fa809e6d3886328f | 官方: 是 | 付费: 否
答案:
答案Integer 对象会占用更多的内存。Integer 是一个对象,需要存储对象的元数据。但是 int 是一个原始类型(primitive type)的数据,所以占用的空间更少。
4. 解释 Java 堆空间(heap space)及 GC?
- 知识点: 操作系统与网络 / 算法与数据结构 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, jvm, gc;标签: heap, GC, memory allocation)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965dcf6fa809e6d388632c8 | 官方: 是 | 付费: 否
答案:
答案当通过 Java 命令启动 Java 进程的时候,会为它分配内存。内存的一部分用于创建堆空间(heap space),当程序中创建对象的时候,就从对空间中分配内存。GC 是 JVM 内部的一个进程,回收无效对象的内存用于将来的分配。
5. TCP 协议与 UDP 协议有什么区别?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: networking, tcp, udp, java;标签: TCP, UDP, reliability, latency)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965de58fa809e6d388650fc | 官方: 是 | 付费: 否
答案:
答案在题目中没有提供答案,因此这里给出一个通用回答:TCP 是面向连接、可靠传输的协议,提供有序交付、重传、流量控制与拥塞控制;UDP 是无连接、尽力而为的协议,不保证可靠性与顺序,开销更小、延迟更低,常用于实时音视频、游戏、DNS 等场景。
6. Java 中,ByteBuffer 与 StringBuffer 有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, nio, strings;标签: ByteBuffer, StringBuffer, NIO, thread-safe)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965de58fa809e6d38865100 | 官方: 是 | 付费: 否
答案:
答案在题目中没有提供答案,因此这里给出一个通用回答:ByteBuffer 是 NIO 的字节缓冲区,用于处理二进制数据与 I/O 读写;StringBuffer 是可变字符串类(线程安全(thread-safe),方法多为 synchronized),用于字符串拼接与修改。两者用途不同:一个偏底层字节与通道/文件/网络 IO,一个偏文本字符串处理。
7. heap和stack有什么区别。
- 知识点: 操作系统与网络 / 算法与数据结构 / 编程语言基础 (主题: java, memory;标签: Heap, Stack)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965e772fa809e6d388763a5 | 官方: 是 | 付费: 否
答案:
答案栈(stack)是一种线形集合,其添加和删除元素的操作应在同一段完成。栈按照后进先出(LIFO)的方式进行处理。
堆(heap)是栈的一个组成元素
8. GC是什么? 为什么要有GC?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, jvm, gc;标签: GC, Garbage Collection, Memory)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965e772fa809e6d388763bd | 官方: 是 | 付费: 否
答案:
答案GC是垃圾收集的意思(Gabage Collection),内存处理是编程人员容易出现问题的地方,忘记或者错误的内存回收会导致程序或系统的不稳定甚至崩溃,Java提供的GC功能可以自动监测对象是否超过作用域从而达到自动回收内存的目的,Java语言没有提供释放已分配内存的显示操作方法。
9. 启动一个线程是用run()还是start()?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: Thread, start, run)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965e772fa809e6d388763d9 | 官方: 是 | 付费: 否
答案:
答案启动一个线程是调用start()方法,使线程所代表的虚拟处理机处于可运行状态,这意味着它可以由JVM调度并执行。这并不意味着线程就会立即运行。run()方法可以产生必须退出的标志来停止一个线程。
10. 守护线程(daemon thread)是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: Daemon Thread)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965ea1bfa809e6d3887b6d5 | 官方: 是 | 付费: 否
答案:
答案守护线程(daemon thread)(即daemon thread),是个服务线程(service thread),准确地来说就是服务其他的线程。
11. 线程(thread)有哪些状态?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: Thread State, Lifecycle)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965ea1dfa809e6d3887b991 | 官方: 是 | 付费: 否
答案:
答案线程(thread)通常都有五种状态,创建(new)、就绪(runnable)、运行(running)、阻塞(blocked)和死亡(dead)。
创建状态(new state)。在生成线程对象(thread object),并没有调用该对象的start方法(start method),这是线程处于创建状态。
就绪状态(runnable state)。当调用了线程对象的start方法(start method)之后,该线程就进入了就绪状态,但是此时线程调度程序(thread scheduler)还没有把该线程设置为当前线程,此时处于就绪状态。在线程运行之后,从等待或者睡眠中回来之后,也会处于就绪状态。
运行状态(running state)。线程调度程序(thread scheduler)将处于就绪状态的线程设置为当前线程,此时线程就进入了运行状态,开始运行run函数(run method)当中的代码。
阻塞状态(blocked state)。线程正在运行的时候,被暂停,通常是为了等待某个时间的发生(比如说某项资源就绪)之后再继续运行。sleep,suspend,wait等方法都可以导致线程阻塞。
死亡状态(dead state)。如果一个线程的run方法(run method)执行结束或者调用stop方法(stop method)后,该线程就会死亡。对于已经死亡的线程,无法再使用start方法(start method)令其进入就绪
12. 简述 tcp(Transmission Control Protocol)和 udp(User Datagram Protocol)的区别?
- 知识点: 操作系统与网络 (主题: networking, tcp, udp;标签: TCP, UDP, Reliability, Connection-Oriented, Connectionless)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965ee67fa809e6d38881854 | 官方: 是 | 付费: 否
答案:
答案TCP(Transmission Control Protocol)面向连接(connection-oriented)(如打电话要先拨号建立连接);UDP(User Datagram Protocol)是无连接的(connectionless),即发送数据之前不需要建立连接。
TCP(Transmission Control Protocol)提供可靠的服务(reliable service)。也就是说,通过TCP连接传送的数据,无差错,不丢失,不重复,且按序到达;UDP(User Datagram Protocol)尽最大努力交付,即不保证可靠交付。
Tcp(Transmission Control Protocol)通过校验和(checksum),重传控制(retransmission control),序号标识(sequence number),滑动窗口(sliding window)、确认应答(acknowledgment)实现可靠传输。如丢包时的重发控制,还可以对次序乱掉的分包进行顺序控制。
UDP(User Datagram Protocol)具有较好的实时性,工作效率比TCP高,适用于对高速传输和实时性有较高的通信或广播通信。
每一条TCP连接(connection)只能是点到点的(point-to-point);UDP(User Datagram Protocol)支持一对一,一对多,多对一和多对多的交互通信。
TCP(Transmission Control Protocol)对系统资源要求较多,UDP(User Datagram Protocol)对系统资源要求较少。
13. OSI(Open Systems Interconnection)的七层模型(Seven-Layer Model)都有哪些?
- 知识点: 操作系统与网络 (主题: networking;标签: OSI, 7-layer model, Networking Basics)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965ee67fa809e6d38881861 | 官方: 是 | 付费: 否
答案:
答案1.应用层(Application Layer):网络服务与最终用户的一个接口(Interface)。
2.表示层(Presentation Layer):数据的表示、安全、压缩。
3.会话层(Session Layer):建立、管理、终止会话(Session)。
4.传输层(Transport Layer):定义传输数据的协议端口号(Protocol Port Number),以及流控(Flow Control)和差错校验(Error Checking)。
5.网络层(Network Layer):进行逻辑地址(Logical Address)寻址,实现不同网络之间的路径选择。
6.数据链路层(Data Link Layer):建立逻辑连接、进行硬件地址(Hardware Address)寻址、差错校验(Error Checking)等功能。
7.物理层(Physical Layer):建立、维护、断开物理连接。
14. get(GET)和 post(POST)请求有哪些区别?
- 知识点: 操作系统与网络 (主题: http, web;标签: GET, POST, HTTP, Request)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965ef9efa809e6d38883844 | 官方: 是 | 付费: 否
答案:
答案GET在浏览器回退时是无害的,而POST会再次提交请求。
GET产生的URL(Uniform Resource Locator)地址可以被Bookmark(书签),而POST不可以。
GET请求会被浏览器主动cache(缓存),而POST不会,除非手动设置。
GET请求只能进行url编码(URL Encoding),而POST支持多种编码方式。
GET请求参数会被完整保留在浏览器历史记录里,而POST中的参数不会被保留。
GET请求在URL中传送的参数是有长度限制的,而POST么有。
对参数的数据类型,GET只接受ASCII(American Standard Code for Information Interchange)字符,而POST没有限制。
GET(GET)比POST(POST)更不安全,因为参数直接暴露在URL(URL)上,所以不能用来传递敏感信息。
GET(GET)参数通过URL(URL)传递,POST(POST)放在Request body(Request Body)中。
15. 线程(Thread)有哪些不同状态(states)?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Thread State, Ready, Running, Waiting, Dead)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965f594fa809e6d3888f883 | 官方: 是 | 付费: 否
答案:
答案Java(Java) 中线程可能处于以下状态:
Ready(Ready):线程被创建后处于就绪状态。
Running(Running):正在执行的线程处于运行状态。
Waiting(Waiting):线程等待其他线程释放某些资源时处于等待状态。
Dead(Dead):线程执行结束后处于死亡状态。
16. 死亡(dead)线程可以再次启动吗?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Thread, Dead State)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965f595fa809e6d3888fb04 | 官方: 是 | 付费: 否
答案:
答案不可以。Java(Java) 中处于死亡状态的线程无法再次启动,没有办法重启一个 dead thread(dead thread)。
17. 在 Java(Java) 线程编程中,所有线程都必须实现哪个方法?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Runnable, run)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965f733fa809e6d38891dde | 官方: 是 | 付费: 否
答案:
答案Run()(Run()) 是 Runnable(Runnable) 接口中的方法,所有线程都必须实现该方法。
18. 如何获取对象在堆内存(Heap Memory)中的实际大小?
- 知识点: 操作系统与网络 / 算法与数据结构 / 编程语言基础 (主题: java;标签: Heap, Memory)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6965f737fa809e6d388921e5 | 官方: 是 | 付费: 否
答案:
答案在 Java(Java) 中,无法直接获取对象在堆内存中的精确大小。
19. JAVA(Java) 有哪些特性?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Features, OOP, JIT, Multithreading)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69660511fa809e6d388b2dd9 | 官方: 是 | 付费: 否
答案:
答案Java(Java) 的特性包括:
- 面向对象(OOP)概念
- Object-oriented(面向对象)
- Inheritance(继承)
- Encapsulation(封装)
- Polymorphism(多态)
- Abstraction(抽象)
- Platform independent(跨平台):同一个程序无需修改即可运行在不同平台上
- High Performance(高性能):JIT(Just In Time compiler,即时编译器)使 Java 具有高性能。JIT 将字节码转换为机器语言,然后 JVM 开始执行
- Multi-threaded(多线程):执行流称为线程(Thread)。JVM 创建一个称为 main thread 的线程。用户可以通过继承 Thread 类或实现 Runnable 接口来创建多个线程
20. HashMap 和 Hashtable 有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 / 编程语言基础 (主题: java;标签: HashMap, Hashtable, Thread Safety)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69660512fa809e6d388b2e8a | 官方: 是 | 付费: 否
答案:
答案HashMap(哈希映射)HashTable(哈希表)方法不是同步的(not synchronized)关键方法是同步的(synchronized)非线程安全(Not thread safety)线程安全(Thread safety)使用 Iterator(迭代器)迭代使用 Enumerator(枚举器)迭代允许一个 null key(空键)和多个 null value(空值)不允许任何 null(空值)性能高于 Hashtable(哈希表)性能较慢
21. 什么是线程(Thread)?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Thread, Concurrency)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69660863fa809e6d388bd1e5 | 官方: 是 | 付费: 否
答案:
答案在 Java 中,执行流称为线程(Thread)。每个 Java 程序至少有一个线程,称为 main thread(主线程),由 JVM(Java虚拟机)创建。用户可以通过继承 Thread 类或实现 Runnable(可运行)接口来定义自己的线程。线程是并发执行的。
示例:
public static void main(String[] args){//main thread starts here
public static void main(String[] args){//主线程从这里开始
}
22. 如何在 Java 中创建线程?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Thread, Runnable, run)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69660863fa809e6d388bd20f | 官方: 是 | 付费: 否
答案:
答案创建线程有两种方式:
1) 继承 Thread 类:
继承 Thread 类并重写 run() 方法。Thread 位于 java.lang.thread(Java语言线程包)。
示例:
Public class Addition extends Thread {
Public class Addition extends Thread {
public void run () {
public void run () {
}
}缺点:由于 Java 只能继承一个类,如果已经继承 Thread,就不能再继承其他类。我们可以在类中重载 run()(运行)方法。
2) 实现 Runnable 接口:
实现 Runnable(可运行)接口,并为接口中的 run()(运行)方法提供实现。
示例:
Public class Addition implements Runnable {
Public class Addition implements Runnable {
public void run () {
public void run () {
}
}
23. notify()(通知)和 notifyAll()(全部通知)有什么区别?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: notify, notifyAll)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69660864fa809e6d388bd229 | 官方: 是 | 付费: 否
答案:
答案notify()(通知)notifyAll()(全部通知)用于发送信号,唤醒 waiting pool(等待池)中的一个线程。用于发送信号,唤醒 waiting pool(等待池)中的所有线程。
24. 在 Java 中何时使用 Runnable(可运行)接口 vs Thread 类?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Runnable, Thread)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69660864fa809e6d388bd233 | 官方: 是 | 付费: 否
答案:
答案如果我们需要让类继承 Thread 之外的其他类,那么应该选择 Runnable(可运行)接口,因为 Java 只能继承一个类。
如果我们不打算继承任何其他类,那么可以继承 Thread 类。
25. Thread 的 start() 与 run() 方法有什么区别?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: start, run)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69660864fa809e6d388bd237 | 官方: 是 | 付费: 否
答案:
答案start() 方法会创建新线程,并在新线程中执行 run() 方法中的代码。
如果直接调用 run() 方法,则不会创建新线程,当前执行线程会继续执行 run() 方法。
26. 同步(Synchronization)的缺点是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Synchronization, Performance)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69660864fa809e6d388bd271 | 官方: 是 | 付费: 否
答案:
答案不建议对所有方法都使用同步。因为如果一个线程访问了同步代码,其他线程就必须等待,这会导致性能变慢。
27. BA 为什么要理解业务流程(Business Process)?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: business-process, business-analysis;标签: business-analyst, process, value)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6967574efa809e6d38a7e802 | 官方: 是 | 付费: 否
答案:
答案理解业务流程意味着知道各部门如何协作、信息如何流转、哪里会出现延迟或错误。BA 以此连接技术方案与业务目标,确保 IT 交付真正解决问题并创造价值;同时能更准确地发现改进机会,设计可执行的需求与衡量指标。
28. 业务分析师(Business Analyst)日常都做什么?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: business-analysis, requirements, uat, process-improvement;标签: BA, Day-to-day)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696760ecfa809e6d38a957e9 | 官方: 是 | 付费: 否
答案:
答案业务分析师与其他分析师协作并向项目经理汇报,典型工作包括需求分析、用户验收测试(UAT)、文档编写与沟通协调。他们需要持续监控业务流程并预测需求/问题,评估改进点并落地技术方案,制定优化策略,推动系统现代化与自动化,记录并汇报成果,协调管理层、客户与IT团队,收集多方洞察产出报告,必要时为客户提供培训并关注成本与资源配置。
29. 为什么说 P2P 网络具备“去中心化”和“无单点故障”的特性?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: system-design, networking;标签: Decentralization, Fault Tolerance, P2P)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696def25623565038f41c593 | 官方: 是 | 付费: 否
答案:
答案在 P2P 中不存在必须依赖的中心节点,资源与数据分布在多个 peer 上。某个 peer 离线通常只影响其贡献的那部分资源,其他 peer 仍可继续发现彼此并提供服务。因此整体可用性更强;同时通过冗余副本或多源下载等机制,可进一步降低单节点故障对业务的影响。
30. P2P 网络有哪些典型资源共享场景?分别共享了哪些资源?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: system-design, networking;标签: BitTorrent, P2P CDN, Resource Sharing)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696def25623565038f41c59c | 官方: 是 | 付费: 否
答案:
答案典型场景包括文件分发(共享文件块与上传带宽,如 BitTorrent)、内容分发(共享缓存内容与带宽,形成 P2P CDN)、协同计算(共享 CPU/GPU 算力,如分布式计算项目)、以及即时通信/音视频(共享转发能力或直连链路)。核心都是把“带宽、存储、计算、内容”从中心化服务器转移到边缘节点共同承担。
31. 在 P2P 文件分发里,为什么“越热门下载越快”经常成立?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: system-design, networking;标签: BitTorrent, Swarming, Content Distribution)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696def25623565038f41c5cc | 官方: 是 | 付费: 否
答案:
答案热门文件拥有更多 seed/peer 节点作为数据源,客户端可从更多来源并行拉取不同分片,整体带宽上限随参与者数量增加而提升。同时下载者也会上传已获得的分片,形成正反馈:越多人参与,越多可用分片与上传带宽,越快完成。
32. 材料里 Google 软件工程师面试流程包含哪些阶段?每个阶段主要考什么?
- 知识点: 操作系统与网络 (主题: interview, process;标签: recruiter-screen, onsite-loop, hiring-committee)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f121e120fcc159115a395 | 官方: 是 | 付费: 否
答案:
答案材料给出的典型流程是:投递&Recruiter Screen(匹配岗位、经历与动机);Online Assessment(部分人会有,考基础算法与数据结构);Technical Phone Screens(45-60 分钟,1-2 道算法题+讲思路与复杂度);Virtual Onsite Loop(4-6 轮,包含多轮 coding,L4/L5+ 加系统设计,另有 Googleyness 行为面);最后是Hiring Committee(汇总面试反馈作最终推荐)。
33. 在审计或重复性工作中,你如何保持专注?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: quality, process;标签: Attention to Detail)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f1cf2120fcc159116e77c | 官方: 是 | 付费: 否
答案:
答案强调“流程化+校验+节奏”:用检查清单、双人复核、抽样核对与自动化工具降低低级错误;把大任务拆成小段并设定时间块;对异常数据做标记与回溯;最后说明你对合规与质量标准的重视。
34. Amazon 面试中的 Bar Raiser 是什么?他/她在面试里起什么作用?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: career, interview, amazon;标签: Bar Raiser, Process)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f2161120fcc159117aa75 | 官方: 是 | 付费: 否
答案:
答案Bar Raiser(抬杠者)是受过专门训练的面试官,通常来自与你申请部门不同的团队,承担“客观仲裁者”的角色,确保招聘标准一致且公平。他/她会更聚焦 LP(领导力原则)行为题并深挖细节,最终判断你是否能“raise the bar”(带来高于现有平均水平的表现)。
35. Cognizant GenC 在线考试一共几轮?每轮主要考什么?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: interview;标签: Cognizant, GenC, Process)
- 类型: behavioral | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f2b14120fcc159119534e | 官方: 是 | 付费: 否
答案:
答案通常可理解为 3 个阶段:在线考试、技术面试、HR 面试。在线考试在 AMCAT(自适应能力测试)上进行,分为 GenC 能力评估(量化/逻辑/英语)和沟通评估(阅读语法/理解/听力/口语);通过后进入 Superset(超集)平台的技术面试(沟通 + 基础技术 + 简单编码),最后是 HR 轮(文件验证 + 常规行为面问题)。
36. Cognizant GenC 技术面试通常会围绕哪些内容提问?
- 知识点: 操作系统与网络 (主题: interview, dsa;标签: technical interview, projects, coding)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f31a2120fcc15911a2a5c | 官方: 是 | 付费: 否
答案:
答案
技术面试一般会从自我介绍切入,随后重点围绕:编程题(如排序、查找、基础数据结构)、项目/实习经历(你负责的模块、难点、结果与复盘)、以及基础概念(如 OOP(面向对象编程)、Python/Java 基础等)。回答时建议用“背景-方案-结果-反思”的结构,突出你亲自做了什么,以及量化结果。
37. 项目分析师实习生(Project Analyst Intern)的招聘流程一般分哪 3 轮?每轮目的是什么?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: interview;标签: Cognizant, Project Analyst, Process)
- 类型: behavioral | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f344d120fcc15911a6406 | 官方: 是 | 付费: 否
答案:
答案通常分为 3 轮:资质轮(筛选简历/基本条件与岗位匹配度)、沟通回合(不淘汰但会评估表达与理解,作为面试参考)、面试(技术 + HR,综合看基础能力、逻辑思维、沟通与岗位意愿)。准备时建议把“自我介绍 + 项目讲清楚 + 常见逻辑/数理题 + 基础技术概念”打成一套话术。
38. C 程序与操作系统进行文件交互时,用到的关键结构/头文件是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: c, os;标签: stdio.h, FILE, I/O)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f35a4120fcc15911a941c | 官方: 是 | 付费: 否
答案:
答案C 语言进行文件操作通常依赖 stdio.h(标准输入输出头文件)提供的文件相关类型与函数,并通过文件结构(例如以 FILE 为代表的句柄/结构)作为与操作系统交互的中介。程序通过 fopen() 打开文件后,再使用 fread()/fwrite()/fprintf()/fscanf()/fclose() 等函数进行读写与关闭,从而完成文件层面的系统交互。
39. new() 和 malloc() 有什么区别?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: cpp, c;标签: new, malloc, Memory)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f35a4120fcc15911a942a | 官方: 是 | 付费: 否
答案:
答案new(典型在 C++)会分配内存并调用构造函数(constructor),返回的是具体类型指针;malloc(C 标准库函数)只负责分配原始内存,不调用构造函数,返回 void* 且通常需要显式类型转换。选择取决于语言与是否需要对象构造/类型安全等特性。
40. 什么是匿名 FTP(Anonymous FTP)?常用于什么场景?有哪些限制?
- 知识点: 操作系统与网络 (主题: networking, ftp;标签: FTP, Anonymous)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f35a4120fcc15911a9432 | 官方: 是 | 付费: 否
答案:
答案匿名 FTP(File Transfer Protocol)允许用户在不提供特定账号密码的情况下访问 FTP(File Transfer Protocol)服务器,通常使用用户名 anonymous(有时密码可用邮箱形式)。它常用于分发公开文件(软件更新、文档、公共数据等)。出于安全考虑,匿名 FTP(File Transfer Protocol)往往对写入/上传权限有限制,通常只开放可下载目录,以降低滥用风险。
41. 你熟悉哪些类型的操作系统(Operating System, OS)?请举例。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: operating-systems;标签: OS分类, Linux, RTOS)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f3cc7120fcc15911c511f | 官方: 是 | 付费: 否
答案:
答案常见类型包括:批处理系统(Batch Processing System)、分时系统(Time-sharing System)、实时系统(Real-Time Operating System, RTOS)、分布式系统(Distributed Operating System)、网络操作系统(Network Operating System, NOS)、移动操作系统(Mobile Operating System)等。举例:Linux/Unix、Windows、macOS 属于通用操作系统(General-Purpose Operating System);VxWorks/RTLinux 属于实时系统(Real-Time Operating System, RTOS);Android/iOS 属于移动操作系统(Mobile Operating System)。回答时可补充你在哪些场景用过(开发、部署、脚本、排障)。
42. 什么是实时操作系统(Real-Time Operating System, RTOS)?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: operating-systems, rtos;标签: RTOS, 确定性, 调度)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f3cc7120fcc15911c5123 | 官方: 是 | 付费: 否
答案:
答案RTOS(Real-Time Operating System)的核心是“时间确定性”:系统不仅要算对结果,还要在规定时间内给出结果,否则就算失败或不可接受。它通常用于对时延敏感或安全关键的场景(工业控制、机器人、航天/车载、医疗设备等),强调可预测的调度、较低中断延迟与稳定响应时间。
43. 操作系统中的线程(Thread)是什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: operating-systems, concurrency;标签: 线程, 共享资源, 同步)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f3ccd120fcc15911c56e7 | 官方: 是 | 付费: 否
答案:
答案线程(Thread)是进程内部最小的执行单元,多个线程共享同一进程的地址空间与资源(如堆、打开的文件),但各自拥有独立的寄存器上下文与栈。线程的典型状态包括就绪、运行、阻塞;并发访问共享资源需要同步机制(互斥锁(Mutex)、信号量(Semaphore)等)来避免竞态与数据不一致。
44. 操作系统中的进程(Process)是什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: operating-systems;标签: 进程, 地址空间, 调度)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f3cd4120fcc15911c64df | 官方: 是 | 付费: 否
答案:
答案进程(Process)是程序的一次执行实例,包含代码、数据、堆栈、打开文件、寄存器上下文等运行时信息,并由操作系统调度。进程彼此隔离,通常拥有独立地址空间,提升安全性与稳定性。与线程相比,进程切换开销更大,但隔离更强;线程更轻量,适合并发。
45. Java 的垃圾回收(Garbage Collection, GC)是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, jvm, memory;标签: GC, JVM, 内存管理)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f3cde120fcc15911c6d40 | 官方: 是 | 付费: 否
答案:
答案垃圾回收(Garbage Collection, GC)是 JVM(Java Virtual Machine)自动识别不再被引用的对象并回收其内存的机制,减少手动内存管理成本并降低内存泄漏风险。GC 通过可达性分析判断对象是否“存活”,并在合适时机执行回收与整理(不同GC算法/收集器在吞吐、延迟、内存占用上权衡不同)。
46. 什么是硬实时系统(Hard Real-Time System, HRT)?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: operating-systems, rtos;标签: HRT, deadline, 安全关键)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f3cde120fcc15911c6d69 | 官方: 是 | 付费: 否
答案:
答案硬实时系统(Hard Real-Time System, HRT)要求任务必须在严格截止时间(Deadline)前完成,错过deadline 就可能导致系统级严重后果(安全事故、设备失控、不可接受的失败)。典型出现在安全关键领域(航空航天、汽车控制、医疗设备、工业控制)。面试回答建议强调“deadline 必达 + 后果严重”。
47. 什么是分时操作系统(Time-sharing Operating System)?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: operating-systems, scheduling;标签: 分时系统, 时间片, 调度)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 696f3cde120fcc15911c6d8f | 官方: 是 | 付费: 否
答案:
答案分时操作系统(Time-sharing Operating System)通过把CPU时间切分为多个时间片,轮转分配给多个用户/任务,使多人/多任务看起来“同时运行”。它提升CPU利用率与交互响应,核心机制是进程/线程调度与快速上下文切换。典型例子:Unix/Linux 等多用户系统(现代Windows也具备类似多任务调度能力)。
48. 区分主存(Primary/Main Memory)与辅存(Secondary Memory)。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: computer-architecture;标签: Memory)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- id: 696f4e72120fcc15911fb558 | 官方: 是 | 付费: 否
答案:
Primary/Main Memory: directly accessible by the CPU (e.g., RAM/DRAM), used for data/instructions being processed.
主内存/主存储:CPU 可直接访问(例如 RAM/DRAM),用于存储正在处理的数据/指令。
Secondary Memory: not directly accessible by CPU; data must be loaded into primary memory first (e.g., hard disks, USB drives). Primary is typically temporary and faster but more expensive; secondary is permanent, slower, and cheaper.
辅助存储器:CPU 不能直接访问;数据必须先加载到主内存中(例如硬盘、USB 驱动器)。主内存通常是临时性的、速度较快但成本较高;辅助存储器是永久性的、速度较慢且成本较低。
49. 在 UNIX/Linux 中,sudo(sudo)命令的作用是什么?
- 知识点: 操作系统与网络 (主题: linux;标签: sudo)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- id: 696f4e82120fcc15911fcb87 | 官方: 是 | 付费: 否
答案:
sudo stands for Super Users DO. It is used as a prefix to run commands with elevated privileges (as another user, commonly root). Users who can use sudo are configured in the sudoers file (/etc/sudoers). Use visudo to edit the sudoers file safely.
sudo 代表超级用户执行(Super Users DO)。它用作前缀,以提升的权限(作为其他用户,通常是 root)运行命令。可以使用 sudo 的用户在 sudoers 文件(/etc/sudoers)中配置。使用 visudo 安全地编辑 sudoers 文件。
50. IBM(IBM)通常会如何通知面试结果?如果想跟进,最佳跟进方式是什么?
- 知识点: 操作系统与网络 / 行为与软技能 (标签: Process, Follow-up)
- 类型: behavioral | 难度: easy | 子类型: behavioral
- 分类: general
- 公司: IBM
- id: 69704120120fcc1591300bfd | 官方: 是 | 付费: 否
答案:
答案常见方式包括邮件/电话/系统状态更新,取决于地区与团队流程。你可以在面试结束时确认时间线(例如 1 周),到期后用邮件礼貌跟进。
跟进邮件要点:简短说明面试日期、表达持续兴趣、询问进度与下一步。
AnswerCommon channels include email, phone, or ATS status updates, depending on region/team process. Confirm the timeline (e.g., one week) and follow up politely after it.
回答常见的渠道包括电子邮件、电话或 ATS 状态更新,具体取决于地区/团队流程。确认时间线(例如一周),并在之后礼貌地跟进。
A follow-up should be brief: interview date, continued interest, and ask for next steps.
跟进应简短:面试日期、持续的兴趣,并询问下一步。
51. 网络中的 Socket(套接字)和 Session(会话)有什么区别?
- 知识点: 操作系统与网络 (主题: networking, protocols;标签: Socket, Session)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6977264ba39c9c5c3a89f68e | 官方: 是 | 付费: 否
答案:
答案Socket(套接字)是网络通信端点(Endpoint)的抽象,通常由 IP 地址 + 端口号标识,用于建立收发数据的通道;Session(会话)更偏“会话语义”,表示通信双方在一段时间内建立的逻辑交互上下文(可包含状态、认证信息、超时等)。简单说:Socket(套接字)是“地址/通道”,Session(会话)是“有状态的对话”。
52. 瀑布模型(Waterfall Model)在软件开发中有哪些缺点?
- 知识点: 操作系统与网络 (主题: software-engineering, waterfall;标签: Waterfall, Process)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6977264fa39c9c5c3a89fa2b | 官方: 是 | 付费: 否
答案:
答案瀑布模型(Waterfall Model)是线性顺序流程,主要缺点是变更成本高、对需求稳定性依赖强,阶段结束后难以迭代回退;复杂项目中早期需求偏差会在后期集中爆雷;测试往往偏后置,问题发现晚导致返工多;对用户反馈响应慢,容易出现交付物与真实需求不匹配的风险。
53. 用例子解释指针(Pointer)。
- 知识点: 操作系统与网络 (主题: c-cpp, memory;标签: Pointer, Dereference, Memory Address)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6977264fa39c9c5c3a89fa3c | 官方: 是 | 付费: 否
答案:
答案指针(Pointer)是存储内存地址的变量,常见于 C/C++,用于直接访问或间接修改目标变量的值。例如:定义 int number=42; int ptr=&number; 其中 ptr 保存 number 的地址,ptr 表示解引用(Dereference)得到 number 的值。通过 *ptr=99 可间接修改 number,这也是动态内存与数据结构(如链表等)的基础能力。
54. 解释 DHCP(动态主机配置协议,Dynamic Host Configuration Protocol)过程。
- 知识点: 操作系统与网络 (主题: networking, dhcp;标签: DHCP, DORA, IP Assignment)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69772662a39c9c5c3a89fe3f | 官方: 是 | 付费: 否
答案:
答案DHCP(动态主机配置协议,Dynamic Host Configuration Protocol)用于自动为设备分配网络配置。典型流程是 DORA:客户端广播 Discover(发现)寻找 DHCP 服务器;服务器返回 Offer(提供)提供可用 IP 与租约等信息;客户端发送 Request(请求)选择某个 Offer(提供)并请求分配;服务器回 ACK(确认)确认分配并下发 IP、网关、DNS 等配置。租约到期前客户端会续租以保持地址有效。
55. Python 中的浅拷贝(Shallow Copy)和深拷贝(Deep Copy)有什么区别?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: python, memory;标签: Shallow Copy, Deep Copy, copy module)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69772662a39c9c5c3a89fe4b | 官方: 是 | 付费: 否
答案:
答案浅拷贝(Shallow Copy)会创建一个新容器对象,但容器内的元素引用仍指向原对象(嵌套对象共享);深拷贝(Deep Copy)会递归复制所有层级对象,使新对象与原对象彻底独立。浅拷贝(Shallow Copy)适合对象结构简单或共享可接受的场景;深拷贝(Deep Copy)适合需要完全隔离变更的场景。常用 copy.copy() 做浅拷贝(Shallow Copy),copy.deepcopy() 做深拷贝(Deep Copy)。
56. 什么是子网(Subnet)?为什么它在网络中很重要?
- 知识点: 操作系统与网络 (主题: networking, subnetting;标签: Subnet, Broadcast Domain, Routing)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69772662a39c9c5c3a89fe50 | 官方: 是 | 付费: 否
答案:
答案子网(Subnet)是把一个大的 IP 网络按子网掩码(Subnet Mask)划分为更小网络的结果。它的重要性在于:提升 IP 地址利用率、缩小广播域(Broadcast Domain)减少网络拥塞、便于分区管理与路由规划,并通过隔离不同网段提升安全性与故障影响范围控制。企业常按部门/业务/安全域划分子网(Subnet),配合 ACL(访问控制列表,Access Control List)/防火墙做访问控制。
57. 什么是子网掩码(Subnet Mask)?它如何用于网络通信?
- 知识点: 操作系统与网络 (主题: networking, ip;标签: Subnet Mask, Routing, Default Gateway)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69772662a39c9c5c3a89fe5c | 官方: 是 | 付费: 否
答案:
答案子网掩码(Subnet Mask)是与 IP 地址配合使用的 32 位(IPv4)或前缀长度(IPv6)标识,用于区分网络位与主机位。设备通过“IP 地址 AND 子网掩码”计算网络地址,从而判断目标是否在同一网段:同网段则直接二层通信,不同网段则把流量交给默认网关路由。它也是子网划分与路由汇总的基础。
58. 什么是 IP 地址?解释 IPv4 与 IPv6 的区别。
- 知识点: 操作系统与网络 (主题: networking, ip;标签: IPv4, IPv6, Addressing)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69772665a39c9c5c3a8a0296 | 官方: 是 | 付费: 否
答案:
答案IP 地址是网络中设备的逻辑标识,用于寻址与路由转发。IPv4 使用 32 位地址,地址空间约 43 亿,已出现枯竭问题;IPv6 使用 128 位地址,地址空间巨大,支持更好的自动配置与端到端连通性设计,并在协议层面增强了扩展性(如更简化的头部、改进的邻居发现等)。两者在表示格式与网络机制上也有差异。
59. DLL(Dynamic Link Library)和 EXE(Executable)文件扩展名有什么区别?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: os, windows, software-engineering;标签: DLL, EXE, Dynamic Linking)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6977267ca39c9c5c3a8a0e76 | 官方: 是 | 付费: 否
答案:
答案EXE(Executable)是可执行程序文件,包含入口点(Entry Point),可直接运行并拥有独立进程空间;DLL(Dynamic Link Library)是动态链接库,包含可复用的函数/资源,本身不能单独运行,需要被其他程序加载调用。DLL(Dynamic Link Library)便于代码复用与按需加载,但也可能引入版本依赖问题(如 DLL Hell)。实际工程中常把通用能力沉淀为 DLL(Dynamic Link Library),由多个 EXE(Executable)共享使用。
60. Session(会话)和 Socket(套接字)有什么区别?
- 知识点: 操作系统与网络 (主题: networking, session, socket;标签: Session, Socket, State)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 697729f6a39c9c5c3a8ab1bd | 官方: 是 | 付费: 否
答案:
答案Session(会话)是客户端与服务端之间一次连续交互的“逻辑上下文”,用于维持状态与身份(如登录态、购物车),可能跨多次请求;Socket(套接字)是网络通信端点,通常由 IP(Internet Protocol) + Port(端口)组成,用于建立和传输 TCP(Transmission Control Protocol)/UDP(User Datagram Protocol)数据流。简单理解:Session(会话)管“业务状态”,Socket(套接字)管“网络连接与数据通道”,一个 Session(会话)可能复用多个连接,一个连接也可能承载不同会话的请求(取决于协议与实现)。
61. 网络有哪些类型?请简要说明 PAN、LAN、MAN、WAN。
- 知识点: 操作系统与网络 (主题: networking;标签: PAN, LAN, MAN, WAN)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 697729f6a39c9c5c3a8ab1f7 | 官方: 是 | 付费: 否
答案:
答案常见网络类型包括:PAN(Personal Area Network)个人区域网,覆盖极小范围(如蓝牙连接手机与耳机/手表);LAN(Local Area Network)局域网,覆盖办公室/家庭等有限区域,通常由交换机/路由器连接多设备;MAN(Metropolitan Area Network)城域网,覆盖城市级范围,常由运营商提供骨干连接;WAN(Wide Area Network)广域网,跨城市/国家连接多个 LAN(Local Area Network)/MAN(Metropolitan Area Network),典型例子是互联网。范围越大,延迟与运维复杂度通常越高。
62. Java 中 Stack(栈)和 Heap(堆)内存有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 / 编程语言基础 (主题: java, memory;标签: Stack, Heap, GC, Memory Model)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 697729f6a39c9c5c3a8ab20e | 官方: 是 | 付费: 否
答案:
答案Stack(栈)是线程私有内存,用于方法调用栈帧(Stack Frame),保存局部变量、参数、返回地址等,分配/回收速度快,随方法结束自动释放;Heap(堆)是进程内共享内存,用于存放对象实例与数组,生命周期由 GC(Garbage Collection)管理,分配更灵活但开销更大。常见理解是:局部基本类型值通常在栈上(或被优化),对象本体在堆上,栈上保存的是对象引用;堆可能出现内存泄漏或 GC(Garbage Collection)压力,栈更可能出现 StackOverflow(栈溢出)(递归过深)。
63. Java 和 C 语言的主要区别是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, c, programming-fundamentals;标签: Java vs C, Memory, JVM)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 6977326aa39c9c5c3a8d4fb7 | 官方: 是 | 付费: 否
答案:
答案C 是编译型的过程式语言,提供更直接的内存访问与指针,性能与控制力强但更易出现内存错误;Java 以面向对象为核心,运行在 JVM(Java Virtual Machine)上,有垃圾回收与丰富标准库,跨平台性强,内存管理更安全但有运行时开销。工程上:C 常用于系统/嵌入式;Java 常用于企业应用、后端服务与跨平台应用开发。
64. 数组(array)和结构体(structure)有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 / 编程语言基础 (主题: c, data-structures;标签: Array, Struct, Memory Layout)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 69773272a39c9c5c3a8d58b5 | 官方: 是 | 付费: 否
答案:
答案数组是同类型元素的连续集合,通过索引访问,适合存放大量相同类型数据;结构体用于把不同类型的数据字段组织成一个整体,表示一个“实体”的多属性。内存上,数组元素大小一致且连续;结构体各字段可不同类型,布局由编译器决定(可能有对齐填充)。工程上:数组偏“列表/集合”,结构体偏“记录/对象”。
65. 操作系统(Operating System,OS)有哪些主要功能?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: operating-systems;标签: os, functions)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 697825bfa39c9c5c3ab58bef | 官方: 是 | 付费: 否
答案:
答案操作系统的核心功能是为应用提供运行环境,并管理硬件资源。常见功能包括:提供用户界面、引导启动、设备与 I/O(Input/Output)管理、进程/线程调度、内存管理、文件系统、网络与安全权限等。
- 用户界面:GUI/CLI
- 启动与系统初始化:boot loader、服务启动
- 资源管理:CPU 调度、内存管理、文件系统
- 设备与 I/O:驱动、外设管理
- 安全与权限:用户、访问控制、审计
66. Afterpay 的面试流程一般是怎样的?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: interview, process;标签: afterpay, process)
- 类型: behavioral | 难度: easy | 子类型:
- 分类: fullstack
- id: 69782a0ba39c9c5c3ab73bc6 | 官方: 是 | 付费: 否
答案:
答案流程概览
Afterpay 的流程会因岗位而异,但常见节奏是:先与 HR/Recruiter 电话或视频初筛,确认动机、基础匹配与薪资/签证等;随后进入 1-2 轮用人经理或相关 Stakeholders 面试,覆盖技术深度、项目经历与行为面;部分岗位会安排 take-home assignment 或现场练习来验证实际能力。整体可能比较耗时、强度不低,但候选人反馈通常较正向。
- Recruiter phone screen:背景与岗位匹配
- Manager/Stakeholder interviews:技术+项目+行为面
- (部分岗位)作业/带回家作业:验证实操能力
- 反馈与 Offer:可能包含背景调查或补充沟通
67. TikTok 的 SWE(Software Engineer)面试流程一般包含哪些环节?新毕业生与有经验候选人有什么差异?
- 知识点: 操作系统与网络 / 算法与数据结构 / 系统设计/架构 / UI/UX 设计 (主题: data-structures, algorithms, system-design;标签: tiktok, process, newgrad, experienced)
- 类型: technical | 难度: easy | 子类型:
- 分类: fullstack
- id: 697887f9a39c9c5c3ad6950e | 官方: 是 | 付费: 否
答案:
答案TikTok SWE(Software Engineer)面试常见流程包括:新毕业生通常先在线编程测试(或 Recruiter 初筛),随后 2–3 轮技术面(45 分钟左右),资深岗位可能包含系统设计面,最后通常是与资深工程师/Tech Lead(技术负责人)的终面。差异在于:新毕业生更常见在线测评与 Recruiter screen(招聘人员筛选);有经验候选人可能先与招聘方邮件沟通后直接进入技术轮,并更可能被要求系统设计能力。
68. What is the interview process like for a software engineer role at Atlassian?
Atlassian 软件工程师职位的面试流程是怎样的?
- 知识点: 操作系统与网络 / 行为与软技能 (标签: Interview Process, Hiring Bar)
- 类型: behavioral | 难度: easy | 子类型: scenario
- 分类: general
- 公司: Atlassian
- id: 6979de4fc8f1f94b6462c728 | 官方: 是 | 付费: 否
答案:
常见流程:投递简历 → Recruiter(Recruiter)预筛 → Karat(Karat)编程面试 → Virtual Loop(Virtual Loop)(多轮 Coding + System Design + Values)→ Hiring Bar Review(Hiring Bar Review)。Virtual Loop(Virtual Loop)往往持续数小时,既看编码与架构能力,也会评估价值观与协作方式。
69. What should you highlight in the Application Submission stage for Atlassian SWE roles?
在 Atlassian SWE 职位的申请提交阶段,你应该突出什么?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: interviewing;标签: Interview Process)
- 类型: behavioral | 难度: easy | 子类型: scenario
- 分类: general
- 公司: Atlassian
- id: 6979de4fc8f1f94b6462c72b | 官方: 是 | 付费: 否
答案:
强调与岗位技术栈匹配(Java/Kotlin/React/AWS/K8s)并量化影响:CI/CD(CI/CD)、云基础设施、稳定性、数据/AI(AI)工作流等。把你的经历与 Atlassian(Atlassian)的关键方向(云迁移、开发者工具、平台化)明确对应。
70. What happens in the Recruiter Screen for Atlassian?
Atlassian 的招聘人员筛选环节会发生什么?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: interviewing;标签: Interview Process)
- 类型: behavioral | 难度: easy | 子类型: scenario
- 分类: general
- 公司: Atlassian
- id: 6979de4fc8f1f94b6462c72e | 官方: 是 | 付费: 否
答案:
通常 30 分钟左右,会问 “Why Atlassian?”、你喜欢解决什么问题等,并对齐 Team Anywhere(Team Anywhere)的地点/时区偏好与薪资区间。建议多提澄清问题,突出远程协作与跨团队经验。
71. What do you understand about programs and processes in the context of Operating Systems? Differentiate between them.
在操作系统的上下文中,你对程序和进程了解多少?区分它们。
- 知识点: 操作系统与网络 (标签: interviewbit, accolite, company-specific)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: general
- 公司: Accolite Digital
- id: 69b3791b58d557c902b973ce | 官方: 否 | 付费: 否
答案:
- Program: When we run a newly compiled program, the operating system creates a process to run the application. The program's execution begins with GUI mouse clicks, command line entry of the program's name, and so on. Because it remains in secondary memory, such as the contents of a file on disk, a program is a passive entity. Multiple processes can be found in a single program.
- Process: The term process refers to computer program code that has been stored in memory and can be executed by the central processor unit (CPU). A process is an instance of a computer program that is running or an entity that may be allocated to and executed on a processor. When a program is loaded into memory, it becomes a process and hence an active entity.
The following table lists the differences between a program and a process:
下表列出了程序和进程之间的区别:
| Program 程序 | Process 进程 |
|---|---|
| A program consists of a collection of instructions that must be followed in order to execute a certain task. 程序由一组指令组成,必须按顺序执行才能完成某项任务。 | An instance of an executing program is referred to as a process. 正在执行的程序的一个实例称为进程。 |
| Because it is stored in secondary memory, a program is referred to as a passive entity. 因为程序存储在辅助存储器中,所以被称为被动实体。 | Processes are active entities since they are produced and loaded into the main memory during execution. 进程是活动实体,因为它们在执行期间被创建并加载到主存储器中。 |
| A program only exists in one location and will remain thus until it is deleted. 程序只存在于一个位置,并将一直如此直到被删除。 | A process has a finite lifespan because it is terminated after the task is completed. 进程的生命周期有限,因为任务完成后它就会被终止。 |
| A program is also referred to as a static entity. 程序也被称为静态实体。 | A process is also referred to as a dynamic entity. 进程也被称为动态实体。 |
| A program does not require any resources; it only needs memory space to store the instructions. 程序不需要任何资源;它只需要内存空间来存储指令。 | During its lifespan, a process requires a lot of resources, including CPU, memory address, and I/O. 进程在其生命周期内需要大量资源,包括 CPU、内存地址和 I/O。 |
| There is no control block in a program. 程序中没有控制块。 | Process Control Block is a separate control block for each process. 进程控制块是每个进程单独的控制块。 |
| There are two logical components to a program: code and data. 程序有两个逻辑组成部分:代码和数据。 | A process, in addition to program data, requires extra information for administration and execution. 进程除了程序数据外,还需要额外信息用于管理和执行。 |
72. What do you understand about deadlocks in the context of Operating Systems? What are the four necessary conditions for deadlock to happen?
在操作系统的上下文中,你对死锁了解多少?发生死锁的四个必要条件是什么?
- 知识点: 操作系统与网络 (标签: interviewbit, accolite, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Accolite Digital
- id: 69b3791b58d557c902b973e7 | 官方: 否 | 付费: 否
答案:
A deadlock occurs when a group of processes is stalled because each process is holding a resource and waiting for another process to obtain it. Consider the situation when two cars are approaching each other on a narrow bridge and there is only one way: once they are in front of each other, neither of the two cars can move. In operating systems, a similar situation happens when two or more processes hold some resources while waiting on resources owned by other processes (s).
当一组进程因每个进程都持有资源并等待另一个进程获取它而停滞时,就会发生死锁。考虑这样一种情况:两辆车在狭窄的桥上相向而行,只有一条路:一旦它们面对面,两辆车都无法移动。在操作系统中,当两个或多个进程持有某些资源同时等待其他进程拥有的资源时,也会发生类似的情况。
The following are the four necessary conditions for deadlock to take place: - Mutual Exclusion: One or more resources are not available for sharing (Only one process can use at a time)
以下是发生死锁的四个必要条件: - 互斥:一个或多个资源不可共享(一次只能有一个进程使用)
- Hold and Wait: A process is holding at least one resource and waiting for further resources.
- No Preemption: A resource can only be obtained from a process if it is released by the process.
- Circular Wait: A collection of operations is waiting for each other in a circular fashion.
73. What are the key differences between TCP and UDP?
TCP 和 UDP 之间的关键区别是什么?
- 知识点: 操作系统与网络 (标签: interviewbit, apisero, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Apisero
- id: 69b3793b58d557c902b99193 | 官方: 否 | 付费: 否
答案:
The key differences between TCP and UDP are highlighted in the table given below:
TCP 和 UDP 之间的关键区别在下表中突出显示:
| TCP (Transmission Control Protocol) TCP(传输控制协议) | UDP (User Datagram Protocol) UDP(用户数据报协议) |
|---|---|
| TCP (Transmission Control Protocol) is a connection-oriented protocol. The communicating devices should create a connection before transmitting data and close the connection after transmitting the data, according to connection orientation. TCP(传输控制协议)是一种面向连接的协议。根据面向连接的特性,通信设备应在传输数据前建立连接,并在传输数据后关闭连接。 | The User Datagram Protocol (UDP) is a datagram oriented protocol. This is due to the lack of expense associated with creating, maintaining, and terminating connections. For broadcast and multicast network transmission, UDP is a good choice. 用户数据报协议(UDP)是一种面向数据报的协议。这是因为创建、维护和终止连接没有相关开销。对于广播和多播网络传输,UDP 是一个不错的选择。 |
| TCP is dependable because it ensures data delivery to the destination router. TCP 是可靠的,因为它确保数据传递到目标路由器。 | In UDP, data delivery to the destination cannot be assured and hence, it is not dependable. 在 UDP 中,无法保证数据传递到目的地,因此它不可靠。 |
| TCP has a number of error checking methods. It is because it allows for data flow control and acknowledgement. TCP 有多种错误检查方法。这是因为它允许数据流控制和确认。 | UDP only provides a checksum-based error checking mechanism. UDP 仅提供基于校验和的错误检查机制。 |
| There is an acknowledgement segment in TCP. TCP 中有确认段。 | There is no acknowledgement segment in UDP. UDP 中没有确认段。 |
| TCP is slower, more complicated, and inefficient than UDP. TCP 比 UDP 更慢、更复杂、效率更低。 | UDP is faster, simple and more efficient than TCP. UDP 比 TCP 更快、更简单、更高效。 |
| The Transmission Control Protocol has a function that allows data to be sequenced. This means that packets arrive at the receiver in the sequence they were sent. 传输控制协议具有允许数据排序的功能。这意味着数据包按发送顺序到达接收方。 | In UDP, there is no data sequencing. The application layer must control the order if it is required. 在 UDP 中,没有数据排序。如果需要,应用层必须控制顺序。 |
| TCP uses a variable-length (20-60) bytes header. TCP 使用可变长度(20-60)字节的报头。 | UDP has a fixed-length header of 8 bytes. UDP 具有固定长度的 8 字节报头。 |
| TCP allows for the retransmission of dropped packets. TCP 允许重传丢失的数据包。 | UDP does not allow for the retransmission of dropped packets. UDP 不允许重传丢失的数据包。 |
| Broadcasting is not supported by TCP. TCP 不支持广播。 | Broadcasting is supported by UDP. UDP 支持广播。 |
| Handshakes such as SYN, ACK, and SYN-ACK are used in TCP. TCP 中使用 SYN、ACK 和 SYN-ACK 等握手。 | It is a connectionless protocol, which means it does not require a handshake. 它是一种无连接协议,这意味着它不需要握手。 |
| TCP is a heavy-weight protocol. TCP 是一种重量级协议。 | UDP is a lightweight protocol. UDP 是一种轻量级协议。 |
| HTTP, HTTPs, FTP, SMTP, and Telnet all use TCP. HTTP、HTTPs、FTP、SMTP 和 Telnet 都使用 TCP。 | DNS, DHCP, TFTP, SNMP, RIP, and VoIP all use UDP. DNS、DHCP、TFTP、SNMP、RIP 和 VoIP 都使用 UDP。 |
74. What do you understand about Spooling in Operating Systems? Give an application of spooling.
你对操作系统中的“假脱机”(Spooling)有何理解?给出假脱机的一个应用。
- 知识点: 操作系统与网络 (标签: interviewbit, apisero, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Apisero
- id: 69b3793b58d557c902b991b5 | 官方: 否 | 付费: 否
答案:
The practice of temporarily storing data so that it can be used and processed by a device, software, or system is known as spooling. Data is supplied to and stored in memory or other volatile storage until a programme or computer requests it for execution. "Simultaneous Peripheral Operations Online" is an acronym for Spooling. The spool is typically stored in physical memory, buffers, or interrupts for Input and Output devices on the computer. To process the spool in ascending order, the FIFO (first in, first out) approach is employed. Spooling is the collection and storage of data from many Input and Output activities in a buffer. Input and Output devices can access this buffer, which is a piece of memory or hard disc. In a distributed context, an operating system performs the following tasks: - Data spooling for Input and Output devices with varying data access rates is handled.
临时存储数据以便设备、软件或系统使用和处理的做法称为假脱机。数据被提供并存储在内存或其他易失性存储中,直到程序或计算机请求执行它。“同时外围操作在线”是假脱机的首字母缩写。假脱机通常存储在物理内存、缓冲区或计算机输入输出设备的中断中。为了按升序处理假脱机,采用先进先出(FIFO)方法。假脱机是在缓冲区中收集和存储来自许多输入输出活动的数据。输入输出设备可以访问这个缓冲区,它是一块内存或硬盘。在分布式环境中,操作系统执行以下任务:- 处理具有不同数据访问速率的输入输出设备的假脱机数据。
- Maintains the spooling buffer, which acts as a temporary data storage region while the slower device catches up.
- The spooling process maintains parallel computing because a computer can do input and output in parallel order. It is now possible for a computer to simultaneously read data from a tape, write data to disc, and print data to a tape printer.
The most obvious application of spooling is in Printing. Before being added to the printing queue, the printed papers are held in the SPOOL. Several programmes can run and use the CPU during this period without having to wait for the printer to finish printing each page individually. Many additional features, such as setting priorities, receiving notifications when the printing process is complete, and selecting different types of paper to print on based on the user's preferences, can be added to the Spooling printing process.
假脱机最明显的应用是在打印中。在加入打印队列之前,打印文件被保存在假脱机中。在此期间,多个程序可以运行并使用CPU,而无需等待打印机逐页完成打印。还可以向假脱机打印过程添加许多额外功能,例如设置优先级、打印过程完成时接收通知,以及根据用户偏好选择不同类型的纸张进行打印。
75. What do you understand about Memory Management in Operating Systems and why is it important?
你对操作系统中的内存管理有何理解,为什么它很重要?
- 知识点: 操作系统与网络 / 编程语言基础 (标签: interviewbit, apisero, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Apisero
- id: 69b3793b58d557c902b991bb | 官方: 否 | 付费: 否
答案:
The operating system occupies a portion of memory in a multiprogramming computer, while the rest is used by many processes. Memory management is the practice of dividing memory across many operations. Memory management is an operating system approach for coordinating actions between main memory and disc during the execution of a task. The primary goal of memory management is to maximize memory use.
在多程序设计计算机中,操作系统占用一部分内存,其余部分由许多进程使用。内存管理是在多个操作之间划分内存的做法。内存管理是操作系统在执行任务期间协调主内存和磁盘之间活动的方法。内存管理的主要目标是最大化内存使用。
Memory Management is necessary because of the following reasons: - Before and after the process, allocation and deallocation of memory are needed.
内存管理是必要的,原因如下:- 在进程执行前后,需要分配和释放内存。
- To keep track of how much memory is being consumed by processes.
- To keep fragmentation to a minimum.
- To make the best use of the main memory.
- To keep data safe while a process is running.
76. What are schedulers in Operating Systems? State and illustrate the kinds of schedulers available in Operating Systems.
什么是操作系统中的调度器?说明并举例操作系统中可用的调度器类型。
- 知识点: 操作系统与网络 (标签: interviewbit, apisero, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Apisero
- id: 69b3793b58d557c902b991be | 官方: 否 | 付费: 否
答案:
Schedulers are specialized computer programs that control the scheduling of processes in various ways. Their main task is to decide which jobs to enter into the system and which processes to conduct.
调度器是专门的控制进程调度方式的计算机程序。它们的主要任务是根据各种方式决定将哪些作业进入系统以及执行哪些进程。
The three types of schedulers are as follows: - Long Term Scheduler: A job scheduler is another name for a long term scheduler. Which applications are admitted for processing into the system is determined by a long term scheduler. It selects processes from the ready queue and loads them into memory before executing them. The process is loaded into memory for CPU scheduling. The basic purpose of the job scheduler is to deliver a well-balanced mix of jobs, such as Input and Output and CPU bound workloads. It also controls the amount of multiprogramming done. The average rate of process formation must be equal to the average rate of process departure from the system if the degree of multiprogramming remains constant.
三种调度器如下:- 长期调度器:长期调度器也称为作业调度器。它决定哪些应用程序被接纳进入系统进行处理。长期调度器从就绪队列中选择进程,并在执行前将它们加载到内存中。进程被加载到内存中以供CPU调度。作业调度器的基本目的是提供平衡的作业混合,如输入输出和CPU密集型工作负载。它还控制多程序的程度。如果多程序的程度保持恒定,进程形成的平均速率必须等于进程离开系统的平均速率。
- Medium Term Scheduler: This type of scheduler is used to swap programmes in the main memory. It frees up the RAM that the processes have used up. As a result, the degree of multiprogramming is minimized. The medium-term scheduler is in charge of the swapped out processes.
- Short Term Scheduler: A CPU scheduler is another name for a short term scheduler. Its main purpose is to increase system performance in accordance with the stated set of criteria. It is the shift from the ready to the running stage of a process. The CPU scheduler selects a process from among those that are ready to run and gives it CPU time. Short term schedulers, often known as dispatchers, choose the next process to run.
77. What do you understand about Socket Programming? State the advantages and disadvantages of Sockets in Java.
你对套接字编程有何理解?说明Java中套接字的优点和缺点。
- 知识点: 操作系统与网络 (标签: interviewbit, apisero, company-specific)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: general
- 公司: Apisero
- id: 69b3793b58d557c902b991c7 | 官方: 否 | 付费: 否
答案:
Socket programming is a technique for allowing two network nodes to communicate. One socket (node) listens for traffic on a specified port at a specific IP address, while the other socket connects to it. The listener socket is created by the server while the client is connected to it.
套接字编程是一种允许两个网络节点通信的技术。一个套接字(节点)在特定IP地址的指定端口上监听流量,而另一个套接字连接到它。监听套接字由服务器创建,而客户端连接到它。
Some advantages of Java Sockets are as follows: - Sockets are versatile and sufficient. Socket based programming is straightforward to implement for ordinary communications.
Java套接字的一些优点如下:- 套接字通用且足够强大。基于套接字的编程对于普通通信来说实现简单。
Sockets are to blame for low network traffic. Unlike HTML forms and CGI scripts, which construct and send entire web pages for each new request, Java applets can simply send the changed information.
Some disadvantages of Java Sockets are as follows: - Security constraints can be burdensome at times because a Java applet running in a Web browser can only connect to the machine from which it came and nowhere else on the network.Java套接字的一些缺点如下:- 安全约束有时可能很烦人,因为Web浏览器中运行的Java小程序只能连接到其来源机器,而不能连接网络上的任何其他位置。
- Socket based connections, despite all of Java's advantages, are limited to the delivery of raw data packets between programs. Both the client and the server must provide mechanisms for turning the data into something useful.
- Because data formats and protocols are application-specific, socket-based systems are limited in their reusability.
78. How would you check if a directory exists in a shell script under Unix/Linux Operating Systems?
在 Unix/Linux 操作系统中,您如何检查某个目录在 shell 脚本中是否存在?
- 知识点: 操作系统与网络 (主题: application-support;标签: interviewbit, application-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3793d58d557c902b9932b | 官方: 否 | 付费: 否
答案:
The test command evaluates conditional expressions. Upon evaluating the expression parameter, the test command returns 0 (True) if the expression is True, otherwise, it returns a nonzero (False) exit value. A nonzero exit value is also returned if no parameters are specified. You can use the test command with the -d option to find out whether a directory exists.
test 命令用于计算条件表达式。计算表达式参数后,如果表达式为真,test 命令返回 0(真),否则,返回非零(假)退出值。如果未指定参数,也会返回非零退出值。你可以使用带 -d 选项的 test 命令来检查目录是否存在。
Example: If you wanted to verify the existence of the directory which is stored in a variable $mydir, you could use the following command expression:
例如:如果你想验证存储在变量 $mydir 中的目录是否存在,可以使用以下命令表达式:
mydir= "home/etc/Datafiles/"
mydir= "home/etc/Datafiles/"
if [ -d "$mydir" ]
if [ -d "$mydir" ]
then
然后
echo "$mydir exists."
echo "$mydir 存在。"
else
else
echo "Error: $mydir does not exist."
echo "错误:$mydir 不存在。"
fi
fi
For directories with white/black spaces in their names, always enclose the variable "$mydir" in double-quotes. For example:
对于名称中包含空格或特殊字符的目录,始终将变量 "$mydir" 用双引号括起来。例如:
mydir= "home/etc/Data Files/"
mydir= "home/etc/Data Files/"
if [ -d "$mydir" ]
if [ -d "$mydir" ]
then
然后
echo " '$mydir' exists."
echo " '$mydir' 存在。"
else
else
echo "Error: '$mydir' does not exist."
echo "错误:'$mydir' 不存在。"
fi
fi
79. Which command is useful to find current user information in Linux/Unix?
在 Linux/Unix 中,哪个命令有助于查找当前用户信息?
- 知识点: 操作系统与网络 (主题: application-support;标签: interviewbit, application-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3793d58d557c902b99331 | 官方: 否 | 付费: 否
答案:
To find out which users are currently logged in to your server or system, use the who command. The who command provides the following information: - Last system boot time
要查看当前登录到您的服务器或系统的用户,请使用 who 命令。who 命令提供以下信息:- 上次系统启动时间
- Current system run-level
List of users logged in, etc.
Syntax:语法:
$ who [options] [filename]
Examples: - No Option: If no option is specified, the who command displays the following information for each user currently logged on to the system:
示例:- 无选项:如果未指定选项,who 命令会为当前登录系统的每个用户显示以下信息:
The user's login name The user's login time The user's remote hostname Terminal line numbers
用户的登录名 用户的登录时间 用户的远程主机名 终端行号
Command
命令
$ who
Output
输出
user@host-0231:~$ who
user@host-0231:~$ who
gourav pts/0 2021-03-10 17:04 (:0.0)
gourav pts/0 2021-03-10 17:04 (:0.0)
sonia pts/1 2021-03-10 18:23 (:0.0)
sonia pts/1 2021-03-10 18:23 (:0.0)
- Option H: This option displays the headers of columns displayed by the who command.
Command
命令
$ who -H
Output
输出
user@host-0231:~$ who -H
user@host-0231:~$ who -H
NAME LINE TIME COMMENT
NAME LINE TIME COMMENT
gourav pts/0 2021-03-10 17:04 (:0.0)
gourav pts/0 2021-03-10 17:04 (:0.0)
- Option whoami: This displays the actual username of the system.
Command
命令
$ whoami
Output
输出
gkuser@host-0231:~$ whoami
gkuser@host-0231:~$ whoami
gkuser
gkuser
80. What exactly is a Bootstrap Program in terms of operating systems?
在操作系统方面,引导程序到底是什么?
- 知识点: 操作系统与网络 (标签: interviewbit, arcesium, company-specific)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: general
- 公司: Arcesium
- id: 69b3793d58d557c902b993a8 | 官方: 否 | 付费: 否
答案:
A Bootstrap Program is typically a program that initialises the operating system during the startup of a computer system, in other words, the first program that runs when a computer system starts up. Booting is a method or application for loading the operating system. Overall, the bootstrap program is completely responsible for the operating system's performance and functionality. It is totally stored in boot blocks at a specific spot on the disc. It also locates and loads the kernel into the main memory before starting the program. The Bootstrap Program, as shown in the figure below, lies in the Read-Only Memory (ROM) of our computers and is responsible for reading the Operating Systems and loading them into the RAM (Random Access Memory) of our computers. After then, the operating systems can start other computer devices such as graphics cards, keyboards, and mice.
引导程序通常是在计算机系统启动期间初始化操作系统的程序,换句话说,它是计算机系统启动时运行的第一个程序。引导是一种加载操作系统的方法或应用程序。总的来说,引导程序完全负责操作系统的性能和功能。它完全存储在磁盘上特定位置的引导块中。它还在启动程序之前定位并加载内核到主内存中。如下面的图所示,引导程序位于我们计算机的只读存储器(ROM)中,负责读取操作系统并将其加载到我们计算机的随机存取存储器(RAM)中。之后,操作系统可以启动其他计算机设备,如图形卡、键盘和鼠标。
81. Give a list of the different types of operating systems you are familiar with. Include some examples of each type of operating system as well.
列出你熟悉的操作系统类型不同列表。并包括每种操作系统的一些示例。
- 知识点: 操作系统与网络 (标签: interviewbit, arcesium, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Arcesium
- id: 69b3793d58d557c902b993ab | 官方: 否 | 付费: 否
答案:
The following are some of the several types of operating systems: - Distributed Operating Systems: A distributed operating system (DOS) is software that manages numerous computers as if they were one.
以下是几种操作系统类型中的一些:- 分布式操作系统:分布式操作系统(DOS)是一种将众多计算机当作一台来管理的软件。
- Batch Operating System: This operating system interacts with the computer indirectly. There is a worker who organises linked jobs into batches based on their requirements. It is the operator's responsibility to group jobs that have comparable needs together.
- Real-Time Operating Systems: Real-Time Operating Systems (RTOS) are employed in situations when a significant number of events, the bulk of which are external to the computer system, must be accepted and processed quickly or within a tight deadline. Industrial control, telephone switching equipment, aircraft control, and real-time simulations are examples of such uses.
- Network Operating Systems: Network Operating Systems allow computers with different operating systems to join the same network. It's routinely used in the name of security.
Time-Sharing Operating System: A time-sharing operating system allows numerous people to use the same computer at the same time. This operating system makes the most of the available resources.
Some examples of operating systems are as follows: - Microsoft Windows is an operating system developed by Microsoft (Graphical User Interface Operating System based for Personal Computers)操作系统的一些示例如下:- Microsoft Windows 是由微软开发的操作系统(基于图形用户界面的个人计算机操作系统)
- iOS is Apple's mobile operating system (iPhone, iPad, and iPod Touch operating system)
- MacOS is the operating system that runs on Apple's personal computers and workstations, such as the MacBook and iMac.
- GNU or Linux (for Personal Computers, File and Print server, Workstations, ISP, Three-tier Clients and Servers)
- Android (Google's mobile operating system for smartphones, tablets, smartwatches, and other devices) is a mobile operating system developed by Google.
82. What do you know about demand paging in operating systems?
你对操作系统中的请求分页了解多少?
- 知识点: 操作系统与网络 (标签: interviewbit, arcesium, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Arcesium
- id: 69b3793d58d557c902b993ae | 官方: 否 | 付费: 否
答案:
Demand paging in operating systems is a strategy for loading pages (a page is the smallest unit of data for memory management in a virtual memory operating system). A page frame is the smallest contiguous unit of physical memory with a predetermined length into which the operating system maps memory pages) only when they are needed. Virtual Memory is a storage allocation method that makes it possible to address secondary memory as if it were the main memory. The addresses used by a program to refer to memory are different from the addresses used by the memory system to designate physical storage sites, and the addresses created by the program are automatically converted to machine addresses. The quantity of secondary memory available is defined by the number of main storage sites available rather than the actual number of main storage locations, and the capacity of virtual storage is restricted by the computer system's addressing scheme.
操作系统中的请求分页是一种仅在需要时才加载页面(页面是虚拟内存操作系统中内存管理的最小数据单位)的策略。页框是具有预定长度的最小连续物理内存单元,操作系统将内存页映射到其中。虚拟内存是一种存储分配方法,它使得可以将辅助存储器当作主存储器来寻址。程序用于引用内存的地址与内存系统用于指定物理存储位置的地址不同,并且程序创建的地址会自动转换为机器地址。可用辅助存储器的数量由可用主存储位置的数量而非主存储位置的实际数量决定,而虚拟存储器的容量受计算机系统寻址方案的限制。
When a place on the page is addressed during execution, the page is only brought into memory. The following are the steps for getting a page into the main memory or demand paging: - An attempt is made by the operating system to visit the page.
当执行期间访问页面上的某个位置时,该页面才会被调入内存。以下是使页面进入主内存或请求分页的步骤:- 操作系统尝试访问该页面。
- If the page is valid, the CPU proceeds to process instructions as usual (in memory).
- When a page is wrong, the operating system performs a page fault trap.
- The operating system then examines the memory reference to see if it is a valid reference to a secondary memory location. The process will be cancelled if this is not the case (illegal memory access). Otherwise, the operating system will have to read the page from the main memory.
- The operating system arranges a disc operation to read the desired page into the main memory.
- The operation that was paused as a result of the operating system trap is then restarted or continued.
83. In the context of operating systems, define microkernels.
在操作系统的上下文中,定义微内核。
- 知识点: 操作系统与网络 (标签: interviewbit, arcesium, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Arcesium
- id: 69b3793e58d557c902b993ed | 官方: 否 | 付费: 否
答案:
One of the kernel's classes is the microkernel. Because it is a kernel, it is in charge of all system resources. In a microkernel, however, user and kernel services are implemented in separate address zones. Because user services are placed in user address space and kernel services are located in kernel address space, the kernel and operating system are both smaller. It just offers the minimal essentials in terms of process and memory management. The execution microkernel is slowed by message forwarding, which is used to establish communication between client programs/applications and services executing in user address space. Because user and kernel services are separated, the Operating System is unaffected if one fails. As a result, one of the microkernel's advantages is enhanced. It's simple to extend since new services are added to the user address space rather than the kernel address area, requiring no kernel changes. It's also portable, secure, and dependable. The architecture of a microkernel is shown below:
内核的类别之一是微内核。由于它是内核,因此负责所有系统资源。然而,在微内核中,用户服务和内核服务在单独的地址区域中实现。由于用户服务位于用户地址空间,而内核服务位于内核地址空间,因此内核和操作系统都更小。它仅在进程和内存管理方面提供最基本的功能。执行微内核会因消息转发而变慢,消息转发用于建立客户端程序/应用程序与在用户地址空间中执行的服务之间的通信。由于用户服务和内核服务是分离的,因此如果其中一个发生故障,操作系统不受影响。因此,微内核的优点之一得到了增强。它易于扩展,因为新服务被添加到用户地址空间而非内核地址区域,无需修改内核。它还具有可移植性、安全性和可靠性。微内核的体系结构如下所示:
The following are some of Microkernel's advantages: - This kernel performs better because of its compact and isolated architecture.
以下是微内核的一些优点:- 由于其紧凑且隔离的体系结构,此内核性能更好。
- The system can be expanded more easily since it can be added to the system application without disrupting the kernel.
84. What are the different types of attributes present in BGP?
BGP 中存在哪些不同类型的属性?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b950 | 官方: 否 | 付费: 否
答案:
Following are the different types of attributes present in bgp:
以下是 BGP 中存在的不同类型的属性:
Well-known mandatory: All BGP peers recognise it, it is forwarded to all peers, and it is present in all Update messages. The following are some of the well-known mandatory attributes :
Next-hop下一跳
Origin
来源
AS PATH
AS路径Well-known discretionary: All routers recognise it, it's sent to all peers, and it's optionally included in the Update message. The following are some of the well-known discretionary attributes :
Local Preference本地偏好
Atomic Aggregate
原子聚合Optional transitive: It's possible that BGP routers will recognise it and transmit it on to BGP peers. When optional transitive qualities are not recognised, they are denoted as partial. The following are examples of optional transitive attributes:
Aggregator聚合器
Community
社区Optional non-transitive: BGP routers may recognise it, but it is not forwarded to peers. The following are some of the optional non-transitive attributes :
Multi-exit discriminator (MED)多出口鉴别器(MED)
Originator ID
发起者ID
Cluster-ID
集群ID
85. What exactly do you mean by a route reflector in the context of Border Gateway Protocol? Why is it necessary?
在边界网关协议的上下文中,路由反射器到底是什么意思?为什么它是必要的?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b953 | 官方: 否 | 付费: 否
答案:
In BGP, a route reflector is a router which is capable of breaking the internal Border Gateway Protocol (iBGP) loop avoidance rule. Under certain settings, a route reflector can broadcast updates received from an iBGP peer to another iBGP peer.
在BGP中,路由反射器是一种能够打破内部边界网关协议(iBGP)环路避免规则的路由器。在某些设置下,路由反射器可以将从iBGP对等体接收到的更新广播给另一个iBGP对等体。
By breaking the criterion and designing iBGP networks that scale quickly and cleanly, route reflectors are employed to eliminate the full mesh requirement.
通过打破该规则并设计可快速且简洁扩展的iBGP网络,路由反射器被用来消除全互联(full mesh)的要求。
86. Mention some of the well known BGP metric’s attributes.
提及一些众所周知的BGP度量属性。
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b956 | 官方: 否 | 付费: 否
答案:
BGP path selection is based on the values of the following attributes: - Weight
BGP路径选择基于以下属性的值: - 权重
- Local Preference (highest local value will be preferred, default value is 100)
- Originate
- AS path length
- Origin code
- Multi-Exit Discriminator (MED)
- eBGP path over iBGP path
- Shortest IGP path to BGP next hop
- Oldest path
- Router ID
- Neighbor IP address.
87. What are the characteristics of the Border Gateway Protocol (BGP)?
边界网关协议(BGP)有哪些特征?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b959 | 官方: 否 | 付费: 否
答案:
Following are the characteristics of the Border Gateway Protocol: - Configuration of Inter-Autonomous Systems: The Border Gateway Protocol's primary function is to provide communication between two autonomous systems.
以下是边界网关协议的特征:- 自治系统间的配置:边界网关协议的主要功能是提供两个自治系统之间的通信。
- Next-Hop Paradigm is supported by the Border Gateway Protocol.
- Within the autonomous system, there is coordination among several BGP speakers.
- Path Information: In addition to the reachable destination and next destination pair, BGP advertisements offer path information.
- In the routing-decision algorithm of BGP, numerous attributes are used.
- External neighbours between various autonomous systems are communicated via eBGP.
- Internal neighbours inside the same autonomous system use iBGP.
- It uses weight to alter the outward traffic routing from a single locally configured router.
- Policy Support: The Border Gateway Protocol can implement policies that the administrator can configure. A router running BGP, for example, can be set to discriminate between routes known within the autonomous system and routes known from outside the autonomous system.
- TCP (Transmission Control Protocol) is used in conjunction with Border Gateway Protocol.
- Border Gateway Protocol helps networks save bandwidth.
- Classless Inter-Domain Routing (CIDR) is supported by BGP.
- Security is also supported by BGP.
88. What are the various BGP Neighbor Adjacency States?
BGP 邻居邻接状态有哪些?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b95c | 官方: 否 | 付费: 否
答案:
Before any routing information is transmitted, BGP establishes a neighbour adjacency with other routers, similar to OSPF (Open Shortest Path First) or EIGRP (Enhanced Interior Gateway routing Protocol). BGP, on the other hand, does not use broadcast or multicast for BGP neighbour discovery; instead, neighbours are manually configured and communicate over TCP/179.
在传输任何路由信息之前,BGP 会与其他路由器建立邻居邻接关系,类似于 OSPF(开放最短路径优先)或 EIGRP(增强内部网关路由协议)。然而,BGP 不使用广播或多播进行 BGP 邻居发现;相反,邻居是手动配置的,并通过 TCP/179 进行通信。
Two BGP systems will go through a succession of BGP Neighbor Adjacency States before becoming neighbours. They are as follows:
两个 BGP 系统在成为邻居之前,会经历一系列 BGP 邻居邻接状态。具体如下:
- Idle - The router initialises BGP resources. Attempts to establish a BGP incoming connection are rejected. The BGP protocol establishes a TCP connection with the peer.
- Connect - BGP waits for the three way handshake to finish. The OPEN message is transmitted to the peer if it is successful, and BGP shifts to the OpenSent state. If we are unsuccessful, we will return to the Active state. If the ConnectRetry timeout expires, however, BGP will continue in this condition, with the timer reset and a new three way handshake launched.
- Active - BGP returns to the Connect state after the ConnectRetry timeout is reset.
- OpenSent - BGP waits for an OPEN message from its peer before sending it. BGP enters the OpenConfirm state after receiving a message.
- OpenConfirm - BGP waits for a peer to send a keepalive message. BGP goes to the Established state if a response is received before the timeout ends. Otherwise, BGP switches to Idle mode.
- Established - Both peers exchange UPDATE messages once the connection is established. If any of the UPDATE messages include an error, the BGP peer will send a NOTIFICATION message and enter the Idle state.
89. Is it possible to utilise BGP (Border Gateway Protocol) instead of any IGP (Interior Gateway Protocol)?
是否可以使用 BGP(边界网关协议)代替任何 IGP(内部网关协议)?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b95f | 官方: 否 | 付费: 否
答案:
No, we can't use BGP instead of any IGP because BGP connects different autonomous systems, whereas IGP works inside autonomous systems.
不,我们不能使用 BGP 代替任何 IGP,因为 BGP 连接不同的自治系统,而 IGP 在自治系统内部工作。
90. What are the different types of Timers present in BGP?
BGP 中存在哪些不同类型的定时器?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b963 | 官方: 否 | 付费: 否
答案:
Following are the different types of Timers present in BGP : - Keep Alive Timer : This is the heartbeat timer, in which a local neighbour sends a BGP heart-beat packet to a remote neighbour at regular intervals to check reachability and availability. This interval is set to '30' seconds by default.
以下是 BGP 中存在的不同类型定时器:- 保持活动定时器:这是心跳定时器,本地邻居定期向远程邻居发送 BGP 心跳数据包,以检查可达性和可用性。此间隔默认设置为“30”秒。
- Hold down Timer : This is the amount of time that the local neighbour must wait before declaring the remote neighbour unavailable. This interval is set at "90" seconds by default, which is '3' times the Keep-Alive Interval. In other words, if a local neighbour misses three Keep-Alive packets in a row from a remote neighbour, the local neighbour considers the remote neighbour unavailable and changes the status of the neighbourship, as well as removing all associated routes advertised by the neighbour from the routing table/BGP table. Before and after the hold-down timer expires, the BGP neighbour status changes. The hold down timer is set to 90 seconds by default, and after that, the local neighbour moves through various stages like 'idle,' 'connect,' and 'active.' The status changes to 'Idle' at first, then to 'Connect' after 5 seconds, and then to 'Active' after 10 seconds.
- Advertisement Interval : The BGP Advertisement Interval is a timer that determines how much time must pass between a route being advertised and being removed from a BGP peer. For eBGP peers, the default is 30 seconds, and for iBGP peers, it's 5 seconds. This can be modified on a per-neighbor basis.
91. In BGP, what is the order of preference?
在 BGP 中,偏好顺序是什么?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b96b | 官方: 否 | 付费: 否
答案:
The order of preference in BGP differs depending on whether the attributes are used for inbound or outbound updates.
BGP 中的偏好顺序根据属性是用于入站还是出站更新而有所不同。
The following is the order of preference for inbound updates:
以下是入站更新的偏好顺序:
Route-map 2. Filter-list 3. Prefix-list 4. distribute-list
- 路由映射 2. 过滤列表 3. 前缀列表 4. 分发列表
The following is the order of preference for outgoing updates:
以下是出站更新的偏好顺序:
Filter-list 2. Route-map | unsuppress-map 3. Advertise-map (conditional-advertisement) 4. Prefix-list 5. distribute-list.
- 过滤列表 2. 路由映射 | 解除抑制映射 3. 通告映射(条件通告) 4. 前缀列表 5. 分发列表。
92. Is authentication possible with BGP? If yes, explain how.
BGP 是否支持认证?如果支持,请解释如何实现。
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b96e | 官方: 否 | 付费: 否
答案:
Yes. MD5 authentication is supported by BGP. BGP allows neighbours to authenticate each other using MD5 and a shared password. It is set up with the following command neighbour {ip-address | peer-group-name} password password in BGP router setup mode. When authentication is enabled, BGP verifies the source of each routing update and authenticates every TCP segment from its peer. Authentication is required by most ISPs for their EBGP peers.
是的。BGP 支持 MD5 认证。BGP 允许邻居使用 MD5 和共享密码相互认证。在 BGP 路由器配置模式下,使用以下命令进行设置:neighbor {ip-address | peer-group-name} password password。当启用认证时,BGP 会验证每个路由更新的来源,并对其对等体的每个 TCP 段进行认证。大多数 ISP 要求其 EBGP 对等体进行认证。
Peering works only if both routers have the same password and are configured for authentication. When a router has a password configured for a neighbour but the neighbour router does not, the console displays a message like this when the routers try to create a BGP session.
只有当两台路由器具有相同的密码并配置了认证时,对等才能正常工作。当一台路由器为邻居配置了密码,而邻居路由器没有配置时,当路由器尝试建立BGP会话时,控制台会显示类似这样的消息。
%TCP-6-BADAUTH: No MD5 digest from [peer's IP address]:11003 to
%TCP-6-BADAUTH: 来自[对等方的IP地址]:11003的MD5摘要缺失,无法连接到
Similarly, if the two routers are configured with different passwords, a message like this will appear on the screen:
类似地,如果两台路由器配置了不同的密码,屏幕上会出现类似这样的消息:
%TCP-6-BADAUTH: Invalid MD5 digest from [peer's IP address]:11004 to [local router's IP address]:179
%TCP-6-BADAUTH: 来自[对等方的IP地址]:11004的MD5摘要无效,无法连接到[本地路由器的IP地址]:179
93. What do you understand by peers in the context of BGP? What is the purpose of BGP peer groups?
在BGP上下文中,你对对等的理解是什么?BGP对等组的目的又是什么?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b971 | 官方: 否 | 付费: 否
答案:
BGP peers are two routers that have established a link for exchanging BGP information. Such BGP peers provide routing information via TCP-based BGP sessions, which are dependable, connection-oriented, and error-free protocols.
BGP对等是指两台已建立连接以交换BGP信息的路由器。这样的BGP对等通过基于TCP的BGP会话提供路由信息,这些会话是可靠、面向连接且无差错的协议。
The above image shows a BGP peering session between two BGP routers. We may utilise peer groups to simplify BGP configuration and reduce the amount of updates BGP has to produce. We can create a peer group with the neighbours and then apply all of our setups to it.
上图显示了两个BGP路由器之间的BGP对等会话。我们可以利用对等组来简化BGP配置并减少BGP需要产生的更新量。我们可以创建一个包含邻居的对等组,然后将所有配置应用于该组。
94. What do you understand about poison reverse in the context of BGP?
在BGP上下文中,你对毒性反转有什么理解?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b974 | 官方: 否 | 付费: 否
答案:
Poison Reverse: The Poison Reverse algorithm is a widely used distance-vector routing algorithm. To solve the count-to-infinity problem, poison reverse is used. To put it another way, poison reverse is the inverse of the split horizon. Route advertisements that would be muted by split horizon are instead advertised at a distance of infinity with poison reverse. Poison reverse is a RIP (Routing Information Protocol) technique. When path information becomes invalid, routers do not instantly remove it from the routing database; instead, they broadcast a hop-count of 16, which is an unreachable metric value. This increases the size of the routing table but aids in the elimination of loops. It can break any loop between neighbouring routers right away. The main notion of poison reverse is to ensure that a path does not return to the same node if the network's cost has changed.
毒性反转:毒性反转算法是广泛使用的距离向量路由算法之一。为了解决无限计数问题,使用了毒性反转。换句话说,毒性反转是水平分割的逆过程。水平分割会抑制的路由通告,在毒性反转中则以无限距离进行通告。毒性反转是RIP(路由信息协议)的一种技术。当路径信息变得无效时,路由器不会立即将其从路由数据库中删除,而是广播一个跳数为16的值,这是一个不可达的度量值。这会增加路由表的大小,但有助于消除环路。它能立即打破相邻路由器之间的任何环路。毒性反转的主要概念是确保在网络成本改变时,路径不会返回到同一节点。
95. What do you understand about split horizon in the context of BGP? Explain with an example.
在BGP上下文中,你对水平分割有什么理解?并举例说明。
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b977 | 官方: 否 | 付费: 否
答案:
Split Horizon: The split horizon is a method employed by distance vector protocols to prevent network routing loops. The underlying premise is straightforward: never send routing information back in the same direction it came from. It is necessary to have a split-horizon because distance vector protocols like Routing Information Protocol (RIP) are prone to routing loops, which occur when a data packet is caught in an unending loop and routed through the same routers over and over again. Split horizon is frequently used in protocols to avoid loops. Different strategies are used to prevent packet looping in other protocols, such as Open Shortest Path First.
水平分割:水平分割是距离向量协议用来防止网络路由环路的一种方法。其基本原理很简单:永远不要将路由信息沿其来源方向发送回去。水平分割是必要的,因为像路由信息协议(RIP)这样的距离向量协议容易产生路由环路,这发生在数据包被困在无限循环中并反复通过相同路由器路由时。水平分割经常在协议中用于避免环路。其他协议(如开放最短路径优先)则使用不同策略来防止数据包循环。
When split horizon is enabled, a router is prevented from advertising a route back to the router from whence it learnt it. To put it another way, if a router receives routing information from another router, the first router will not broadcast it back to the second router, preventing routing loops.
当启用水平分割时,会阻止路由器将路由通告回其学习来源的路由器。换句话说,如果路由器从另一个路由器接收到路由信息,第一个路由器不会将其广播回第二个路由器,从而防止路由环路。
Example: An example of three routers used to forward packets between networks is shown in the diagram below. The R3 router transmits routing information about the 10.0.0.0/16 network to the R2 router in this simple architecture. This information is received by the R2 router, which modifies its routing table and broadcasts it to the R1 router. The R1 router modifies its routing database when it receives this information.
示例:下图展示了三个路由器在网络间转发数据包的例子。在这个简单架构中,R3路由器将关于10.0.0.0/16网络的路由信息传输给R2路由器。R2路由器接收此信息,修改其路由表,并将其广播给R1路由器。R1路由器接收到此信息后修改其路由数据库。
The modified routing information allows the R1 router to send packets to the 10.0.0.0/16 network via the R2 and R3 routers. The R1 router will not be able to advertise this network route back to the R2 router if a split horizon is enabled. If the R1 router does not have split-horizon enabled, it will broadcast the route to the R2 router, which will update its routing table to reflect the network route available through the R1 router.
修改后的路由信息使R1路由器能够通过R2和R3路由器向10.0.0.0/16网络发送数据包。如果启用了水平分割,R1路由器将无法将此网络路由通告回R2路由器。如果R1路由器未启用水平分割,它会将路由广播给R2路由器,R2路由器将更新其路由表以反映通过R1路由器可用的网络路由。
The presence of the R1 route in the R2 routing database is not an issue in typical operations because it is plainly a lot more expensive route than a direct R2-to-R3 connection. If the R2-to-R3 connection fails and the R2 router receives a packet from R1 destined for the 10.0.0.0/16 network, the R2 router will return the packet to R1 because the router advertised a functional network path. However, based on its own routing information, the R1 router will just return the packet to the R2 router, resulting in a routing loop that will continue until the packet dies. The R1 router will not advertise the network route to the R2 router if the split horizon is enabled, preventing the routing loop.
在正常操作中,R2路由数据库中R1路由的存在通常不是问题,因为它显然比直接的R2到R3连接昂贵得多。如果R2到R3连接失败,且R2路由器从R1接收到目的为10.0.0.0/16网络的数据包,R2路由器会将数据包返回给R1,因为该路由器通告了一条功能性网络路径。然而,根据其自身的路由信息,R1路由器只会将数据包返回给R2路由器,从而产生一个持续到数据包消亡的路由环路。如果启用了水平分割,R1路由器将不会向R2路由器通告网络路由,从而防止了路由环路。
96. Differentiate between internal Border Gateway Protocol (iBGP) and external Border Gateway Protocol (eBGP).
区分内部边界网关协议(iBGP)和外部边界网关协议(eBGP)。
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b97a | 官方: 否 | 付费: 否
答案:
- internal Border Gateway Protocol(iBGP): Inside autonomous systems, IBGP is used. Its purpose is to feed data to your internal routers. For prefix learning, all devices in the same autonomous system must form a full mesh topology or use either Route reflectors or Confederation.
- external Border Gateway Protocol (eBGP): It is employed between autonomous systems. It's used and deployed at the edge or border router, which connects two or more autonomous systems together. It is the protocol that allows networks from various organisations or the Internet to communicate with one another.
The following table lists the differences between the internal Border Gateway Protocol and the external Border Gateway Protocol:
下表列出了内部边界网关协议和外部边界网关协议之间的差异:
| internal Border Gateway Protocol (iBGP) 内部边界网关协议(iBGP) | external Border Gateway Protocol (eBGP) 外部边界网关协议(eBGP) |
|---|---|
| It connects two BGP routers in a single autonomous system. 它在单个自治系统内连接两个BGP路由器。 | It connects two BGP routers in separate independent systems. 它在独立的系统之间连接两个BGP路由器。 |
| Its Administrative Distance is set to 200 by default. 其管理距离默认设置为200。 | Its Administrative Distance is set to 20 by default. 其管理距离默认设置为20。 |
| IBGP routes obtained from an IBGP peer can be broadcast to an EBGP peer but not to another IBGP peer. 从iBGP对等体获得的IBGP路由可以广播给eBGP对等体,但不能广播给另一个iBGP对等体。 | EBGP routes can be published to EBGP and IBGP peers when received from an EBGP peer. 从eBGP对等体接收的EBGP路由可以发布给eBGP和iBGP对等体。 |
| It necessitates the use of full mesh topology. 它需要使用全网状拓扑。 | It does not necessitate a complete mesh topology. 它不需要完整的网状拓扑。 |
| Within the same corporation, it's used. 在同一个公司内部使用。 | It's used between corporations or between corporations and Internet service providers. 用于公司之间或公司与互联网服务提供商之间。 |
| For loop prevention, it employs BGP Split Horizon. 为防止环路,它采用BGP水平分割。 | It prevents loops by using an AS path. 它通过使用AS路径来防止环路。 |
| TTL (Time To Live) = 255 is the default setting for peers. 对等体的TTL(生存时间)= 255是默认设置。 | TTL (Time To Live) = 1 is the default setting for peers. 对等体的TTL(生存时间)= 1是默认设置。 |
| Attributes such as local preference are exchanged between IBGP peers. 诸如本地优先级之类的属性在iBGP对等体之间交换。 | Attributes such as local preference are not communicated between EBGP peers. 诸如本地优先级之类的属性不在eBGP对等体之间传递。 |
| The next hop remains constant when a route is advertised to an IBGP peer. 当路由通告给iBGP对等体时,下一跳保持不变。 | When a route is announced to an EBGP peer, the local router becomes the next hop. 当路由通告给eBGP对等体时,本地路由器成为下一跳。 |
97. What do you understand by Routing Information Protocol (RIP) in the context of networking?
在网络背景下,你如何理解路由信息协议(RIP)?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b97d | 官方: 否 | 付费: 否
答案:
The Routing Information Protocol (RIP) is a dynamic routing protocol that finds the optimum path between the source and destination networks by using hop count as a routing metric. It is a distance-vector routing protocol with an AD value of 120 that operates at the OSI application layer. The RIP protocol uses port 520. The number of routers between the source and destination networks is referred to as the hop count. The path with the fewest hops is deemed the best route to a network and is thus entered into the routing table. The number of hops allowed in a path between source and destination is limited by RIP, which eliminates routing loops. The maximum number of hops allowed by RIP is 15, and a hop count of 16 is considered unreachable by the network.
路由信息协议(RIP)是一种动态路由协议,它通过使用跳数作为路由度量来找到源网络和目标网络之间的最优路径。它是一种距离向量路由协议,管理距离值为120,工作在OSI应用层。RIP协议使用端口520。源网络和目标网络之间的路由器数量被称为跳数。跳数最少的路径被视为到达网络的最佳路由,因此被输入路由表。RIP限制了源和目标之间路径中允许的跳数,从而消除了路由环路。RIP允许的最大跳数是15,跳数16被网络视为不可达。
Following are the features of Routing Information Protocol (RIP): - Network updates are exchanged on a regular basis.
以下是路由信息协议(RIP)的特点:- 网络更新定期交换。
- Routing information (updates) are always broadcast.
- Routing tables in their entirety are sent in updates.
- Routing information received from nearby routers is always trusted by routers. This is also known as rumour routing.
98. Is it possible to run two BGP processes on the same router?
在同一台路由器上运行两个BGP进程是否可能?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b980 | 官方: 否 | 付费: 否
答案:
No, you can't have two BGP processes running on the same router. This is because BGP is an Exterior Gateway Protocol.
不,你不能在同一台路由器上运行两个BGP进程。这是因为BGP是一种外部网关协议。
99. Is it possible for routers on different subnets to become BGP neighbours?
不同子网上的路由器是否可能成为BGP邻居?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b983 | 官方: 否 | 付费: 否
答案:
BGP is frequently set up between two routers that are directly connected and belong to distinct autonomous systems. BGP routers don't require their neighbours to be on the same subnet. Instead, they employ a TCP connection between the routers to send and receive BGP messages, allowing neighbouring routers to be on the same or distinct subnets.
BGP通常设置在两个直接连接且属于不同自治系统的路由器之间。BGP路由器不要求其邻居位于同一子网。相反,它们使用路由器之间的TCP连接来发送和接收BGP消息,允许相邻路由器位于相同或不同的子网上。
100. What port number is used by the border gateway protocol?
边界网关协议使用什么端口号?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b986 | 官方: 否 | 付费: 否
答案:
The Border Gateway Protocol uses the Transmission Control Protocol (TCP) port number 179.
边界网关协议使用传输控制协议(TCP)端口号179。
101. To connect the C program and the operating system, what structure is used?
使用什么结构来连接 C 程序和操作系统?
- 知识点: 操作系统与网络 (标签: interviewbit, capgemini, company-specific)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: general
- 公司: Capgemini
- id: 69b379f058d557c902ba16d1 | 官方: 否 | 付费: 否
答案:
The file structure is used to connect the operating system and an application. The header file “stdio.h” (standard input/output header file) defines the file. It contains information on the currently open file, its current size, and its memory location. It has a character pointer that indicates which character is currently being opened. When you open a file, you're telling the software and the operating system which file you want to open.
文件结构用于连接操作系统和应用程序。头文件“stdio.h”(标准输入/输出头文件)定义了该文件。它包含有关当前打开文件、其当前大小及其内存位置的信息。它有一个字符指针,指示当前正在打开哪个字符。当您打开文件时,您是在告诉软件和操作系统您要打开哪个文件。
102. What is a DNS (Domain Name System) forwarder?
什么是 DNS(域名系统)转发器?
- 知识点: 操作系统与网络 (标签: interviewbit, capgemini, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Capgemini
- id: 69b379f058d557c902ba16fe | 官方: 否 | 付费: 否
答案:
A DNS forwarder is a DNS server that forwards DNS queries for external DNS names to DNS servers outside the network. A forwarder is used with a DNS server when it receives DNS queries that cannot be resolved quickly. Therefore, it forwards these requests to external DNS servers for resolution.
DNS 转发器是一种 DNS 服务器,它将针对外部 DNS 名称的 DNS 查询转发到网络外部的 DNS 服务器。当 DNS 服务器收到无法快速解析的 DNS 查询时,会使用转发器。因此,它将这些请求转发到外部 DNS 服务器进行解析。
A DNS server that is configured as a forwarder behaves differently than a DNS server that is not configured as a forwarder.
配置为转发器的 DNS 服务器的行为与未配置为转发器的 DNS 服务器不同。
The DNS server behaves as follows when configured as a forwarder: - When the query is received by the DNS server, it resolves it using a cache.
当配置为转发器时,DNS 服务器的行为如下:- 当 DNS 服务器收到查询时,它使用缓存来解析它。
- If the DNS server is not able to resolve the request, it forwards it to another DNS server.
- If the forwarder is not available, it tries to resolve the query using a root hint.
103. What do you mean by User mode and Privileged mode?
你所说的用户模式和特权模式是什么意思?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2ae0 | 官方: 否 | 付费: 否
答案:
User Mode: User mode is generally used to view the configurations of the routers. It allows us to view basic system information, check router status, connect to remote devices, etc. User mode is mostly used to perform regular tasks on the router when we are using a Cisco router. Privileged Mode: Privileged mode is generally used to view all the configurations on the router. It allows you to change configurations that are less important. Privileged mode is mostly used to perform high-level tasks on the routers such as making configurations and debugging.
用户模式:用户模式通常用于查看路由器的配置。它允许我们查看基本系统信息、检查路由器状态、连接到远程设备等。当我们使用Cisco路由器时,用户模式主要用于执行常规任务。特权模式:特权模式通常用于查看路由器上的所有配置。它允许您更改不太重要的配置。特权模式主要用于在路由器上执行高级任务,例如进行配置和调试。
104. What do you mean by Windows in terms of networking?
在网络术语中,你所说的窗口是什么意思?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2ae3 | 官方: 否 | 付费: 否
答案:
In terms of networking, the window is the number of segments that are allowed to be transferred from the source to the destination before any acknowledgment is sent.
在网络方面,窗口是指在发送任何确认之前允许从源传输到目标的分段数量。
105. What is the function of an LLC sublayer?
LLC子层的作用是什么?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37a1058d557c902ba2ae6 | 官方: 否 | 付费: 否
答案:
LLC (Logical Link Control) is basically the upper sublayer of the data link layer and acts as an interface between the network layer and MAC sublayer of the data link layer of the OSI model. This sublayer provides the logic for data link as it controls the synchronization, flow control, multiplexing, and also error checking functions of the data link layer. It simply provides optional services to an application developer.
LLC(逻辑链路控制)基本上是数据链路层的上层子层,充当OSI模型中网络层与数据链路层MAC子层之间的接口。该子层为数据链路提供逻辑,因为它控制数据链路层的同步、流控制、多路复用以及错误检查功能。它只是为应用程序开发人员提供可选服务。
106. Explain network latency.
解释网络延迟。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2ae9 | 官方: 否 | 付费: 否
答案:
Network latency basically represents the delay in communication over a network. It simply refers to the performance of one device when it communicates with another. It is the time taken for some data to go from the source to its destination across the network. Network latency can be affected by bandwidth speed, cabling, network card performance, and congestion.
网络延迟基本上表示网络上通信的延迟。它只是指一台设备与另一台设备通信时的性能。它是某些数据通过网络从源到目的地所需的时间。网络延迟可能受到带宽速度、布线、网卡性能和拥塞的影响。
107. Name different memories that are used in CISCO routers.
说出CISCO路由器中使用的不同存储器。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2aee | 官方: 否 | 付费: 否
答案:
Different memories that are used in CISCO router include: - NVRAM (Non-volatile RAM): It is used to store startup configuration files. It also retains its content even after a device is restarted or powered down.
CISCO路由器中使用的不同存储器包括:- NVRAM(非易失性随机存取存储器):用于存储启动配置文件。即使在设备重启或断电后,它也能保留其内容。
- DRAM (Dynamic Random-Access Memory): It is used to store configuration files that are being executed. It loses its content when a device is restarted.
- ROM (Read Only Memory): It is used to store a bootstrap program that initializes a boot process. It also runs and maintains instructions for POST diagnostics.
- Flash Memory: It is used to store CISCO IOS. It can also be used to store other files such as backup configuration files.
- Data Science
- All Events
- My Events
108. What do you mean by data packets?
你所说的数据包是什么意思?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2af3 | 官方: 否 | 付费: 否
答案:
Data packet is a unit of data that is made into a single package for transmission over a network. They are also referred to as a network layer package and are also used by IP protocol as they contain the IP information which is attached to each packet. They contain much essential information like email messages, website data, and VoIP (Voice-over-IP) calls. Each data packet has a unique numeric identification number that defines the packet number and order.
数据包是为在网络中传输而被打包成单个数据单元的数据单位。它们也被称为网络层包,并被IP协议使用,因为它们包含附着在每个包上的IP信息。它们包含许多关键信息,如电子邮件消息、网站数据和VoIP(互联网语音协议)呼叫。每个数据包都有一个唯一的数字标识号,用于定义包编号和顺序。
109. What do you mean by routers? Write its major functions.
你所说的路由器是什么意思?写出其主要功能。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37a1058d557c902ba2af6 | 官方: 否 | 付费: 否
答案:
Router is a networking device that is used to forward data packets along with a network from source to destination. The devices are specially designed to receive, analyze, and forward data packets between computer networks. It examines a destination IP address of a data packet and uses its headers and routing table to determine the best way or route for transferring the packets. There are some popular companies that develop routers like HP, Juniper, Nortel, Cisco, etc. Functions of Routers: - Send and receive data on computer networks.
路由器是一种网络设备,用于沿网络将数据包从源转发到目的地。这些设备专门设计用于在计算机网络之间接收、分析和转发数据包。它检查数据包的目的IP地址,并使用其报头和路由表来确定传输数据包的最佳方式或路径。有一些知名公司开发路由器,如HP、Juniper、Nortel、Cisco等。路由器的功能:- 在计算机网络上发送和接收数据。
- Used to create local networks of devices
- Helps to connect multiple devices to the Internet.
- Allows users to configure the port as per their requirements in the network.
- Filter unwanted interference, and carry out the process of data encapsulation and decapsulation.
- Used to segment network traffic.
- Prevent network bottlenecks simply by isolating portions of a network.
- Reduce excessive traffic.
110. Name types of routes that are available in routers.
说出路由器中可用的路由类型。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2af9 | 官方: 否 | 付费: 否
答案:
Types of routes available in routers include:
路由器中可用的路由类型包括:
Static Route: This route is also known as a non-adaptive route. It is either directly configured on an active interface of the router or manually added to the routing table by an administrator. Default Route: In this, the router is configured to send all packets towards a single router, and it does not matter whether or not it belongs to a specific network. It is especially used when networks deal with a single exit point. Dynamic Route: This route is also known as the adaptive route. It makes automatic adjustments of the routes as per the current state of the route in the routing table and also uses routing protocols to find network destinations.
静态路由:这种路由也称为非自适应路由。它要么直接配置在路由器的活动接口上,要么由管理员手动添加到路由表中。默认路由:在这种路由中,路由器被配置为将所有数据包发送到单个路由器,不管它是否属于特定网络。当网络处理单个出口点时尤其使用。动态路由:这种路由也称为自适应路由。它根据路由表中路由的当前状态自动调整路由,并使用路由协议来查找网络目的地。
111. What do you mean by Switching?
你所说的交换是什么意思?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2afc | 官方: 否 | 付费: 否
答案:
Switching is a process in computer networks that enable us to interconnect links to form a larger network. It works at the DLL frame and uses hardware address or mac address of devices on LAN (Local Area Network) to segment a network.
交换是计算机网络中的一种过程,使我们能够互连链路以形成更大的网络。它工作在数据链路层帧上,并使用LAN(局域网)上设备的硬件地址或MAC地址来分割网络。
112. Name two ports of Switches.
说出交换机的两个端口。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2aff | 官方: 否 | 付费: 否
答案:
The two ports of switches include: Access Port: It connects network hosts to a single VLAN and only carries the traffic of one VLAN. In this, traffic is sent and received in native format without any VLAN tagging. Access ports are basically used to connect switch ports with computers with a minimum of 10 Mbps speed. Trunk Port: It generally connects to another switch and is able to interact with several other VLANs. By default, it is a member of all VLANs in the VLAN database. The trunk port is basically used for multiple connections between the switch to switch and switch to routers.
交换机的两种端口包括:接入端口(Access Port):它将网络主机连接到单个VLAN,并且只承载一个VLAN的流量。在这种方式下,流量以本地格式发送和接收,不带任何VLAN标记。接入端口主要用于将交换机端口与计算机连接,速率最低为10 Mbps。中继端口(Trunk Port):它通常连接到另一台交换机,并能够与多个其他VLAN交互。默认情况下,它是VLAN数据库中所有VLAN的成员。中继端口主要用于交换机之间以及交换机与路由器之间的多连接。
113. Name different IPX access list.
列举不同的IPX访问列表。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b02 | 官方: 否 | 付费: 否
答案:
There are basically two different IPX access lists as given below: Standard: Used to filter the source or destination IP address. Extended: Uses source and destination IP addresses, protocol, socket, and port when fileting a network.
基本上有两种不同的IPX访问列表,如下所示:标准(Standard):用于过滤源或目的IP地址。扩展(Extended):在过滤网络时,使用源和目的IP地址、协议、套接字和端口。
114. What is the main objective of Data Link Layer and Transport Layer?
数据链路层和传输层的主要目标是什么?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b05 | 官方: 否 | 付费: 否
答案:
Data Link Layer: It is the 2nd layer of the OSI model which is generally responsible for transferring the datagram across an individual link. It is considered one of the most complicated layers and also has complex functionalities and liabilities. It also ensures that the appropriate physical protocol is assigned to the data.
数据链路层:它是OSI模型的第2层,通常负责在单个链路上传输数据报。它被认为是最复杂的层之一,也具有复杂的功能和责任。它还确保为数据分配适当的物理协议。
Transport Layer: It is the 4th layer of the OSI model which is responsible for providing transparent transfer of data among end-users, thus providing reliable data transfer services to the top layers. Its main objective is to deliver the entire message from source to destination.
传输层:它是OSI模型的第4层,负责在最终用户之间提供透明的数据传输,从而为上层提供可靠的数据传输服务。它的主要目标是从源到目的地传递整个消息。
Successful Tech Career for FREE!
免费开启成功的科技职业生涯!
Successful Tech Career!
成功的技术职业生涯!
Interview Process
面试流程
CTC & Designation
CTC与职位级别
Projects on the Job
工作项目
Referral System
推荐系统
Try It Out
试试看
2 Lakh+ Roadmaps Created
已生成20万+职业规划
115. What do you mean by 100BaseFX?
100BaseFX是什么意思?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b08 | 官方: 否 | 付费: 否
答案:
100BaseFX is basically an Ethernet media standard for Ethernet over fiber optic cables, rather than twisted-pair cables. It is a version of Fast Ethernet that makes use of fiber optic cables as the main transmission medium. Here, 100 refers to 100Mbps data speed that means it carries data traffic at 100 Mbps in LAN.
100BaseFX基本上是一种以太网介质标准,用于通过光纤电缆(而非双绞线电缆)的以太网。它是快速以太网的一个版本,使用光纤电缆作为主要传输介质。在这里,100指的是100Mbps的数据速率,意味着它在局域网中以100 Mbps的速度承载数据流量。
116. Name the LAN Switching method that is mostly used in CISCO Catalyst 5000?
在CISCO Catalyst 5000中主要使用哪种局域网交换方法?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b0b | 官方: 否 | 付费: 否
答案:
Store and forward switching method is mostly used by CISCO Catalyst 5000 because it stores the entire frame to its buffers and executes a CRC check before deciding whether to forward that data frame or not.
存储转发(Store and forward)交换方法在CISCO Catalyst 5000中主要使用,因为它将整个帧存储到缓冲区中,并在决定是否转发该数据帧之前执行CRC检查。
117. Explain Routing.
解释路由。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b0e | 官方: 否 | 付费: 否
答案:
Routing is basically a process of establishing the routes that data packets take on their way to the destination. It is a process of selecting a path across one or more networks to move a data packet from source to destination. Routing is generally performed in many types of networks such as circuit-switched networks, computer networks, etc. It is considered as one of the most essential features in a network and is done by a device called routers.
路由基本上是为数据包在到达目的地的过程中确定路线的过程。它是选择一个或多个网络之间的路径,以将数据包从源移动到目的地的过程。路由通常在多种类型的网络(如电路交换网络、计算机网络等)中执行。它被认为是网络中最基本的功能之一,由称为路由器的设备完成。
In the above diagram, the data packet moves from Computer A to Computer B. There are two paths available: 1st- Network 1, 3, and 5 2nd- Network 2 and 4 It depends upon network routers to make a choice whether to pass through 1st or 2nd. The 1st one is a long path but might be faster at forwarding packets whereas the 2nd one is a shorter path. These are the kinds of choices that routers have to make constantly.
在上图中,数据包从计算机A移动到计算机B。有两条可用路径:第一条—网络1、3和5;第二条—网络2和4。这取决于网络路由器来选择是通过第一条还是第二条。第一条是长路径,但在转发数据包方面可能更快,而第二条是较短的路径。这就是路由器必须不断做出的决策类型。
118. Write difference between tracert and traceroute.
写出tracert和traceroute之间的区别。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b11 | 官方: 否 | 付费: 否
答案:
Tracert: It is a Command Prompt command that is used to show various details about the path that a packet takes from the source computer to the specified destination computer. It only uses ICMP (Internet Control Message Protocol) echo requests. It can be used on a PC. This command is generally used in Windows NT-based OS. Traceroute: As the name suggests, it is a command that is used to trace the records of the path that a packet takes from the source computer to the specified destination computer. It uses UDP (User Datagram Protocol) echo requests. Traceroute command can be used on a router or switch. This command is generally used in UNIX OS.
Tracert:它是一个命令提示符命令,用于显示数据包从源计算机到指定目的计算机所经过路径的各种详细信息。它仅使用ICMP(互联网控制消息协议)回显请求。它可以用于PC上。此命令通常用于基于Windows NT的操作系统中。Traceroute:顾名思义,它是一个用于跟踪数据包从源计算机到指定目的计算机所经过路径记录的命令。它使用UDP(用户数据报协议)回显请求。Traceroute命令可用于路由器或交换机上。此命令通常用于UNIX操作系统中。
119. Explain HDLC.
解释HDLC。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b14 | 官方: 否 | 付费: 否
答案:
HDLC (High-Level Data Link Control) is a group of communication protocols that usually provides reliable delivery of data frames over communication or network link. It is a proprietary protocol for CISCO and is the default encapsulation operated within CISCO routers. It also ensures the error-free transmission of data and can provide both connection-oriented and connectionless services.
HDLC(高级数据链路控制)是一组通信协议,通常通过通信或网络链路提供数据帧的可靠传输。它是CISCO的专有协议,并且是CISCO路由器内部运行的默认封装。它还确保数据的无差错传输,并且可以提供面向连接和面向无连接的服务。
120. What do you mean by DLCI?
你所说的DLCI是什么意思?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b17 | 官方: 否 | 付费: 否
答案:
DLCI (Data Link Connection Identifier) is basically a frame relay 10-bit-wide link-local virtual circuit normally assigned by frame relay service to uniquely identify each virtual circuit that is present on the network. It simply identifies which logical circuit the data travels over.
DLCI(数据链路连接标识符)基本上是一个帧中继10位宽的链路本地虚拟电路,通常由帧中继服务分配,以唯一标识网络上存在的每个虚拟电路。它简单地标识数据在哪个逻辑电路上传输。
121. Name router command that is used to display RAM content and NVRAM Content.
说出用于显示RAM内容和NVRAM内容的路由器命令。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b1a | 官方: 否 | 付费: 否
答案:
The router command that is used to display RAM content is “Show run/show running-config", and the router command that is used to display NVRAM content is “Show start/show start-config".
用于显示RAM内容的路由器命令是“Show run/show running-config”,用于显示NVRAM内容的路由器命令是“Show start/show start-config”。
122. What do you mean by Frame relay?
你所说的帧中继是什么意思?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b1d | 官方: 否 | 付费: 否
答案:
Frame relay is basically a packet switching technology typically used to transfer data between geographically separated LANs or across WANs. It simply provides connection-oriented communication by developing and maintaining virtual circuits. It is cost-effective technology and is generally used to join two or more routers with a single interface. It works on the data link layer and physical layer of the OSI model.
帧中继基本上是一种分组交换技术,通常用于在地理上分离的LAN之间或跨WAN传输数据。它通过开发和维护虚拟电路来提供面向连接的通信。它是一种经济高效的技术,通常用于通过单个接口连接两个或多个路由器。它工作在OSI模型的数据链路层和物理层。
123. What are three possible ways of data transmission in CCNA?
CCNA中数据传输的三种可能方式是什么?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b20 | 官方: 否 | 付费: 否
答案:
Three possible ways of data transmission in CCNA include: Simplex: The Communication is unidirectional in Simplex mode, as on a single-direction road. Just one of the two devices on a connection can communicate, the other can just get. The simplex mode can utilize the whole limit of the channel to send information one way.
CCNA中数据传输的三种可能方式包括:单工:单工模式下的通信是单向的,就像单行道一样。连接中的两个设备中只有一个可以通信,另一个只能接收。单工模式可以利用信道的全部容量向一个方向发送信息。
Half Duplex: Each station can transmit and receive in Half-duplex mode, however not simultaneously. At the point when one device is sending, the other can just receive, and the other way around. The half-duplex mode is utilized in situations where there is no requirement for communication both ways simultaneously. The whole limit of the channel can be used for every direction.
半双工:每个站点在半双工模式下可以发送和接收,但不能同时进行。当一个设备发送时,另一个只能接收,反之亦然。半双工模式用于不需要双向同时通信的情况。信道的全部容量可以用于每个方向。
Full Duplex: Both stations can send and receive all the while in full-duplex mode. Signals that are going in one direction share the capacity of the connection with signals going another way IN this type of mode. This sharing can happen in two ways: - Either the connection should contain two truly separate transmission ways, one for sending and the other for receiving.
全双工:在全双工模式下,两个站点可以同时发送和接收。在此模式中,朝一个方向传输的信号与朝另一方向传输的信号共享连接的容量。这种共享可以通过两种方式发生:- 要么连接应包含两条真正独立的传输路径,一条用于发送,另一条用于接收。
The capacity is split between signals going in two ways.
Full-duplex mode is utilized when communication both ways are required constantly. The limit or capacity of the channel, anyway, should be split between the two directions.全双工模式在需要持续双向通信时使用。然而,信道的限制或容量必须在两个方向之间分配。
124. What do you mean by MTU?
你所说的MTU是什么意思?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b23 | 官方: 否 | 付费: 否
答案:
MTU (Maximum Transmission Unit) is considered the largest size frame or packet that a network-connected device will accept. Its default size is 1500 bytes which is the largest Ethernet standard unit. TCP (Transmission Control Protocol) generally uses MTU to determine the maximum size of each packet in any transmission.
MTU(最大传输单元)被认为是网络连接设备将接受的最大帧或数据包大小。其默认大小为1500字节,这是以太网标准单元中最大的。TCP(传输控制协议)通常使用MTU来确定任何传输中每个数据包的最大大小。
125. What are different types of cables used in routing?
路由中使用的不同电缆类型有哪些?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b26 | 官方: 否 | 付费: 否
答案:
There are basically three different types of cables used in routing: Straight Cable: These cables are used to connect different group devices. It is especially used in LAN to connect different devices such as computers to a network hub like a router, PC and switch, router and switch, etc. Its ultimate goal is to connect a host to the client. Cross Cable: These cables are used to connect the same group of devices. It is considered one of the most commonly used cable formats for network cables. It is especially used when two similar devices need to be connected. Cross cables are also known as cross-wired cables. Rollover Cable: These cables are used to connect the console port of the computer. This cable is specially designed flat to help distinguish it from other types of cables. It generally allows programmers to connect to network devices and can also manipulate the programming whenever needed. Rollover cables are also known as Yost cable, Cisco cable, or a Console cable.
路由中基本上使用三种不同类型的电缆:直通电缆:这些电缆用于连接不同组别的设备。它特别用于LAN中连接不同设备,例如计算机到网络集线器,如路由器、PC和交换机、路由器和交换机等。其最终目标是将主机连接到客户端。交叉电缆:这些电缆用于连接相同组别的设备。它被认为是网络电缆中最常用的电缆格式之一。它特别用于需要连接两个相似设备的情况。交叉电缆也称为交叉线缆。翻转电缆:这些电缆用于连接计算机的控制台端口。这种电缆被特别设计成扁平状,以帮助与其他类型的电缆区分开来。它通常允许程序员连接到网络设备,并且在需要时也可以操作编程。翻转电缆也称为Yost电缆、Cisco电缆或控制台电缆。
126. How is a TCP connection made?
TCP 连接是如何建立的?
- 知识点: 操作系统与网络 (标签: interviewbit, cisco, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Cisco
- id: 69b37a1258d557c902ba2c98 | 官方: 否 | 付费: 否
答案:
A TCP(Transmission Control Protocol) connection will be done as given below: - Step 1: At first, the receiver (host) will send a packet to the sender (server) with an SYN (SYNchronize) flag. It is considered as an attempt made to open a connection. Then, the server will respond with an SYN flag and ACK (ACKnowledge) flag for acknowledging(approving) the connection. Now, the receiver will send an ACK flag for confirming the handshake. The operating systems at both ends will be kept informed about the connection establishment.
TCP(传输控制协议)连接将如下所示建立:- 步骤 1:首先,接收方(主机)将向发送方(服务器)发送一个带有 SYN(同步)标志的数据包。这被视为尝试打开连接。然后,服务器将回复一个 SYN 标志和 ACK(确认)标志以确认(批准)连接。现在,接收方将发送一个 ACK 标志以确认握手。两端操作系统都将被告知连接建立的情况。
- Step 2: Now the sender will begin data transmission. It will also gain acknowledgements from the receiver. A timer will begin when the sender initiates the sending of data.
- Step 3: The data will be retransmitted by the sender if it hasn’t received any acknowledgements even after the timer limit has been exceeded.
- Step 4: When the receiver buffer is full (in the case of windowing), the receiver will send a stop signal to the sender. The sender will stop the data transmission.
- Step 5: Then after all the data processing is done, the receiver will be sending a go signal into the sender. Now, the sender will again begin transmitting the data.
Successful Tech Career for FREE!
免费开启成功的科技职业生涯!
Successful Tech Career!
成功的技术职业生涯!
Interview Process
面试流程
CTC & Designation
CTC与职位级别
Projects on the Job
工作项目
Referral System
推荐系统
Try It Out
试试看
2 Lakh+ Roadmaps Created
已生成20万+职业规划
127. Explain in detail about Bridges in Networking and mention its usage.
详细解释网络中的网桥并提及其用途。
- 知识点: 操作系统与网络 (标签: interviewbit, cisco, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Cisco
- id: 69b37a1258d557c902ba2ca1 | 官方: 否 | 付费: 否
答案:
A bridge is a networking device that will connect numerous LANs (Local Area Networks) for forming a larger LAN. Also, it can connect LAN segments to form newer LAN segments. It operates in the OSI model’s Data-Link layer. Bridges are helpful in increasing the network capacity of a single LAN by joining multiple LANs.
网桥是一种网络设备,用于连接多个局域网(LAN)以形成一个更大的局域网。它也可以连接局域网网段以形成新的局域网网段。它工作在OSI模型的数据链路层。网桥通过将多个局域网连接起来,有助于提高单个局域网的网络容量。
Working of Bridge:
网桥的工作原理:
The bridge will connect two or more different LANs that are having similar protocols and help to communicate between the devices (nodes) in them. It will accept all the data packets and all of them will be amplified to the other side. The bridges are considered to be intelligent devices as they will permit the passing of only selective packets from them.
网桥将连接两个或多个具有相似协议的不同局域网,并帮助其中的设备(节点)之间进行通信。它将接收所有数据包,并将所有数据包放大到另一侧。网桥被认为是智能设备,因为它们只允许选择性数据包通过。
A bridge will pass only those packets which are addressed from the node of one network to the node of the other network. That means the bridge will consult a database on receiving the data frame for deciding whether to pass, transmit or discard the frame. - If the frame consists of a destination MAC (Media Access Control) address within the same network, then the bridge will pass the frame to that node and discard it later.
网桥只会传递那些从一方网络的节点寻址到另一方网络节点的数据包。这意味着网桥在收到数据帧时会查询数据库,以决定是传递、传输还是丢弃该帧。- 如果帧包含的目的MAC(媒体访问控制)地址位于同一网络内,那么网桥会将该帧传递给该节点并随后丢弃它。
- If the frame consists of a destination MAC address within the connected network, then the bridge will forward the frame towards it.
Uses of Bridge: - The capacity of the network will be increased and multiplied as multiple smaller networks are combined to form a single network using the bridge.
网桥的用途:- 通过使用网桥将多个较小的网络组合成一个单一网络,网络的容量将得到增加和倍增。
- The database in the bridge will help for deciding whether a data frame should be transmitted or discarded on receiving the data frame.
- A single faulty node will be prevented from bringing down the whole network, by deciding on whether to forward or discard the data frame.
- It helps for frame broadcasting to each node even if the MAC or destination address is not available.
- With the help of a wireless bridge, we can connect the wireless networks with wireless segments.
128. Give the reasons why a Layered model is used by the Networking industry.
给出网络行业使用分层模型的原因。
- 知识点: 操作系统与网络 (标签: interviewbit, cisco, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Cisco
- id: 69b37a1258d557c902ba2ca7 | 官方: 否 | 付费: 否
答案:
- It provides systematic troubleshooting in the network.
- It clarifies what task has to be done by general function rather than how to do those tasks.
- Modifications made to one layer doesn't affect the other layers in the layered model.
129. What is the CISCO default TCP session timeout?
CISCO默认的TCP会话超时时间是多少?
- 知识点: 操作系统与网络 (标签: interviewbit, cisco, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Cisco
- id: 69b37a1258d557c902ba2cb0 | 官方: 否 | 付费: 否
答案:
The default timeout in the TCP session for CISCO will be one minute. Here, connection slots will get freed on an average of sixty seconds later, when the sequence of normal connection close has been completed. It can be configured into other settings as per the requirements.
CISCO的TCP会话默认超时时间为一分钟。在这里,当正常连接关闭序列完成后,连接槽位平均会在六十秒后释放。可以根据需求配置为其他设置。
For the connection and translation slots of different protocols, a global idle timeout duration can be set manually. The resources will be returned so that pools can be freed, in case slots are not used for the specified idle time.
对于不同协议的连接和转换槽位,可以手动设置全局空闲超时时间。如果槽位在指定的空闲时间内未被使用,资源将被返还,以便池可以被释放。
130. What is a deadlock in Operating Systems? What are the situations for the deadlock to happen?
操作系统中的死锁是什么?发生死锁的情况有哪些?
- 知识点: 操作系统与网络 (标签: interviewbit, cisco, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Cisco
- id: 69b37a1258d557c902ba2cbc | 官方: 否 | 付费: 否
答案:
Deadlock refers to the situation that happens in the operating system where each process will enter into the waiting state for obtaining the resource which has been assigned to some other process.
死锁是指操作系统中发生的一种情况,其中每个进程都会进入等待状态,以获取已分配给其他进程的资源。
Consider a real-time example of traffic that is going only in a single direction. Here, we can consider the bridge as a resource. If one car backs up, the deadlock situation will be resolved easily. Multiple cars may have to be backed up on deadlock occurrence. So it might lead to starvation.
考虑一个仅单向通行的交通实例。在这里,我们可以将桥梁视为一种资源。如果一辆车倒车,死锁情况将很容易解决。发生死锁时可能需要多辆车倒车。因此,这可能导致饥饿。
The process will be considered to be in a deadlock when the following conditions get satisfied simultaneously: - Mutual Exclusion: When more than one process shares the same resource and all the processes are different, then each process of them has to wait for the other for utilizing the resource as at a time only one process can use the resource.
当以下条件同时满足时,进程将被视为处于死锁状态:- 互斥:当多个进程共享同一资源且所有进程都不同时,它们中的每个进程都必须等待其他进程才能使用该资源,因为一次只有一个进程可以使用该资源。
- Hold and Wait: A process is already holding the resource(at least one) and waiting for resources.
- No pre-emption: We cannot forcefully stop or remove a process among the waiting processes, for releasing the resource.
- Circular Wait: A group of processes will be waiting in a circular manner for the resources held by each other.
131. What is plumbing/piping in Linux or Unix?
Linux或Unix中的管道/管线是什么?
- 知识点: 操作系统与网络 (标签: interviewbit, cognizant, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Cognizant
- id: 69b37a3158d557c902ba4017 | 官方: 否 | 付费: 否
答案:
Plumbing/ Piping refers to the technique of using one program's output as an input to another. For instance, Instead of delivering a folder or drive listing to the main screen, it can be piped and delivered to a file, or sent to the printer to print a hard copy.
管道/管线是指将一个程序的输出用作另一个程序的输入的技术。例如,不是将文件夹或驱动器列表输出到主屏幕,而是可以通过管道将其传输到文件,或发送到打印机打印硬拷贝。
A pipe is a type of redirection (the transfer of standard output to another location) used in Linux and other Unix-like operating systems to transport the output of one command/program/process to another for additional processing. The Unix/Linux systems allow a command's stdout to be connected to another command's stdin. The pipe character ‘|' can be used to do this.
管道是一种重定向(将标准输出传输到另一个位置)类型,用于Linux和其他类Unix操作系统中,将一个命令/程序/进程的输出传输到另一个命令/程序/进程以进行进一步处理。Unix/Linux系统允许将一个命令的stdout连接到另一个命令的stdin。可以使用管道字符‘|'来实现这一点。
132. What is the difference between HTTP and HTTPS?
HTTP和HTTPS有什么区别?
- 知识点: 操作系统与网络 (标签: interviewbit, dassault-systemes, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: 达索系统
- id: 69b37a5b58d557c902ba5c0b | 官方: 否 | 付费: 否
答案:
HTTP (Hypertext Transfer Protocol) and HTTPS (HTTP Secure) are both communication protocols used to transfer data over the internet. However, there is a key difference between the two:
HTTP(超文本传输协议)和HTTPS(HTTP安全)都是用于在互联网上传输数据的通信协议。然而,两者之间存在一个关键区别:
| Feature 特性 | HTTP | HTTPS |
|---|---|---|
| Definition 定义 | Hypertext Transfer Protocol is the standard for communication between web browsers and servers. 超文本传输协议是Web浏览器和服务器之间通信的标准。 | HTTPS is a secure version of HTTP that encrypts data transferred between web browsers and servers. HTTPS是HTTP的安全版本,可加密Web浏览器和服务器之间传输的数据。 |
| Security 安全性 | Not secure, data transmitted is in plain text. 不安全,传输的数据为明文。 | Secure, data transmitted is encrypted. 安全,传输的数据经过加密。 |
| Certificate 证书 | Does not require a certificate. 不需要证书。 | Requires a certificate from a trusted certificate authority. 需要来自受信任证书颁发机构的证书。 |
| Port 端口 | Uses port 80. 使用端口80。 | Uses port 443. 使用端口443。 |
| URL | Begins with "http://" 以“http://”开头 | Begins with "https://" 以“https://”开头 |
| Authentication 认证 | Does not provide any authentication. 不提供任何认证。 | Provides authentication to ensure that the user is communicating with the correct website. 提供认证以确保用户与正确的网站通信。 |
| Data protection 数据保护 | Data transferred over HTTP can be intercepted and read by unauthorized parties. 通过HTTP传输的数据可被未授权方截获和读取。 | Data transferred over HTTPS is encrypted and cannot be intercepted or read by unauthorized parties. 通过HTTPS传输的数据经过加密,无法被未授权方截获或读取。 |
| Best use 最佳用途 | When security is not a concern or the website contains only static content. 当安全性不是问题或网站仅包含静态内容时。 | When security is a concern or the website contains sensitive information such as personal or financial data. 当安全性是问题或网站包含敏感信息(如个人或财务数据)时。 |
In the above image, we can see that HTTP uses no encryption which makes data insecure. There is no data protection, so the HTTP Packets can be seen by any anonymous person on the the way from server to the client/web browser.
在上图中,我们可以看到HTTP不使用加密,这使得数据不安全。没有数据保护,因此HTTP数据包在从服务器到客户端/Web浏览器的途中可被任何匿名人员看到。
On the other side, we have HPPS, which is secured because it uses SSL (Secured Socket Layer) that encrypts the data and provides security to it. This protects the data transfer between Serber and the client.
另一方面,我们有HPPS,它是安全的,因为它使用SSL(安全套接字层)来加密数据并为其提供安全性。这保护了Serber与客户端之间的数据传输。
133. What is DNS (Domain Name System)? How does it work?
什么是DNS(域名系统)?它如何工作?
- 知识点: 操作系统与网络 (标签: interviewbit, dxc, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: DXC Technology
- id: 69b37ab758d557c902ba94cf | 官方: 否 | 付费: 否
答案:
DNS is an acronym for Domain Name System. In 1983, Paul Mockapetris and Jon Postel created DNS. It is a naming system that encompasses all internet resources, including physical nodes and applications and is used to quickly locate resources on a network. The Domain Name System (DNS) is an internet service that translates domain names to IP addresses. Users who don't have DNS must know the IP address of the website they want to visit.
DNS是Domain Name System(域名系统)的缩写。1983年,Paul Mockapetris和Jon Postel创建了DNS。它是一个命名系统,涵盖所有互联网资源,包括物理节点和应用程序,用于快速定位网络上的资源。域名系统(DNS)是一种互联网服务,可将域名转换为IP地址。没有DNS的用户必须知道他们想要访问的网站的IP地址。
The working of a Domain Name System: If you wish to go to the "InterviewBit" website, type "https://www.interviewbit.com" into the address bar of your web browser. Once the domain name is entered, then the domain name system will translate the domain name into the IP address which can be easily interpreted by the computer. Using the IP address, the computer can locate the web page requested by the user.
域名系统的工作方式:如果您想访问“InterviewBit”网站,请在Web浏览器的地址栏中输入“https://www.interviewbit.com”。输入域名后,域名系统会将域名转换为计算机可以轻松解释的IP地址。使用该IP地址,计算机可以定位用户请求的网页。
134. What are the four layers of the TCP/IP model in Computer Networks?
计算机网络中TCP/IP模型的四层是什么?
- 知识点: 操作系统与网络 (标签: interviewbit, dxc, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: DXC Technology
- id: 69b37ab758d557c902ba94e1 | 官方: 否 | 付费: 否
答案:
The four layers of the TCP/IP model in Computer Networks are as follows:
计算机网络中TCP/IP模型的四层如下:
- Application Layer: The application layer is where you will find all of the higher-level procedures.
- Transport Layer: The Transport Layer performs almost identically to the OSI transport layer. It allows peer entities on the network to converse with one another.
- Internet Layer: The Internet Layer is the most critical layer that keeps the entire system together is the internet layer. It sends IP packets where they are supposed to go.
- Network Access Layer or Link layer: To suit the needs of the connectionless internet layer, this layer determines which connectivity, such as serial lines or traditional Ethernet, must be employed.
Successful Tech Career for FREE!
免费开启成功的科技职业生涯!
Successful Tech Career!
成功的技术职业生涯!
Interview Process
面试流程
CTC & Designation
CTC与职位级别
Projects on the Job
工作项目
Referral System
推荐系统
Try It Out
试试看
2 Lakh+ Roadmaps Created
已生成20万+职业规划
135. List the various types of operating systems that you are familiar with. List some operating system examples as well.
列出你熟悉的各种类型的操作系统。同时列出一些操作系统示例。
- 知识点: 操作系统与网络 (标签: interviewbit, dxc, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: DXC Technology
- id: 69b37ab758d557c902ba94fc | 官方: 否 | 付费: 否
答案:
Given below are some of the different types of operating systems : - Batch Operating System: This operating system has no direct interaction with the computer. There is an operator who groups related jobs that have the same need into batches. It is the operator's job to group jobs with similar requirements.
下面给出一些不同类型的操作系统:- 批处理操作系统:这种操作系统与计算机没有直接交互。有一个操作员将具有相同需求的相關作业分组为批次。操作员的工作是将具有相似要求的作业分组。
- Distributed Operating Systems (DOS): A distributed operating system (DOS) is software that manages multiple computers as if they were one.
- Network Operating Systems: Computers running different operating systems can connect to a single network using Network Operating Systems. It is frequently utilized for security reasons.
- Time-Sharing Operating System: A time-sharing operating system allows multiple individuals to share computer resources. This type of operating system makes the most of its resources.
Real-Time Operating Systems (RTOS): These types of operating systems are used in situations when a large number of events, the majority of which are external to the computer system, must be accepted and processed promptly or within a tight deadline. Examples of such applications include industrial control, telephone switching equipment, flight control, and real-time simulations.
The following are some examples of operating systems : - Microsoft Windows (Graphical User Interface Operating System based for Personal Computers)以下是一些操作系统的示例:- 微软Windows(基于个人计算机的图形用户界面操作系统)
- Apple's iOS (iPhone, iPad, and iPod Touch operating system)
- Apple's personal computers and workstations, such as the MacBook and iMac, run macOS.
- Linux or GNU (for Personal Computers, File and Print server, Workstations, ISP, Three-tier Clients and Servers)
- Android (Google's mobile operating system for smartphones, tablets, smartwatches, and other devices)
136. What are the different types of Real Time Operating Systems (RTOS)?
实时操作系统(RTOS)有哪些不同类型?
- 知识点: 操作系统与网络 (标签: interviewbit, dxc, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: DXC Technology
- id: 69b37ab758d557c902ba94ff | 官方: 否 | 付费: 否
答案:
The term "Real-Time Operating System" refers to an operating system that is susceptible to real-time limitations, such as ensuring a response within a specified time limit or meeting a specific deadline. A flight control system, for example, or real-time monitoring. The following are the different types of real-time systems having timing constraints: - Soft Real-Time Operating System: A soft real-time system is one whose performance is impaired if the results do not meet the set timing requirements. In a soft real-time system, fulfilling deadlines is not required for every activity, but the process must be completed and the outcome delivered. Even soft real-time systems cannot miss the deadline for every activity or process, which must meet or miss the deadline based on priority. Soft Real-Time Operating Systems include things like phone switches.
术语“实时操作系统”指的是易受实时限制影响的操作系统,例如确保在指定时间限制内做出响应或满足特定截止日期。例如,飞行控制系统或实时监控。以下是具有时间约束的不同类型的实时系统:- 软实时操作系统:软实时系统是指如果结果未满足设定的时间要求,其性能会受损的系统。在软实时系统中,并非每个活动都必须满足截止日期,但进程必须完成并交付结果。即使是软实时系统也不能错过每个活动或进程的截止日期,这必须根据优先级满足或错过截止日期。软实时操作系统的例子包括电话交换机。
- Hard Real-Time Operating System: Timelines are treated as a deadline in a hard real-time system, and they should never be overlooked. Because hard real-time systems have no persistent memory, their procedures must be completed correctly the first time. The Hard Real-Time System must produce correct answers to events in the time allotted. A totally deterministic and time-constrained system is known as a hard real-time system. When tardiness rises, the usefulness of a hard real-time system's result drops sharply, and it may even become negative. The term "tardiness" describes how late a real-time system completes a task in comparison to the deadline. Consider a flight controller system as an example.
137. What do you understand about demand paging in Operating Systems?
你如何理解操作系统中的按需分页?
- 知识点: 操作系统与网络 (标签: interviewbit, dxc, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: DXC Technology
- id: 69b37ab758d557c902ba9505 | 官方: 否 | 付费: 否
答案:
Demand paging in Operating Systems is a technique for loading pages (In a virtual memory operating system, a page is the smallest unit of data for memory management. A page frame is the smallest fixed-length contiguous unit of physical memory into which the operating system maps memory pages) into memory only when they are needed. Virtual Memory is a storage allocation system that allows secondary memory to be addressed as if it were the main memory. The addresses used by a program to refer to memory are distinct from the addresses used by the memory system to designate physical storage sites, and program generated addresses are automatically translated to machine addresses. The capacity of virtual storage is limited by the computer system's addressing method, and the amount of secondary memory available is determined by the number of main storage sites available rather than the actual number of main storage locations.
操作系统中的按需分页是一种仅在需要时将页面(在虚拟内存操作系统中,页面是内存管理的最小数据单位。页框是操作系统映射内存页面到物理内存的最小固定长度连续单元)加载到内存中的技术。虚拟内存是一种存储分配系统,允许将辅助内存视为主内存来寻址。程序用来引用内存的地址与内存系统用来指定物理存储位置的地址不同,程序生成的地址会自动转换为机器地址。虚拟存储的容量受计算机系统寻址方法的限制,可用辅助内存的数量由可用的主存储位置数量决定,而不是实际的主存储位置数量。
A page is only brought into memory in this case when a position on the page is addressed during execution. In general, the steps for bringing a page into the main memory or demand paging are as follows: - The operating system makes an attempt to access the page.
在这种情况下,只有在执行期间寻址到页面上的某个位置时,页面才会被带入内存。一般来说,将页面带入主内存或按需分页的步骤如下:- 操作系统尝试访问该页面。
- The CPU continues processing instructions as usual if the page is valid (in memory).
- A page fault trap is done by the operating systems when a page is incorrect.
- The operating system then checks to see if the memory reference is a legitimate reference to a secondary memory location. If this is not the case, the process will be terminated (illegal memory access). The operating system will have to read the page in the main memory otherwise.
- To read the desired page into the main memory, the operating system schedules a disc operation.
- After that, the operation that was halted due to the operating system trap is restarted or continued.
138. What do you understand about a Bootstrap Program in Operating Systems?
你如何理解操作系统中的引导程序?
- 知识点: 操作系统与网络 (标签: interviewbit, dxc, company-specific)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: general
- 公司: DXC Technology
- id: 69b37ab758d557c902ba9508 | 官方: 否 | 付费: 否
答案:
A Bootstrap Program is usually a program that initializes the operating system during the startup of the computer system, that is, the first program that is run when a computer system boots up. The operating system is loaded using a method or application known as booting. Overall, the performance and functionality of the operating system are solely dependent on the bootstrap programme. It is entirely stored on the disc in boot blocks at a certain location. It also locates and loads the kernel into the main memory, after which the program begins to run.
引导程序通常是计算机系统启动期间初始化操作系统的程序,也就是说,它是计算机系统启动时运行的第一个程序。操作系统通过一种称为引导的方法或应用程序来加载。总体而言,操作系统的性能和功能完全依赖于引导程序。它完全存储在磁盘上的特定位置的引导块中。它还会定位并将内核加载到主内存中,之后程序开始运行。
As we can see in the image given below, the Bootstrap Program resides in the Read-Only Memory (ROM) of our computers and they are the ones to first read the Operating Systems and load it into the RAM (Random Access Memory) of our computers. Only after that, the operating systems can start other devices of the computer like the Graphics cards, keyboards, mouses, etc.
正如我们在下面给出的图像中所看到的,引导程序驻留在我们计算机的只读存储器(ROM)中,它们是首先读取操作系统并将其加载到我们计算机的随机存取存储器(RAM)中的程序。只有在那之后,操作系统才能启动计算机的其他设备,如显卡、键盘、鼠标等。
DXC Interview Preparation
139. What do you understand by segmentation fault?
你对段错误有什么理解?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba988e | 官方: 否 | 付费: 否
答案:
A segmentation fault occurs most commonly and often leads to crashes in the programs. It occurs when a program instruction tries to access a memory address that is prohibited from getting accessed.
段错误最常发生,并经常导致程序崩溃。当程序指令尝试访问一个被禁止访问的内存地址时,就会发生这种情况。
140. What do you understand by startup code?
你对启动代码有什么理解?
- 知识点: 操作系统与网络 / 编程语言基础 / 行为与软技能 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba9892 | 官方: 否 | 付费: 否
答案:
A startup code is that piece of code that is called before the execution of the main function. This is used for creating a basic platform for the application and it is written in assembly language.
启动代码是在主函数执行之前被调用的那段代码。它用于为应用程序创建基础平台,并且是用汇编语言编写的。
141. What is ISR?
什么是ISR?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba9895 | 官方: 否 | 付费: 否
答案:
ISR expands to Interrupt Service Routines. These are the procedures stored at a particular memory location and are called when certain interrupts occur. Interrupt refers to the signal sent to the processor that indicates there is a high-priority event that requires immediate attention. The processor suspends the normal flow of the program, executes the instructions in ISR to cater for the high priority event. Post execution of the ISR, the normal flow of the program resumes. The following diagrams represent the flow of ISR.
ISR代表中断服务例程。这些是存储在特定内存位置的过程,当某些中断发生时会被调用。中断是指发送给处理器的信号,表明有一个需要立即关注的高优先级事件。处理器暂停程序的正常流程,执行ISR中的指令来处理高优先级事件。ISR执行完毕后,程序的正常流程恢复。下图展示了ISR的流程。
142. What is Void Pointer in Embedded C and why is it used?
在嵌入式C中什么是Void指针,为什么使用它?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba9898 | 官方: 否 | 付费: 否
答案:
Void pointers are those pointers that point to a variable of any type. It is a generic pointer as it is not dependent on any of the inbuilt or user-defined data types while referencing. During dereferencing of the pointer, we require the correct data type to which the data needs to be dereferenced.
Void指针是指向任意类型变量的指针。它是一个通用指针,因为在引用时不依赖于任何内置或用户定义的数据类型。在解引用指针时,我们需要指定正确的数据类型来解引用数据。
For Example:
例如:
int num1 = 20; //variable of int datatype
int num1 = 20; //int数据类型的变量
void *ptr; //Void Pointer
void *ptr; //Void指针
*ptr = &num1; //Point the pointer to int data
*ptr = &num1; //将指针指向int数据
print("%d",((int)ptr)); //Dereferencing requires specific data type
print("%d",((int)ptr)); //解引用需要特定的数据类型
char c = 'a';
char c = 'a';
*ptr = &c; //Same void pointer can be used to point to data of different type -> reusability
*ptr = &c; //同一个Void指针可用于指向不同类型的数据 -> 可重用性
print("%c",((char)ptr));
print("%c",((char)ptr));
Void pointers are used mainly because of their nature of re-usability. It is reusable because any type of data can be stored.
空指针主要因其可重用性而使用。它可重用是因为可以存储任何类型的数据。
143. Why do we use the volatile keyword?
为什么我们要使用 volatile 关键字?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba989f | 官方: 否 | 付费: 否
答案:
The volatile keyword is mainly used for preventing a compiler from optimizing a variable that might change its behaviour unexpectedly post the optimization. Consider a scenario where we have a variable where there is a possibility of its value getting updated by some event or a signal, then we need to tell the compiler not to optimize it and load that variable every time it is called. To inform the compiler, we use the keyword volatile at the time of variable declaration.
volatile 关键字主要用于防止编译器优化可能在优化后意外改变行为的变量。考虑一个场景,我们有一个变量,其值有可能被某个事件或信号更新,那么我们需要告诉编译器不要优化它,并在每次调用时加载该变量。为了告知编译器,我们在变量声明时使用 volatile 关键字。
// Declaring volatile variable - SYNTAX
// 声明 volatile 变量 - 语法
// volatile datatype variable_name;
// volatile 数据类型 变量名;
volatile int x;
volatile int x;
Here, x is an integer variable that is defined as a volatile variable.
这里,x 是定义为 volatile 变量的整数变量。
- Data Science
- All Events
- My Events
144. What are the differences between the const and volatile qualifiers in embedded C?
在嵌入式 C 中,const 和 volatile 限定符之间有什么区别?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98a2 | 官方: 否 | 付费: 否
答案:
| const | volatile |
|---|---|
| The keyword “const” is enforced by the compiler and tells it that no changes can be made to the value of that object/variable during program execution. 关键字 "const" 由编译器强制执行,并告知它在程序执行期间不能对该对象/变量的值进行任何更改。 | The keyword “volatile” tells the compiler to not perform any optimization on the variables and not to assume anything about the variables against which it is declared. 关键字 "volatile" 告诉编译器不要对变量执行任何优化,也不要对声明它的变量做任何假设。 |
| Example: const int x=20;, here if the program attempts to modify the value of x, then there would be a compiler error as there is const keyword assigned which makes the variable x non-modifiable. 示例:const int x=20;,这里如果程序尝试修改 x 的值,则会出现编译器错误,因为分配的 const 关键字使变量 x 不可修改。 | Example: volatile int x;, here the compiler is told to not assume anything regarding the variable x and avoid performing optimizations on it. Every time the compiler encounters the variable, fetch it from the memory it is assigned to. 示例:volatile int x;,这里告知编译器不要对变量 x 做任何假设,并避免对其执行优化。每次编译器遇到该变量时,都从分配给它的内存中获取它。 |
145. What Is Concatenation Operator in Embedded C?
嵌入式 C 中的连接运算符是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98a5 | 官方: 否 | 付费: 否
答案:
The Concatenation operator is indicated by the usage of ## . It is used in macros to perform concatenation of the arguments in the macro. We need to keep note that only the arguments are concatenated, not the values of those arguments.
连接运算符通过使用 ## 来表示。它用于宏中执行对宏参数的连接。我们需要注意,只连接参数,而不是这些参数的值。
For example, if we have the following piece of code:
例如,如果我们有以下代码片段:
define CUSTOM_MACRO(x, y) x##y
main(){
main(){
int xValue = 20;
int xValue = 20;
printf(“%d”, CUSTOM_MACRO(x, Value)); //Prints 20
printf(“%d”, CUSTOM_MACRO(x, Value)); // 打印 20
}
We can think of it like this if arguments x and y are passed, then the macro just returns xy -> The concatenation of x and y .
我们可以这样理解:如果传递了参数 x 和 y,那么宏只返回 xy -> 即 x 和 y 的连接。
146. What do you understand by Interrupt Latency?
你对中断延迟的理解是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98a8 | 官方: 否 | 付费: 否
答案:
Interrupt latency refers to the time taken by ISR to respond to the interrupt. The lesser the latency faster is the response to the interrupt event.
中断延迟是指ISR响应中断所需的时间。延迟越小,对中断事件的响应就越快。
147. How will you use a variable defined in source file1 inside source file2?
你将如何在源文件2中使用源文件1中定义的变量?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98ab | 官方: 否 | 付费: 否
答案:
We can achieve this by making use of the “extern” keyboard. It allows the variable to be accessible from one file to another. This can be handled more cleanly by creating a header file that just consists of extern variable declarations. This header file is then included in the source files which uses the extern variables. Consider an example where we have a header file named variables.h and a source file named sc_file.c .
我们可以通过使用“extern”关键字来实现这一点。它允许变量从一个文件访问到另一个文件。通过创建一个仅包含extern变量声明的头文件,可以更清晰地处理这个问题。然后,在源文件中包含此头文件以使用extern变量。考虑一个示例,其中我们有一个名为variables.h的头文件和一个名为sc_file.c的源文件。
/ variables.h/
/ variables.h/
extern int global_variable_x;
extern int global_variable_x;
/ sc_file.c/
/ sc_file.c/
include "variables.h" / Header variables included /
include <stdio.h>
void demoFunction(void)
void demoFunction(void)
{
printf("Value of Global Variable X: %d\n", global_variable_x++);
printf("全局变量X的值: %d\n", global_variable_x++);
}
148. What is Embedded C Programming? How is Embedded C different from C language?
什么是嵌入式C编程?嵌入式C与C语言有何不同?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37abd58d557c902ba98ae | 官方: 否 | 付费: 否
答案:
Embedded C is a programming language that is an extension of C programming . It uses the same syntax as C and it is called “embedded” because it is used widely in embedded systems. Embedded C supports I/O hardware operations and addressing, fixed-point arithmetic operations, memory/address space access, and various other features that are required to develop fool-proof embedded systems.
嵌入式C是一种编程语言,它是C编程语言的扩展。它使用与C相同的语法,之所以被称为“嵌入式”,是因为它广泛用于嵌入式系统。嵌入式C支持I/O硬件操作和寻址、定点算术运算、内存/地址空间访问,以及开发万无一失的嵌入式系统所需的各种其他功能。
Following are the differences between traditional C language and Embedded C:
以下是传统C语言与嵌入式C之间的区别:
| C Language C语言 | Embedded C Language 嵌入式C语言 |
|---|---|
| It is of native development nature 它是原生开发性质的 | It is used for cross-development purposes 它用于交叉开发目的 |
| C is independent of hardware and its underlying architecture C独立于硬件及其底层架构 | Embedded C is dependent on the hardware architecture. 嵌入式C依赖于硬件架构。 |
| C is mainly used for developing desktop applications. C主要用于开发桌面应用程序。 | Embedded C is used in embedded systems that have limited resources like ROM, RAM, etc. 嵌入式C用于资源有限的嵌入式系统,如ROM、RAM等。 |
149. What are the differences between Inline and Macro Function?
内联函数和宏函数之间有什么区别?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37abd58d557c902ba98b1 | 官方: 否 | 付费: 否
答案:
| Category 类别 | Macro Function 宏函数 | Inline Function 内联函数 |
|---|---|---|
| Compile-time expansion 编译时展开 | Macro functions are expanded by the preprocessor at the compile time. 宏函数由预处理器在编译时展开。 | Inline functions are expanded by the compiler. 内联函数由编译器展开。 |
| Argument Evaluation 参数求值 | Expressions passed to the Macro functions might get evaluated more than once. 传递给宏函数的表达式可能会被多次求值。 | Expressions passed to Inline functions get evaluated once. 传递给内联函数的表达式只被求值一次。 |
| Parameter Checking 参数检查 | Macro functions do not follow strict parameter data type checking. 宏函数不进行严格的参数数据类型检查。 | Inline functions follow strict data type checking of the parameters. 内联函数对参数进行严格的数据类型检查。 |
| Ease of debugging 调试便利性 | Macro functions are hard to debug because it is replaced by the pre-processor as a textual representation which is not visible in the source code. 宏函数很难调试,因为它由预处理器以文本形式替换,这在源代码中不可见。 | Easier to debug inline functions which is why it is recommended to be used over macro functions. 内联函数更容易调试,这就是为什么建议优先使用它而不是宏函数。 |
| Example 示例 | #define SQUARENUM(A) A A -> The macro functions are expanded at compile time. Hence, if we pass, the output will be evaluated to 3+23+2 which gets evaluated to 11. This might not be as per our expectations. #define SQUARENUM(A) A A -> 宏函数在编译时展开。因此,如果我们传递,输出将被求值为3+23+2,结果为11。这可能不符合我们的预期。 | inline squareNum(int A){return A A;} -> If we have printf(squareNum(3+2));, the arguments to the function are evaluated first to 5 and passed to the function, which returns a square of 5 = 25. inline squareNum(int A){return A A;} -> 如果我们有printf(squareNum(3+2));,函数的参数首先被求值为5,然后传递给函数,该函数返回5的平方=25。 |
150. Is it possible for a variable to be both volatile and const?
变量是否可能既是volatile又是const?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98b4 | 官方: 否 | 付费: 否
答案:
The const keyword is used when we want to ensure that the variable value should not be changed. However, the value can still be changed due to external interrupts or events. So, we can use const with volatile keywords and it won’t cause any problem.
const 关键字用于当我们希望确保变量值不应被更改时。然而,该值仍可能因外部中断或事件而改变。因此,我们可以将 const 与 volatile 关键字结合使用,这不会造成任何问题。
Successful Tech Career for FREE!
免费开启成功的科技职业生涯!
Successful Tech Career!
成功的技术职业生涯!
Interview Process
面试流程
CTC & Designation
CTC与职位级别
Projects on the Job
工作项目
Referral System
推荐系统
Try It Out
试试看
2 Lakh+ Roadmaps Created
已生成20万+职业规划
151. Is it possible to declare a static variable in a header file?
是否可以在头文件中声明一个静态变量?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98b7 | 官方: 否 | 付费: 否
答案:
Variables defined with static are initialized once and persists until the end of the program and are local only to the block it is defined. A static variables declaration requires definition. It can be defined in a header file. But if we do so, a private copy of the variable of the header file will be present in each source file the header is included. This is not preferred and hence it is not recommended to use static variables in a header file.
用 static 定义的变量只初始化一次,并持续到程序结束,且仅在其定义的块内局部有效。静态变量的声明需要定义。它可以在头文件中定义。但如果我们这样做,包含该头文件的每个源文件中都会存在该头文件变量的一个私有副本。这是不推荐的,因此不建议在头文件中使用静态变量。
152. What do you understand by the pre-decrement and post-decrement operators?
你如何理解前置递减和后置递减运算符?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98ba | 官方: 否 | 付费: 否
答案:
The Pre-decrement operator ( --operand ) is used for decrementing the value of the variable by 1 before assigning the variable value.
前置递减运算符( --操作数 )用于在赋值变量值之前将变量值减1。
include < stdio.h >
int main(){
int main(){
int x = 100, y;
int x = 100, y;
y = --x; //pre-decrememt operators -- first decrements the value and then it is assigned
y = --x; //前置递减运算符——先递减值,然后才赋值
printf("y = %d\n", y); // Prints 99
printf("y = %d\n", y); // 打印 99
printf("x = %d\n", x); // Prints 99
printf("x = %d\n", x); // 打印 99
return 0;
return 0;
}
The Post-decrement operator ( operand-- ) is used for decrementing the value of a variable by 1 after assigning the variable value.
后置递减运算符( 操作数-- )用于在赋值变量值之后将变量值减1。
include < stdio.h >
int main(){
int main(){
int x = 100, y;
int x = 100, y;
y = x--; //post-decrememt operators -- first assigns the value and then it is decremented
y = x--; //后置递减运算符——先赋值,然后才递减
printf("y = %d\n", y); // Prints 100
printf("y = %d\n", y); // 打印 100
printf("x = %d\n", x); // Prints 99
printf("x = %d\n", x); // 打印 99
return 0;
return 0;
}
153. What is a reentrant function?
什么是可重入函数?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37abd58d557c902ba98bd | 官方: 否 | 付费: 否
答案:
A function is called reentrant if the function can be interrupted in the middle of the execution and be safely called again (re-entered) to complete the execution. The interruption can be in the form of external events or signals or internal signals like call or jump. The reentrant function resumes at the point where the execution was left off and proceeds to completion.
如果一个函数在执行过程中可以被中断,并且能安全地再次调用(重新进入)以完成执行,则该函数被称为可重入的。中断可以以外部事件、信号或内部信号(如调用或跳转)的形式发生。可重入函数从其执行中断的位置恢复并继续执行至完成。
154. List the few types of Operating Systems which you know about. Also list some examples of Operating Systems.
列出你知道的几种操作系统类型。同时列出一些操作系统的示例。
- 知识点: 操作系统与网络 (标签: interviewbit, genpact, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Genpact
- id: 69b37aff58d557c902babf92 | 官方: 否 | 付费: 否
答案:
A few types of Operating Systems which I know about are as follows: - Batch Operating System: A batch operating system is a computer program that automatically sequences jobs without the need for human interaction.
我所了解的一些操作系统类型如下:- 批处理操作系统:批处理操作系统是一种计算机程序,无需人工交互即可自动排列作业顺序。
- Time-Sharing Operating System: Many people can share computer resources with a time-sharing operating system. There is maximum resource utilization in this type of operating system.
- Distributed Operating Systems: A distributed operating system (DOS) is software that manages a number of computers and makes them appear to be one.
- Network Operating System: In-Network Operating Systems, computers with various operating systems can connect to a common network. It is used usually for security purposes.
Real-Time Operating Systems: Real-Time Operating Systems (RTOS) are employed in situations where a great number of events, most of which are external to the computer system, must be accepted and processed quickly or under tight deadlines. Industrial control, telephone switching equipment, aircraft control, and real-time simulations are examples of such uses.
Some examples of Operating Systems are as follows: - Windows (Graphical User Interface Operating System based for Personal Computers)操作系统的一些示例如下:- Windows(基于个人计算机的图形用户界面操作系统)
- GNU or Linux (for Personal Computers, File and Print server, Workstations, ISP, Three-tier Clients and Servers)
- iOS (Apple’s OS for iPhone, iPad, and iPod Touch)
- macOS (for Apple’s Personal Computers and Workstations like MacBook, iMac, etc.
- Android (Google’s Operating System for Google's smartphones, tablets, smartwatches, etc.)
155. What are the different types of Real Time Operating Systems?
实时操作系统有哪些不同类型?
- 知识点: 操作系统与网络 (标签: interviewbit, genpact, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Genpact
- id: 69b37aff58d557c902babf96 | 官方: 否 | 付费: 否
答案:
The term "Real-Time Operating System" refers to a system that is subjected to real-time constraints, i.e., the response must be guaranteed within a certain time restriction or the system must satisfy a specific deadline.
“实时操作系统”一词指的是受实时约束的系统,即必须在特定时间限制内保证响应,否则系统必须满足特定的截止期限。
For instance, a flight control system, real-time monitoring, and so on. Real-time systems with timing constraints include the following types: - Hard Real-Time Operating System — A system of this type will never miss a deadline. The implications of missing the deadline might be disastrous. If tardiness increases, the utility of a hard real-time system's result declines abruptly, and it may even become negative. Tardiness refers to how late a real-time system does a task in comparison to its deadline. As an example, consider a flight controller system.
例如,飞行控制系统、实时监控等。具有时间约束的实时系统包括以下类型:- 硬实时操作系统——这类系统绝不会错过截止期限。错过截止期限的后果可能是灾难性的。如果延迟增加,硬实时系统结果的效用会急剧下降,甚至可能变为负值。延迟是指实时系统完成任务相比其截止期限晚多少。例如,考虑一个飞行控制器系统。
- Soft Real-Time Operating System — This type of system can occasionally miss its deadline with a low likelihood. There are no dire implications if you miss the deadline. With the increasing delay, the utility of a soft real-time system's result rapidly reduces. Switches on phones are examples of Soft Real-Time Operating Systems.
156. What is an operating system? Explain its basic functions?
什么是操作系统?解释其基本功能?
- 知识点: 操作系统与网络 (标签: interviewbit, hashedin, company-specific)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: general
- 公司: HashedIn
- id: 69b37b2f58d557c902badba7 | 官方: 否 | 付费: 否
答案:
Operating Systems (OS) manage and handle all hardware and software resources on a computer. In the early 1950s, GMOs, or general-purpose operating systems, were introduced. OS handles, coordinates, and manages overall activities and shares computer resources. An OS acts as an intermediary between users of computers and the hardware they use.
操作系统(OS)管理并处理计算机上的所有硬件和软件资源。在20世纪50年代初,通用操作系统(GMOs,即general-purpose operating systems)被引入。操作系统处理、协调和管理整体活动,并共享计算机资源。操作系统是计算机用户与其所用硬件之间的中介。
Functions of Operating System -
操作系统的功能 -
The OS performs many tasks. The important OS capabilities are listed below. - OS manages the memory of the System and Processor.
操作系统执行许多任务。重要的操作系统能力如下所列。- 操作系统管理系统和处理器内存。
- OS provides an Interface for users where users can interact with System.
- OS also handles File Management and Device Management.
- OS Schedules resources and jobs for the CPU.
- OS also helps in error detection.
- OS also manages the Security of the System.
157. What is the role of Domain Name System (DNS)?
域名系统(DNS)的作用是什么?
- 知识点: 操作系统与网络 (标签: interviewbit, hcl, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: HCL Technologies
- id: 69b37b3658d557c902badf65 | 官方: 否 | 付费: 否
答案:
The main role of the Domain Name System (DNS) is to translate domain names into IP Addresses. These IP addresses are the ones that computers can understand. It also gives a list of mail servers that accept Emails for each domain name. Every domain name in the DNS will nominate a set of name servers to be authoritative for its DNS records. For example, when a Web address (URL) is typed into a browser, a DNS query is made to learn an IP address of a Web server associated with that name.
域名系统(DNS)的主要作用是将域名翻译成IP地址。这些IP地址是计算机能够理解的地址。它还为每个域名提供接受电子邮件的邮件服务器列表。DNS中的每个域名将指定一组名称服务器作为其DNS记录的权威来源。例如,当在浏览器中输入一个网址(URL)时,会发出DNS查询以了解与该名称关联的Web服务器的IP地址。
158. What do you mean by replication?
复制是什么意思?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb042d | 官方: 否 | 付费: 否
答案:
In replication, data is synchronized between two or more servers. This is a method of storing the same data on more than one site or server. This feature allows data to be accessed seamlessly even during server downtimes or heavy traffic. Users gain consistent access to data while not interfering with or slowing down those of other users.
在复制中,数据在两个或多个服务器之间同步。这是一种在多个站点或服务器上存储相同数据的方法。此功能使得即使在服务器停机或流量高峰期间也能无缝访问数据。用户可以获得对数据的一致访问,同时不会干扰或减慢其他用户的操作。
Replication of data is more than just a backup. A publisher is considered to be the server that originates the data, and a subscriber is the one where it is replicated. Data replication involves the publisher synchronizing its transaction with the subscriber and updating subscriber data automatically. A change made on the publisher's side is automatically reflected on the subscriber's side as well.
数据复制不仅仅是备份。发布者被认为是产生数据的服务器,而订阅者是数据被复制到的服务器。数据复制涉及发布者将其事务与订阅者同步,并自动更新订阅者的数据。在发布者端所做的更改会自动反映在订阅者端。
159. What do you mean by BLE (Bluetooth Low Energy)?
BLE(蓝牙低能耗)是什么意思?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0430 | 官方: 否 | 付费: 否
答案:
Beginners may see BLE (Bluetooth Low Energy) as a type of Bluetooth that uses less power, uses less energy. BLE, or Bluetooth Smart, is a relatively new form of Bluetooth technology that consumes much less power and costs than classic Bluetooth while offering a similar range of communication. As shown in the following diagram, BLE is not a replacement for Classic Bluetooth and they both serve a specific marketplace.
初学者可能将BLE(蓝牙低能耗)视为一种使用更少电力、更少能源的蓝牙类型。BLE,或称为蓝牙智能,是一种相对较新的蓝牙技术形式,相比经典蓝牙,其功耗和成本更低,同时提供类似的通信范围。如下方图示所示,BLE并不是经典蓝牙的替代品,它们各自服务于特定的市场。
The Bluetooth Low Energy technology has been developed with the purpose of facilitating the IoT. Generally, the Internet of Things is about connecting devices with each other, usually via a wireless connection, such as Bluetooth low energy to allow them to communicate and share data. With its high energy efficiency, BLE has become a preferred and ideal choice for IoT. IoT enthusiasts and application developers have increasingly adopted Bluetooth LE to connect smart devices.
蓝牙低能耗技术的开发目的是促进物联网的发展。一般来说,物联网是指将设备互相连接,通常通过无线连接(如蓝牙低能耗)使它们能够通信和共享数据。凭借其高能效,BLE已成为物联网的首选和理想选择。物联网爱好者和应用程序开发者越来越广泛地采用蓝牙低能耗来连接智能设备。
160. What are the different components of IoT?
物联网的组成部分有哪些?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0433 | 官方: 否 | 付费: 否
答案:
IoT devices usually consist of four main components as follows:
物联网设备通常包括以下四个主要组件:
- Sensors: A sensor or device is an important component for gathering live data from the surrounding environment. The nature of this data can vary. This could be as simple as your phone having a temperature sensor, GPS, an accelerometer, or as complex as a live video feature on a social media platform. Sensors make it possible for IoT devices to connect to the real world and environment.
- Connectivity: Upon collection, all data is sent to a cloud infrastructure. This could be done by connecting the sensors to the cloud using a variety of communication mediums such as mobile or satellite networks, Bluetooth, WI-FI, WAN, etc. Various IoT devices use different types of connectivity.
- Data Processing: Once the data has been collected, and has reached the cloud, it is the responsibility of the data processors to process it. Data processing software can enhance IoT devices in a wide range of ways, from adjusting the temperature of the air conditioner to recognizing faces on mobile phones.
- User Interface: An IoT device interacts with a user through a User Interface. A user interface is the visible, tangible component of an IoT system that can be accessed by users. It involves presenting the information in a way that is valuable to the end-user. A well-designed user interface will simplify the experience for users and encourage them to interact more. Information needs to be made accessible to end-users in some way, like sending them alerts via notification, email or text message.
161. What are the advantages of IoT?
物联网的优势是什么?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0436 | 官方: 否 | 付费: 否
答案:
An IoT (Internet of Things) system is an advanced automation and analytics system that makes use of networking, big data, sensing, and Artificial Intelligence to provide a complete solution. It provides the following benefits:
物联网(IoT)系统是一种高级自动化和分析系统,利用网络、大数据、传感和人工智能提供完整解决方案。它提供以下好处:
- Improved customer engagement: IoT facilitates a better customer experience by automating tasks. In a car, for instance, any issue will be detected automatically by sensors. It will be notified to both the driver and manufacturer.
- Technical optimization: IoT has improved technology and made it more efficient. It has turned even old "dumb" devices into "smart" ones by making them able to transmit data over the internet, facilitating communication with people and other IoT-enabled devices. For example, coffee machines, smart toys, smart microwaves, etc.
- Ease of Access: IoT has now enabled access to real-time information from (almost) any location. All you need is a smart device connected to the internet.
- Improved Insights: Currently we rely on superficial insights to make decisions, but IoT provides real-time insights that lead to more efficient resource management.
- New business opportunities: By collecting and analyzing data from the network, you can uncover new business insights and generate new opportunities while reducing operational costs.
- Effective Time Management: Overall, the Internet of Things can save you a lot of time. While we commute to work, we can read the latest news on our phones, browse a blog about our favourite hobby, or shop online.
- Improved security measures: Using IoT, access control systems can provide additional security to organizations and individuals. As an example, IoT technology in surveillance can assist in improving security standards in an organization, as well as identifying any suspicious activity.
162. What are the challenges or risks associated with IoT?
物联网面临哪些挑战或风险?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0439 | 官方: 否 | 付费: 否
答案:
The following are some security risks associated with IoT:
以下是与物联网相关的一些安全风险:
- Privacy: Connected IoT devices are vulnerable to hacking. Many IoT devices collect and transmit personal data over an open network without encryption, making it easy for hackers to access. Hackers may also use cloud endpoints to attack servers.
- Insufficient testing & Outdated product: In a fast-paced market like IoT, many companies or manufacturers rush to start releasing their products and software without doing enough testing. Many of them don't provide timely updates as well. Unlike other devices such as smartphones, IoT devices are not updated, which can leave them vulnerable to data theft. Thus, IoT devices should be tested thoroughly and updated as soon as new vulnerabilities are identified in order to maintain security.
- Lack of knowledge and awareness: Despite being a growing technology, people do not know much about IoT. A major security threat associated with IoT is the user's lack of knowledge and awareness of its capabilities. This poses a threat to all users.
- Network Connectivity: Network connectivity can be challenging for many IoT devices. Particularly if such devices are widely dispersed, in remote locations, or if bandwidth is severely limited.
- Reliability: Given the highly distributed nature of IoT devices, it can be difficult to ensure the reliability of IoT systems. Various conditions can affect the components that make up an IoT system, such as natural disasters, disruptions in cloud services, power outages, and system failures.
163. What are different types of sensors in IoT?
物联网中有哪些不同类型的传感器?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb043c | 官方: 否 | 付费: 否
答案:
In recent years, Internet-of-Thing sensors have gained importance for enhancing productivity, lowering costs, and improving worker safety. Sensors are devices that detect changes in the environment condition and act accordingly. They detect specific types of conditions (such as light, heat, sound, distance, pressure, presence or absence of gas/liquid, etc.) in the physical world and then generate a signal (usually an electrical signal) as a measure of their magnitude. Sensors commonly used in IoT systems include: - Temperature sensors
近年来,物联网传感器在提高生产力、降低成本和提高工人安全方面变得日益重要。传感器是检测环境条件变化并相应采取行动的设备。它们检测物理世界中的特定类型条件(如光、热、声音、距离、压力、气体/液体的存在或不存在等),然后生成信号(通常是电信号)作为其大小的度量。物联网系统中常用的传感器包括:- 温度传感器
- Pressure sensor
- Motion detection sensors
- Gas sensor
- Proximity sensor
- IR sensors
- Smoke Sensor, etc.
164. What are different layers of the IoT protocol stack? Write the classification of IoT protocols.
物联网协议栈有哪些不同层级?写出物联网协议的分类。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb043f | 官方: 否 | 付费: 否
答案:
Internet of Things (IoT) protocols are ways of protecting data and ensuring it is exchanged securely between devices via the Internet. IoT protocols define how data is transmitted across the internet. By doing so, they ensure that data being exchanged between connected IoT devices is secure.
物联网(IoT)协议是保护数据并确保设备通过互联网安全交换数据的方式。物联网协议定义了数据如何通过互联网传输。通过这样做,它们确保连接的物联网设备之间交换的数据是安全的。
Classification of IoT Protocols -
IoT协议的分类 -
| Layer 层 | Protocol 协议 |
|---|---|
| Application layer 应用层 | Advanced Message Queuing Protocol (AMQP) Message Queue Telemetry Transport (MQTT) Constrained Application Protocol (CoAP) 高级消息队列协议 (AMQP) 消息队列遥测传输 (MQTT) 受限应用协议 (CoAP) |
| Transport layer 传输层 | User Datagram Protocol (UDP) Transmission Control Protocol (TCP) 用户数据报协议 (UDP) 传输控制协议 (TCP) |
| Network layer 网络层 | 6LoWPAN IP |
| Datalink layer 数据链路层 | LPWAN IEEE 802.15.4 MAC |
| Physical layer 物理层 | IEEE 802.15.4 MAC Near field communication (NFC) Radio frequency identification (RFID) Bluetooth Low Energy (BLE) Ethernet IEEE 802.15.4 MAC 近场通信 (NFC) 射频识别 (RFID) 低功耗蓝牙 (BLE) 以太网 |
165. What are different communication models in IoT?
IoT中有哪些不同的通信模型?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0442 | 官方: 否 | 付费: 否
答案:
In general, the Internet of Things is about connecting devices to the Internet, but how they connect is not always obvious. IoT devices connect and communicate through their technical communication models. An effective communication model shows how the process works and helps one understand how communication can be done. The Internet of Things (IoT) enables people and things (devices) to be connected wherever they are, using any network or service they like.
一般来说,物联网是将设备连接到互联网,但它们的连接方式并不总是显而易见的。IoT设备通过其技术通信模型进行连接和通信。有效的通信模型展示了过程如何运作,并有助于理解通信是如何进行的。物联网(IoT)使人们和事物(设备)无论身在何处,都能使用他们喜欢的任何网络或服务进行连接。
Types of communication models - - Request-Response Model: This communication model is based on the client (IoT Device) making requests and the server responding to those requests. Upon receiving a request, the server decides what response to provide, fetches the requested data, prepares the response, and then sends it back to the client. This model is stateless because the data between requests is not retained, therefore each request is handled independently.
通信模型的类型 - - 请求-响应模型:此通信模型基于客户端(IoT设备)发出请求,服务器响应这些请求。收到请求后,服务器决定提供什么响应,获取所请求的数据,准备响应,然后将其发送回客户端。此模型是无状态的,因为请求之间的数据不被保留,因此每个请求都独立处理。
- Publisher-Subscriber Model: Publishers, brokers, and consumers are all involved in this communication model. Publishes are the sources of data that send data to topics. The broker manages the topics, and consumers (consume data from topics) subscribe to the topics. Publishers and consumers are unaware of each other. Upon receiving data for a topic from the publisher, the broker forwards it to all subscribed consumers. As a result, brokers are responsible for receiving data from publishers and sending it to the appropriate consumers.
- Push-Pull Model: This communication model entails data producers pushing the data into queues, while data consumers pull the data from the queues. Neither producer nor consumer needs to know about each other. The queues help decouple the messages between the consumers and the producers. Also, queues act as a buffer when there is a mismatch between the rate at which producers push data and the rate at which consumers pull it.
- Exclusive-Pair Model: Exclusive pairs are full-duplex, bidirectional communication models developed for constant/continuous connections between a client and server. After a connection is established, clients and servers can exchange messages. As long as a client doesn't send a request to close the connection, the connection remains open. The server is aware of every open connection.
166. Write some of the most common IoT applications.
写出一些最常见的IoT应用。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0445 | 官方: 否 | 付费: 否
答案:
Following are some of the most common real-world applications of IoT: - Smart Homes: Smart homes are one of the most practical applications of IoT. Though IoT is applied in smart homes at various levels, the best one combines intelligent systems and entertainment. Example: Set-top box that allows you to record shows from remote, an automatic lighting system, a smart lock, etc.
以下是IoT一些最常见的现实世界应用:- 智能家居:智能家居是IoT最实用的应用之一。虽然IoT在智能家居中应用于不同层面,但最佳的结合是智能系统与娱乐。示例:允许你远程录制节目的机顶盒、自动照明系统、智能锁等。
- Connect Health: Connected health systems allow for real-time monitoring and patient care. Patient data assists in better medical decisions. Also, IoT improves the power, precision, and availability of current devices.
- Wearables: Wearable devices have emerged as one of the earliest industries to deploy the IoT at scale. Various wearable devices are available today, such as Fit Bits, heart rate monitors, and smartwatches.
- Connected Cars: Connected cars use internet connectivity and onboard sensors to optimize their operation, maintenance, and passengers' comfort. Some of the leading automakers are working on bringing the next revolution to the car industry, including Tesla, BMW, Apple, and Google.
- Hospitality: By applying IoT to the hotel industry, a higher level of service quality is achieved. Various interactions can be automated by using electronic keys that are sent directly to the mobile devices of guests. Therefore, the IoT technology enables integrated applications to manage activities such as tracking guests' locations, sending offers or information about interesting activities, placing orders for room service or room orders, and automatically charging the room account.
- Farming: A variety of tools are being developed to deal with Drip Irrigation, understanding crop patterns, Water Distribution, drones for farm surveillance, etc. Farmers will be able to increase yields and address concerns using these methods.
167. Explain how IoT works.
解释IoT如何工作。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0448 | 官方: 否 | 付费: 否
答案:
Artificial Intelligence is at the core of IoT devices. The IoT consists of multiple components: sensors, a cloud component, data processing software, and cutting-edge user interfaces.
人工智能是IoT设备的核心。IoT由多个组件组成:传感器、云组件、数据处理软件和尖端用户界面。
IoT systems consist of sensors/devices connected to the cloud via some form of connectivity. A Raspberry Pi equipped with a quadcore processor can be used as an "Internet gateway" for IoT devices. It is a card-sized computer using which you can control outputs with GIPO (general purpose input/output) pins as well as collect data about real-world conditions using sensors. A sensor gathers live data from the surrounding environment and sent to a cloud infrastructure. Once the data reaches the cloud, the software can process it and decide what action to take, such as sending an alert or automatically adjusting the sensors/devices without user intervention.
IoT系统包括通过某种形式的连接性连接到云的传感器/设备。配备四核处理器的树莓派可以用作IoT设备的“互联网网关”。它是一个卡片大小的计算机,你可以使用它通过GIPO(通用输入/输出)引脚控制输出,以及使用传感器收集真实世界条件的数据。传感器从周围环境收集实时数据,并将其发送到云基础设施。一旦数据到达云,软件可以处理它并决定采取什么行动,例如发送警报或自动调整传感器/设备而无需用户干预。
A user interface is used if user input is required or if they want to check in on the system. Adjustments made by the user are then sent inversely through the system - from the user interface to the cloud, and from the cloud back to the sensors/devices to make changes. As a result, a highly reactive and intuitive device is created which greatly increases automation.
如果需要用户输入或用户想要查看系统状态,则使用用户界面。用户所做的调整然后通过系统反向传递 - 从用户界面到云,再从云返回传感器/设备以进行更改。因此,创建了高度响应且直观的设备,大大增加了自动化程度。
168. Explain the characteristics of IoT.
解释IoT的特征。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb044b | 官方: 否 | 付费: 否
答案:
The following are the most important features of IoT on which it operates:
以下是IoT运行所依赖的最重要特征:
- Connectivity: Connectivity is the most important aspect of IoT. The IoT ecosystem (i.e. sensors, compute engines, data hubs, etc.) cannot operate properly without seamless communication among the interrelated components or objects. There are many ways to connect IoT devices including radio waves, Bluetooth, Wi-Fi, and Li-Fi.
- Analyzing/Sensing: Once all the relevant things are connected, the next step is to analyze data that is being collected and use it to build effective business intelligence. It is very important to extract knowledge from the generated data. A sensor, for example, generates data, but those data won't be of much use unless they are interpreted properly by us.
- Active Engagements: A lot of today's interactions with connected technology occur via passive engagement. Through IoT, multiple products, cross-platform technologies, and services work together on an active engagement basis. The use of cloud computing in blockchain enables active engagements among IoT components in general.
- Scalability: Each day, more and more elements are connecting to the IoT zone. IoT setups should therefore be able to handle massive expansion. The data generated as a result is immense, and it should be handled correctly.
- Artificial Intelligence: The IoT essentially makes things such as mobile phones, wearables, vehicles, etc., smart and enhances life by making use of data collection, artificial intelligence algorithms, and networked technologies. For example, if you have a coffee machine whose beans are going to end, it will order coffee beans from the retailer of your choice.
169. What is a thermocouple sensor?
什么是热电偶传感器?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb044e | 官方: 否 | 付费: 否
答案:
A thermocouple is a sensor that measures temperature by coupling two metal pieces together. The temperature is measured at a junction between these two pieces of metal which are joined at one end. A small voltage is generated by the metal conductors, which can be interpreted to calculate the temperature. A thermocouple is a simple, robust, and cost-effective temperature sensor available in multiple types and sizes. Additionally, they measure a wide temperature range, making them suitable for a variety of applications, such as scientific research, industrial settings, home appliances, and so on.
热电偶是一种通过将两块金属连接在一起测量温度的传感器。温度在这两块金属的接合处测量,它们在一端相连。金属导体产生一个小电压,这可以被解释以计算温度。热电偶是一种简单、坚固且成本效益高的温度传感器,有多种类型和尺寸。此外,它们测量宽温度范围,使其适用于各种应用,如科学研究、工业环境、家用电器等。
170. Explain the term ‘smart city’ in IoT.
解释IoT中“智慧城市”这一术语。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0451 | 官方: 否 | 付费: 否
答案:
IoT technology has been a driving force behind the development of smart cities since their inception. IoT technology will continue to grow as more countries adopt next-generation connectivity, and it will have a greater impact on our lives. Connected sensors, lights, and meters are some of the IoT devices in smart cities that collect and analyze data. As a result, cities use this data to improve infrastructure, utilities, and other city services.
自智能城市诞生以来,物联网技术一直是其发展的驱动力。随着更多国家采用下一代连接技术,物联网将继续增长,并对我们的生活产生更大影响。智能城市中的物联网设备包括连接传感器、路灯和仪表等,用于收集和分析数据。因此,城市利用这些数据来改善基础设施、公用事业和其他城市服务。
It is possible to create clever energy grids, automated waste management systems, smart homes, advanced security systems, traffic management mechanisms, water conservation mechanisms, smart lighting, and more with the help of the IoT. IoT has added a new layer of artificial intelligence and innovation to public utilities and urban planning, allowing them to be highly intuitive. These innovations have led to the emergence of smart homes and cities.
借助物联网,可以创建智能电网、自动化废物管理系统、智能家居、先进安全系统、交通管理机制、水资源节约机制、智能照明等。物联网为公共事业和城市规划增添了新的人工智能和创新层,使其具有高度直观性。这些创新促成了智能家居和智能城市的出现。
171. What do you mean by PWM (Pulse Width Modulation)?
你所说的PWM(脉冲宽度调制)是什么意思?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0454 | 官方: 否 | 付费: 否
答案:
Have trouble adjusting the brightness of the LEDs in your project? Changing the voltage of the power supply directly in the circuit isn't easy. In that case, you can use Pulse Width Modulation (PWM).
在调整项目中LED亮度时遇到问题了吗?直接在电路中改变电源电压并不容易。在这种情况下,你可以使用脉冲宽度调制(PWM)。
Pulse Width Modulation (PWM), also referred to as PDM (Pulse Duration Modulation) refers to changing the amount of power that is delivered to a device. PWM is a technique for generating an analog signal from a digital source and is an efficient way to control the amount of energy delivered to a load without wasting any energy. PWM regulates voltage and is therefore used to control brightness in Smart Lighting Systems and also to control motor speed.
脉冲宽度调制(PWM),也称为脉冲持续时间调制(PDM),指的是改变传递给设备的功率量。PWM是一种从数字源生成模拟信号的技术,是控制传递给负载的能量而不浪费能量的高效方式。PWM调节电压,因此常用于智能照明系统中的亮度控制,也用于控制电机速度。
172. Explain Shodan.
解释一下Shodan。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0457 | 官方: 否 | 付费: 否
答案:
Shodan (Sentient Hyper-Optimized Data Access Network) is a search engine similar to Google, but it does not search for websites, but rather maps and information about internet-connected devices/systems. Shodan is sometimes referred to as an IoT search engine. To put it simply, Shodan is an IoT tool used to identify Internet-connected devices. It keeps track of all the machines with direct Internet access.
Shodan(感知型超优化数据访问网络)是一种类似于Google的搜索引擎,但它不搜索网站,而是搜索互联网连接设备/系统的映射和信息。Shodan有时被称为物联网搜索引擎。简单来说,Shodan是一种用于识别互联网连接设备的物联网工具。它跟踪所有可直接访问互联网的机器。
Cybersecurity experts use Shodan as a tool to protect individuals, companies, and even public utilities against cyber-attacks. Shodan lets you search for any internet-connected device, and it will tell you if it is publicly available or not.
网络安全专家使用Shodan作为保护个人、公司甚至公共事业免受网络攻击的工具。Shodan允许你搜索任何互联网连接的设备,并告知你是否可公开访问。
173. What do you mean by IoT Contiki?
你所说的物联网Contiki是什么意思?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb045a | 官方: 否 | 付费: 否
答案:
Contiki is an operating system developed for IoT devices with limited memory, power, bandwidth, and processing power. Despite being minimalist, it still contains many of the features common to modern operating systems. Programs, processes, resources, memory, and communication can be managed with its help. Due to its lightweight (by modern standards), mature, and flexible nature, it has become a go-to operating system by many academics, researchers, and professionals.
Contiki是为内存、功耗、带宽和处理能力有限的物联网设备开发的操作系统。尽管它极简,但仍包含现代操作系统常见的许多功能。它可以帮助管理程序、进程、资源、内存和通信。由于其轻量级(按现代标准)、成熟且灵活的特性,它已成为许多学者、研究人员和专业人士的首选操作系统。
174. Name some of the most suitable databases for IoT.
列举一些最适合物联网的数据库。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb045d | 官方: 否 | 付费: 否
答案:
The following databases are suitable for IoT: - InfluxDB
以下数据库适用于物联网:- InfluxDB
- Apache Cassandra
- RethinkDB
- MongoDB
- Sqlite
175. Explain sharding.
解释一下分片。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0460 | 官方: 否 | 付费: 否
答案:
Sharding is the process of splitting very large databases into smaller, faster, and easier to manage pieces, called data shards. A shard is a small portion or chunk of a large data set. The principle of sharding is to split a logical dataset into multiple databases in order to store it more efficiently. In the case of a dataset that cannot be stored in a single database, sharding is necessary.
分片是将非常大的数据库拆分为更小、更快、更易管理的部分(称为数据分片)的过程。分片是大型数据集的一小部分或块。分片的原则是将逻辑数据集拆分到多个数据库中,以便更高效地存储。如果数据集无法存储在单个数据库中,则必须进行分片。
IoT Questions for Experienced
176. What do you mean by Raspberry Pi?
你所说的树莓派是什么意思?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0463 | 官方: 否 | 付费: 否
答案:
Raspberry Pi is a card-sized computer with features like General Purpose Input Output (GPIO) pins, WiFi, and Bluetooth that allow it to communicate, control, and connect to other external devices. Combining IoT applications with Raspberry Pi helps businesses embrace technology more effectively.
树莓派是一种卡片大小的计算机,具有通用输入输出(GPIO)引脚、WiFi和蓝牙等功能,使其能够与其他外部设备通信、控制和连接。将物联网应用与树莓派结合,有助于企业更有效地采用技术。
177. State the difference between IoT and M2M.
说明IoT和M2M之间的区别。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0466 | 官方: 否 | 付费: 否
答案:
IoT (Internet of Things): It is referred to as a network comprised of interconnected physical objects that are capable of collecting and exchanging data. These devices contain embedded systems (software, electronics, networks, and sensors) that are able to collect data about the surrounding environment, transmit data over a network, respond to remote commands, or take actions based on data collected. The Internet of Things (IoT) is a subset of M2M (Machine to Machine) technology. In IoT, two machines communicate without human intervention, making it a part of M2M.
IoT(物联网):它指的是一种由相互连接的物理对象组成的网络,这些对象能够收集和交换数据。这些设备包含嵌入式系统(软件、电子元件、网络和传感器),能够收集周围环境的数据、通过网络传输数据、响应远程命令,或根据收集的数据采取行动。物联网(IoT)是M2M(机器对机器)技术的子集。在IoT中,两台机器在没有人为干预的情况下通信,使其成为M2M的一部分。
M2M (Machine to Machine): In M2M, devices communicate with each other directly via wired or wireless channels, without any human interaction. It enables devices to communicate and share data with each other without relying on the internet. Several applications of M2M communications are available, including security, tracking, and tracing, manufacturing, and facility management.
M2M(机器对机器):在M2M中,设备通过有线或无线通道直接相互通信,无需任何人为交互。它使设备能够不依赖互联网而相互通信和共享数据。M2M通信有多种应用,包括安全、跟踪和追溯、制造和设施管理。
| IoT | M2M |
|---|---|
| It is a network of connected devices (via the Internet) that have the ability to collect, process, and transmit data automatically without human intervention. 它是一个通过互联网连接的设备网络,能够自动收集、处理、传输数据,无需人为干预。 | It allows two or more machines to communicate directly and perform certain tasks without requiring human intervention. 它允许两台或更多机器直接通信并执行特定任务,无需人为干预。 |
| In addition, IoT enables objects to interact with the internal and/or external environments, thereby influencing their decision-making. 此外,IoT使物体能够与内部和/或外部环境交互,从而影响其决策。 | The M2M model exhibits some degree of intelligence. Devices capture data and share it with other connected devices, forming an intelligent network. M2M模型展现出一定程度的智能。设备捕获数据并与其他连接的设备共享,形成智能网络。 |
| It facilitates cloud-based communication. 它促进基于云的通信。 | End-to-end communication between devices/machines is supported. 支持设备/机器之间的端到端通信。 |
| In order to improve the end-user experience, data is shared between other applications. 为了改善最终用户体验,数据在其他应用程序之间共享。 | Only parties communicating with each other have access to the data. 只有相互通信的各方才能访问数据。 |
| Internet access is usually required for devices to communicate and share data. 设备通信和共享数据通常需要互联网接入。 | Devices don't usually require an Internet connection for communication. 设备通信通常不需要互联网连接。 |
| Many machines are able to communicate over the internet. 许多机器能够通过互联网进行通信。 | The communication between machines is limited to one at a time. 机器之间的通信限制为一次一个。 |
| Open API integrations are supported. 支持开放API集成。 | Open API integrations are not supported. 不支持开放API集成。 |
| A number of Internet protocols are used, including HTTP, FTP, and Telnet. 使用多种互联网协议,包括HTTP、FTP和Telnet。 | Communication technologies and traditional protocols are used. 使用通信技术和传统协议。 |
178. What do you mean by IoT Gateway? What is the role of a gateway in IoT?
你所说的IoT网关是什么意思?网关在IoT中的角色是什么?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0469 | 官方: 否 | 付费: 否
答案:
Devices such as IoT gateways enable communication between IoT devices, sensors, equipment, and systems. Basically, an IoT gateway is a central hub for all IoT devices. It connects the IoT devices to each other and to the cloud, converting communication among the devices and analyzing data to create useful information. Several critical functions are performed by an IoT gateway, including translating protocols, encrypting, processing, managing, and filtering data. As part of an IoT ecosystem, gateways sit between devices and sensors to communicate with the cloud.
像IoT网关这样的设备使IoT设备、传感器、设备和系统之间能够通信。基本上,IoT网关是所有IoT设备的中心枢纽。它将IoT设备彼此连接并连接到云端,转换设备之间的通信并分析数据以创建有用的信息。IoT网关执行多项关键功能,包括协议转换、加密、处理、管理和过滤数据。作为IoT生态系统的一部分,网关位于设备和传感器之间,与云端通信。
IoT gateways are commonly used for the following purposes: - Interconnecting devices
IoT网关通常用于以下目的:- 互连设备
- Connecting devices to the cloud
- Transforming IoT communications
- Data filtering
- Reducing security risks, etc.
179. Explain WoT (Web of Things).
解释WoT(物联万维网)。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb046d | 官方: 否 | 付费: 否
答案:
WoT (Web of Things) is an advancement of the Internet of Things by integrating smart things not only with the Internet (network) but with the Web Architecture (application). In short, the Web of Things (WoT) is aimed at facilitating the interoperability and usability of IoT. It is a web standard for enabling communication between smart devices and web applications.
WoT(物联万维网)是物联网的进步,通过将智能事物不仅集成到互联网(网络)中,还集成到万维网架构(应用)中。简而言之,物联万维网(WoT)旨在促进IoT的互操作性和可用性。它是用于实现智能设备与Web应用程序之间通信的Web标准。
180. What do you mean by MQTT (Message Queue Telemetry Transport Protocol)?
你所说的MQTT(消息队列遥测传输协议)是什么意思?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0473 | 官方: 否 | 付费: 否
答案:
The Message Queuing Telemetry Transport protocol (MQTT) is a publish/subscribe message protocol designed for networks with limited bandwidth and IoT devices with extremely high latency (delay in data transmission). This messaging protocol is simple and lightweight, suited to devices and networks with low bandwidth, high latency, or insecure networks. It has been designed to reduce network bandwidth and resource requirements of devices and to ensure supply security. Furthermore, these principles are beneficial for IoT or M2M devices, since battery life and bandwidth are very important. Because MQTT is efficient and lightweight, it can be used to monitor or control a large amount of data. Nowadays, MQTT is used in a variety of industries, including automotive, manufacturing, telephony, oil and gas.
消息队列遥测传输协议(MQTT)是一种发布/订阅消息协议,专为带宽有限的网络和具有极高延迟(数据传输延迟)的IoT设备设计。这种消息协议简单且轻量,适用于低带宽、高延迟或不安全网络的设备。它旨在减少设备对网络带宽和资源的需求,并确保供应安全。此外,由于电池寿命和带宽非常重要,这些原则对IoT或M2M设备有益。由于MQTT高效且轻量,它可以用于监控或控制大量数据。如今,MQTT用于各种行业,包括汽车、制造、电话、石油和天然气。
Publishes are the sources of data that send data to topics. The broker manages the topics, and consumers subscribe to the topics. Upon receiving data for a topic from the publisher, the broker forwards it to all subscribed consumers. As a result, brokers are responsible for receiving data from publishers and sending it to the appropriate consumers.
发布者是将数据发送到主题的数据源。代理管理主题,消费者订阅主题。当从发布者接收到某一主题的数据时,代理将其转发给所有订阅的消费者。因此,代理负责从发布者接收数据并将其发送到适当的消费者。
181. Explain Bluegiga APX4 protocol.
解释Bluegiga APX4协议。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0476 | 官方: 否 | 付费: 否
答案:
The Bluegiga APx4 is a low power wireless System-on-Module (SOM). It's an ideal development platform for developing gateways since it's equipped with integrated Wi-Fi, Bluetooth 4.0, ARM, and Linux. Wireless and Bluetooth low energy (BLE) can be used together without interference as they are compliant with coexistence protocols. Bluegiga Apx4 supports both Wi-Fi and Bluetooth, and its 450mhz Arm9 processor provides smooth performance.
Bluegiga APx4是一种低功耗无线系统模块(SOM)。由于它配备了集成的Wi-Fi、蓝牙4.0、ARM和Linux,因此是开发网关的理想开发平台。无线和蓝牙低功耗(BLE)可以同时使用而不受干扰,因为它们符合共存协议。Bluegiga Apx4支持Wi-Fi和蓝牙,其450MHz Arm9处理器提供流畅的性能。
182. What is IoT device management and why do we need it?
什么是IoT设备管理,为什么我们需要它?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0479 | 官方: 否 | 付费: 否
答案:
Once installed, IoT devices may need to be updated or timely fixed. Occasionally, it must be replaced or repaired, resulting in downtime. The problem can be solved using IoT Device management, which can keep the devices in good shape. IoT device management involves provisioning, authenticating, configuring, monitoring, provisioning, and maintaining the connected devices and software's. Effective device management is vital for ensuring the health, security, and connectivity of IoT devices. In order to manage IoT devices, you need to meet the following four requirements.
一旦安装,IoT设备可能需要更新或及时修复。偶尔,它必须被更换或修理,导致停机。可以使用IoT设备管理来解决这个问题,它可以保持设备良好状态。IoT设备管理涉及配置、认证、配置、监控、维护和维护连接的设备和软件。有效的设备管理对于确保IoT设备的健康、安全性和连接性至关重要。为了管理IoT设备,你需要满足以下四个要求。
- Provisioning and Authentication: IoT devices can be attacked quite easily since their network can be accessed via the Internet. This problem is solved by provisioning and authenticating the devices. By provisioning, you modify the device from its off-the-shelf settings to those needed for it to work with your network. In order to prevent intrusions and safeguard proprietary information, authentication ensures only authorized devices are enrolled.
- Configuration and Control: It is always necessary to configure a new device before you can begin using it. It is also critical to control and configure devices after deployment to ensure certain aspects such as performance, security, and functionality. Implementing control capability will be easier this way.
- Monitoring and Diagnostics: The device may go down for a time when there are software bugs or certain other issues. To diagnose these issues, users must constantly monitor their devices. Device management assists in diagnosing these issues in order to resolve them quickly and efficiently.
- Updates and Maintenance: For a device to function flawlessly, it must be updated after it has been installed. This may involve adding new features. Good device management hinges on the ability to update and maintain the software of remote devices securely.
183. State the difference between IoT and IIoT.
说明物联网(IoT)与工业物联网(IIoT)之间的区别。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb047c | 官方: 否 | 付费: 否
答案:
IoT (Internet of Things): Any device that can connect to the internet and transfer data to a remote data server is termed the Internet of Things (IoT).
物联网(IoT):任何能够连接到互联网并将数据传输到远程数据服务器的设备都称为物联网(IoT)。
IIoT (Industrial Internet of Things): In the case of IoT devices used for industrial purposes, these devices are referred to as Industrial Internet of Things (IIoT). IIoT is the subset of IoT.
工业物联网(IIoT):当物联网设备用于工业目的时,这些设备被称为工业物联网(IIoT)。工业物联网是物联网的子集。
Difference between IIoT and IoT-
工业物联网与物联网的区别-
| IIoT 工业物联网 | IoT 物联网 |
|---|---|
| It supports industrial-oriented applications such as manufacturing, power plants, oil & gas, etc. 支持工业导向的应用,如制造业、发电厂、石油和天然气等。 | It supports customer-oriented applications such as wearables to robots and machines. 支持客户导向的应用,如从可穿戴设备到机器人和机器。 |
| The focus is on large scale networks. 重点在于大规模网络。 | The focus is on small scale networks. 重点在于小规模网络。 |
| Both wired and wireless communication methods are utilized. 利用有线和无线通信方法。 | Typically, wireless communication methods are utilized. 通常利用无线通信方法。 |
| A large amount of data is handled. 处理大量数据。 | It can handle data ranging from medium to high. 可以处理中到高范围的数据。 |
| This is a B2B (business-to-business) and is designed to increase efficiency and safety at production facilities. 这是B2B(企业对企业),旨在提高生产设施的效率和安全。 | This is B2C (business-to-consumer) and is designed to make the lives of consumers more convenient. 这是B2C(企业对消费者),旨在让消费者的生活更加便利。 |
184. Explain the meaning of Arduino.
解释Arduino的含义。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb047f | 官方: 否 | 付费: 否
答案:
Arduino is an open-source platform for building electronics projects using easy-to-use hardware and software. A microcontroller is the common feature of all Arduino boards. The microcontrollers on board are capable of reading inputs (e.g., light on a sensor, an object near a sensor) and converting them to outputs (drive a motor, ring an alarm, turn on an LED, display information on an LCD). It is possible to connect multiple devices and exchange data in real-time between them. It is also possible to monitor them remotely using a simple interface.
Arduino是一个开源平台,用于通过易用的硬件和软件构建电子项目。微控制器是所有Arduino板的共同特征。板上的微控制器能够读取输入(例如,传感器上的光,传感器附近的物体)并将其转换为输出(驱动电机,响铃警报,点亮LED,在LCD上显示信息)。可以连接多个设备并在它们之间实时交换数据。也可以使用简单界面远程监控它们。
185. Explain sketch in Arduino and how will you reduce the size of sketch.
解释Arduino中的草图,以及如何减小草图的大小。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0482 | 官方: 否 | 付费: 否
答案:
Arduino refers to a program as a sketch. In other words, it is a bit of code that is uploaded to and executed on an Arduino board. It is possible to reduce the size of the sketch by removing unnecessary libraries from the code and making it simple and short.
Arduino将程序称为草图。换句话说,它是上传到Arduino板并执行的代码片段。可以通过从代码中移除不必要的库并使其简单简短来减小草图的大小。
186. What is GPIO (General Purpose Input/Output)?
什么是GPIO(通用输入/输出)?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37b6d58d557c902bb0485 | 官方: 否 | 付费: 否
答案:
GPIO (General-purpose input/output) is a standard interface using which Raspberry Pi and other microcontrollers can connect to external electronic components/devices. These are basically programmable pins on an integrated circuit or board that allow digital input or output signals to be controlled programmatically.
GPIO(通用输入/输出)是一种标准接口,Raspberry Pi和其他微控制器通过它可以连接到外部电子组件/设备。这些基本上是集成电路或板上的可编程引脚,允许以编程方式控制数字输入或输出信号。
187. State different between Arduino and Raspberry Pi.
说明Arduino和Raspberry Pi之间的区别。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0488 | 官方: 否 | 付费: 否
答案:
We can use many different kinds of controller boards for our hardware projects. Arduino and Raspberry Pi are among the most popular.
我们可以为硬件项目使用多种不同的控制器板。Arduino和Raspberry Pi是最受欢迎的两种。
Difference between Arduino and Raspberry Pi-
Arduino和Raspberry Pi的区别-
| Arduino | Raspberry Pi |
|---|---|
| Arduino is an open-source, programmable USB microcontroller. Arduino是一个开源、可编程的USB微控制器。 | It is a microprocessor-based minicomputer (SBC). 它是一个基于微处理器的迷你计算机(SBC)。 |
| Arduino boards have a microcontroller that includes a CPU, RAM, and ROM. The Arduino Board has additional hardware for power supply, programming, and IO (Input/Output) connectivity. Arduino板有一个包含CPU、RAM和ROM的微控制器。Arduino板还有额外的硬件用于供电、编程和IO(输入/输出)连接。 | The Raspberry Pi SBC (Single board computer) comes with everything you need to run a computer, from a processor, memory, storage, graphics driver, to connectors. Raspberry Pi SBC(单板计算机)配备了运行计算机所需的一切,从处理器、内存、存储、图形驱动到连接器。 |
| With Arduino, you can interface sensors and control LEDs and motors. 使用Arduino,可以连接传感器并控制LED和电机。 | It works well for developing Python-based applications. 它非常适合开发基于Python的应用。 |
| It has a simple hardware and software architecture. 它拥有简单的硬件和软件架构。 | On the other hand, Raspberry Pi boards have a complex architecture. 另一方面,Raspberry Pi板具有复杂的架构。 |
| It is possible to build your own Arduino board using the open-source hardware and software files of Arduino. 可以使用Arduino的开源硬件和软件文件构建自己的Arduino板。 | Since the Raspberry Pi is not open-source, it cannot be used for this purpose. 由于Raspberry Pi不是开源的,不能用于此目的。 |
| It is used to run one single task at a time. 它用于一次运行单个任务。 | It can perform several tasks at once such as running software, web browsing, doing programming, etc.. 它可以同时执行多个任务,如运行软件、网页浏览、编程等。 |
188. State difference between IoT and WSN (Wireless Sensor Network)?
说明物联网与WSN(无线传感器网络)之间的区别?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb048b | 官方: 否 | 付费: 否
答案:
WSN (Wireless sensor network): It uses a network of dedicated sensors to monitor and record the physical conditions of the environment and to organize the recorded data at one central location. WSN: Sensor nodes connected without a wire to gather data.
WSN(无线传感器网络):它使用专用传感器网络来监控和记录环境的物理状况,并将记录的数据集中在一个中心位置进行整理。WSN:传感器节点无需电线连接即可收集数据。
IoT (Internet of Things) : It is referred to as a network comprised of interconnected physical objects that are capable of collecting and exchanging data. These devices contain embedded systems (software, electronics, networks, and sensors) that are able to collect data about the surrounding environment, transmit data over a network, respond to remote commands, or take actions based on data collected. IoT: WSN + Any physical object (Thing) + IP address + Internet + App + Cloud computing + etc.…
IoT(物联网):它指的是由能够收集和交换数据的互联物理对象组成的网络。这些设备包含嵌入式系统(软件、电子设备、网络和传感器),能够收集周围环境的数据,通过网络传输数据,响应远程命令,或根据收集的数据采取行动。IoT:WSN + 任何物理对象(物)+ IP地址 + 互联网 + 应用程序 + 云计算 + 等等……
189. Explain IoT GE-PREDIX.
解释IoT GE-PREDIX。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb048e | 官方: 否 | 付费: 否
答案:
GE (General Electric) Predix is a software platform for collecting industrial instrument data. This platform enables industrial-grade analytics for operations optimization and performance management via a cloud-based PaaS (platform as a service).
GE(通用电气)Predix是一个用于收集工业仪器数据的软件平台。该平台通过基于云的PaaS(平台即服务)实现工业级分析,用于运营优化和性能管理。
190. Name some of the wearable Arduino Boards.
列举一些可穿戴的Arduino板。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb0491 | 官方: 否 | 付费: 否
答案:
The following wearable Arduino boards are available: - Lilypad Arduino main board
以下可穿戴Arduino板可用:- Lilypad Arduino主板
- Lilypad Arduino simple
- Lilypad Arduino simple snap
- Lilypad Arduino USB
191. Explain IoT asset tracking.
解释IoT资产跟踪。
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb049b | 官方: 否 | 付费: 否
答案:
"Asset tracking" entails tracking a particular asset and its location, whether it's a hammer, an X-ray machine, a vehicle, a shipping crate, or even a person. How does the IoT fit in here? Rather than manually tracking assets like a supervisor filling out a form when the asset arrives at a specific location, IoT tracking systems use sensors and asset management software to track things automatically. The assets are fitted with sensors, which broadcast their location over the internet on a continuous or periodic basis, and the software displays this information for you to see. Different types of IoT asset tracking systems transmit location information differently, such as via GPS, Wi-Fi, or cellular networks.
“资产跟踪”涉及跟踪特定资产及其位置,无论是锤子、X光机、车辆、运输箱,甚至是一个人。物联网如何应用于此?与其像主管在资产到达特定位置时填写表格那样手动跟踪资产,IoT跟踪系统使用传感器和资产管理软件自动跟踪物品。资产配备传感器,通过互联网连续或定期广播其位置,软件显示这些信息供您查看。不同类型的IoT资产跟踪系统通过不同方式传输位置信息,例如通过GPS、Wi-Fi或蜂窝网络。
192. What do you mean by “Thingful”?
你所说的“Thingful”是什么意思?
- 知识点: 操作系统与网络 (主题: iot;标签: interviewbit, iot, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6e58d557c902bb049e | 官方: 否 | 付费: 否
答案:
Thingful is a search engine for the internet of things (IoT). Using millions of publicly available IoT data resources, it provides a geographical index of real-time data from connected devices around the globe. With Thingful, IoT managers can detect patterns, identify anomalies, and analyze trends to solve problems.
Thingful是物联网(IoT)的搜索引擎。利用数百万公开可用的IoT数据资源,它提供全球连接设备实时数据的地理索引。通过Thingful,IoT管理人员可以检测模式、识别异常,并分析趋势以解决问题。
Conclusion
结论
A wide range of organizations can benefit from the internet of things. A key objective of the Internet of Things is to extend internet access from smartphones, laptops, and tablet devices to relatively basic devices such as toasters. As the Internet of Things has grown, there have been more opportunities in the fields of Mobile development, Cars, and household products that utilize and connect the Internet. With IoT technology pervading every aspect of our lives, an increased need for professionals trained to handle IoT devices has developed.
广泛的组织可以从物联网中受益。物联网的一个关键目标是将军用智能手机、笔记本电脑和平板设备之外的互联网接入扩展到相对基本的设备,如烤面包机。随着物联网的发展,在移动开发、汽车和利用并连接互联网的家用产品领域出现了更多机会。随着IoT技术渗透到我们生活的每个方面,对经过培训的专业人员来处理IoT设备的需求也在增加。
Hence, if you're considering an IoT interview, you've found the right place. In this article, we have compiled a list of the most frequently asked IoT interview questions with answers curated for both freshers and experienced professionals. Hopefully, these IoT interview questions will help you succeed in your next interview. Wishing you continued success.
因此,如果您正在考虑IoT面试,您来对地方了。在本文中,我们整理了一份最常被问到的IoT面试问题列表,并附有答案,适用于新手和经验丰富的专业人士。希望这些IoT面试问题能帮助您在下次面试中取得成功。祝您持续成功。
Useful Resources:
有用资源:
Azure Interview
Azure面试
AWS Interview
AWS面试
Networking Interview
网络面试
Difference Between IoT and M2M
IoT和M2M之间的区别
IoT Applications
IoT应用
Top Features of IoT
物联网的主要特性
IoT Projects
物联网项目
Highest Paying Jobs In India
印度薪酬最高的职位
193. What do you understand about kernel in the context of Operating Systems?
在操作系统背景下,你对内核有何理解?
- 知识点: 操作系统与网络 (标签: interviewbit, lti, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: LTIMindtree
- id: 69b37b8b58d557c902bb1cea | 官方: 否 | 付费: 否
答案:
The kernel is a component of an operating system that manages computer and hardware functions. It primarily oversees memory and CPU functions. It's a crucial part of any operating system. Kernel serves as a link between applications and hardware-based data processing via inter-process communication and system calls.
内核是操作系统的一个组件,管理计算机和硬件功能。它主要监管内存和CPU功能。它是任何操作系统的重要组成部分。内核通过进程间通信和系统调用充当应用程序与基于硬件的数据处理之间的链接。
When an operating system is loaded, the kernel is loaded initially and remains in memory until the operating system is shut down. It's in charge of things like disk management, task management, and memory management. It determines which processes should be assigned to the CPU and which should be kept in the main memory for execution. It serves as a link between user software and hardware. The kernel's primary goal is to manage communication between software, such as user-level applications, and hardware, such as the CPU and disc memory.
当操作系统加载时,内核首先被加载并保持在内存中,直到操作系统关闭。它负责磁盘管理、任务管理和内存管理等事务。它确定哪些进程应分配给CPU,哪些应保留在主内存中执行。它充当用户软件与硬件之间的链接。内核的主要目标是管理软件(如用户级应用程序)与硬件(如CPU和磁盘内存)之间的通信。
The following are the different types of the kernel in Operating Systems: - Monolithic Kernel - A monolithic kernel is one in which all operating system services run in kernel space. There are interdependencies between the components of the system. It has a large number of lines of code that is difficult to understand.
以下是操作系统中内核的不同类型:- 单体内核 - 单体内核是指所有操作系统服务在内核空间中运行。系统组件之间存在相互依赖关系。它有大量难以理解的代码行。
- MicroKernel - This is a sort of kernel that takes a minimalist approach. It has thread scheduling and virtual memory. With fewer services in kernel space, it is more stable.
- Hybrid Kernel - This is a hybrid kernel that combines both monolithic and microkernel functionality. It combines the monolithic kernel's performance and design with the modularity and stability of a microkernel.
- Exo Kernel - Exo Kernel is a form of the kernel that adheres to the end-to-end philosophy. It uses the fewest possible hardware abstractions. It assigns physical resources to different applications.
Nano Kernel - This is a kernel that provides hardware abstraction but does not provide system services. Because the MicroKernel lacks system services, the Microkernel and Nano Kernel have become interchangeable.
Useful Interview Resources - Java Interview Questions (Core & Advanced)有用的面试资源 - Java面试问题(核心与高级)
- Coding Interview Questions for Practice
- Technical Interview Questions for Practice
- Interview Preparation
194. What do you understand about deadlocks in the context of Operating Systems? What are the necessary conditions for deadlock to occur in a system?
在操作系统上下文中,你对死锁有何理解?系统中发生死锁的必要条件是什么?
- 知识点: 操作系统与网络 (标签: interviewbit, lti, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: LTIMindtree
- id: 69b37b8b58d557c902bb1cf1 | 官方: 否 | 付费: 否
答案:
When a process enters a waiting state because another waiting process is holding the requested resource, it is referred to as a deadlock. A typical difficulty in multi-processing is a deadlock, which occurs when numerous processes share a mutually exclusive resource known as a soft lock or software.
当一个进程因为另一个等待中的进程持有其请求的资源而进入等待状态时,这被称为死锁。多处理中的一个典型难题是死锁,它发生在众多进程共享一个称为软锁或软件的互斥资源时。
The following are the necessary conditions for a deadlock to occur in a system: - No preemption - A resource can only be released freely by the process that is holding it once it has completed its task.
以下是系统中发生死锁的必要条件:- 无抢占 - 资源只能由持有它的进程在完成任务后自由释放。
- Mutual Exclusion - The resource should not be shareable. If the resource is being used by a process, it cannot be used by another process until the current process releases it.
- Hold and wait - Suppose that a process holds onto some of the resources required for its execution. However, some of the resources that it requires are being held by other resources. Deadlock can happen only when this process does not give away its acquired resources and keeps on waiting for the other resources.
- Circular Wait - Two or more processes waiting for each other to complete their task and release the resources should form a cyclic dependency graph. It is only then that no process would be able to complete its execution and a deadlock would be obtained.
195. Explain HTTP and HTTPS protocol in the context of computer networks.
在计算机网络上下文中解释 HTTP 和 HTTPS 协议。
- 知识点: 操作系统与网络 (标签: interviewbit, mindtree, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Mindtree
- id: 69b37bd258d557c902bb4bd7 | 官方: 否 | 付费: 否
答案:
- HTTP: HTTP stands for Hypertext Transfer Protocol. HTTP is a set of rules and standards that regulate how information can be sent across the Internet. HTTP establishes communication standards for web browsers and servers. HTTP is a network protocol that runs on top of TCP at the application layer. HTTP employs hypertext structured text to create a logical link between text-containing nodes. It's also known as the "stateless protocol" since each command is conducted separately, without using the last run command as a reference.
- HTTPS: HTTPS is the acronym for HyperText Transfer Protocol Secure. It is a highly advanced and secure HTTP version. For data communication, it uses port 443. Encrypting all communication using SSL, it provides for secure transactions. It's a hybrid of the SSL/TLS and HTTP protocols. It allows a network server to be identified in an encrypted and safe manner. HTTPS also enables the server and browser to establish a secure encrypted connection. It provides data security in both directions. This assists you in preventing the theft of potentially sensitive information.
196. What is the start() and run() method of Thread class?
Thread类的start()和run()方法是什么?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4e8b | 官方: 否 | 付费: 否
答案:
start() : In simple words, the start() method is used to start or begin the execution of a newly created thread. When the start() method is called, a new thread is created and this newly created thread executes the task that is kept in the run() method. One can call the start() method only once. run() : In simple words, the run() method is used to start or begin the execution of the same thread. When the run() method is called, no new thread is created as in the case of the start() method. This method is executed by the current thread. One can call the run() method multiple times.
start():简单来说,start()方法用于启动或开始执行一个新创建的线程。当调用start()方法时,会创建一个新线程,而这个新创建的线程会执行run()方法中的任务。start()方法只能调用一次。run():简单来说,run()方法用于启动或开始执行同一线程。当调用run()方法时,不会像start()方法那样创建新线程。此方法由当前线程执行。run()方法可以多次调用。
197. What is Thread in Java?
Java中的Thread是什么?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4e8e | 官方: 否 | 付费: 否
答案:
Threads are basically the lightweight and smallest unit of processing that can be managed independently by a scheduler. Threads are referred to as parts of a process that simply let a program execute efficiently with other parts or threads of the process at the same time. Using threads, one can perform complicated tasks in the easiest way. It is considered the simplest way to take advantage of multiple CPUs available in a machine. They share the common address space and are independent of each other.
线程本质上是轻量级的、最小的处理单元,可以由调度器独立管理。线程被称为进程的一部分,它让程序能够与进程的其他部分或线程同时高效执行。使用线程,人们可以以最简单的方式完成复杂的任务。它被认为是利用机器中多个CPU的最简单方法。它们共享公共的地址空间,并且彼此独立。
198. What are the two ways of implementing thread in Java?
在Java中实现线程的两种方式是什么?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37bd758d557c902bb4e91 | 官方: 否 | 付费: 否
答案:
There are basically two ways of implementing thread in java as given below: - Extending the Thread class
在Java中基本上有两种实现线程的方式,如下所示:- 继承Thread类
Example:
示例:
class MultithreadingDemo extends Thread
class MultithreadingDemo extends Thread
{
public void run()
public void run()
{
System.out.println("My thread is in running state.");
System.out.println("我的线程正在运行状态中。");
}
public static void main(String args[])
public static void main(String args[])
{
MultithreadingDemo obj=new MultithreadingDemo();
MultithreadingDemo obj=new MultithreadingDemo();
obj.start();
obj.start();
}
}
Output:
输出:
My thread is in running state.
我的线程正在运行状态中。
- Implementing Runnable interface in Java
Example :
示例:
class MultithreadingDemo implements Runnable
class MultithreadingDemo implements Runnable
{
public void run()
public void run()
{
System.out.println("My thread is in running state.");
System.out.println("我的线程正在运行状态中。");
}
public static void main(String args[])
public static void main(String args[])
{
MultithreadingDemo obj=new MultithreadingDemo();
MultithreadingDemo obj=new MultithreadingDemo();
Threadtobj =new Thread(obj); tobj.start();
Threadtobj =new Thread(obj); tobj.start();
}
}
Output:
输出:
My thread is in running state.
我的线程正在运行状态中。
199. What's the difference between thread and process?
线程和进程之间有什么区别?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4e94 | 官方: 否 | 付费: 否
答案:
Thread : It simply refers to the smallest units of the particular process. It has the ability to execute different parts (referred to as thread) of the program at the same time. Process : It simply refers to a program that is in execution i.e., an active program. A process can be handled using PCB (Process Control Block).
线程:它仅指特定进程的最小单元。它能够同时执行程序的不同部分(称为线程)。进程:它仅指正在执行中的程序,即活动的程序。进程可以通过PCB(进程控制块)来处理。
| Thread 线程 | Process 进程 |
|---|---|
| It is a subset of a subunit of a process. 它是进程的子单元的一部分。 | It is a program in execution containing multiple threads. 它是执行中的程序,包含多个线程。 |
| In this, inter-thread communication is faster, less expensive, easy and efficient because threads share the same memory address of the process they belong to. 在此中,线程间通信更快、更便宜、简单且高效,因为线程共享它们所属进程的同一内存地址。 | In this, inter-process communication is slower, expensive, and complex because each process has different memory space or address., 在此中,进程间通信较慢、昂贵且复杂,因为每个进程有不同的内存空间或地址。 |
| These are easier to create, lightweight, and have less overhead. 这些更易创建、轻量且开销更少。 | These are difficult to create, heavyweight, and have more overhead. 这些难以创建、重量级且开销更多。 |
| It requires less time for creation, termination, and context switching. 它在创建、终止和上下文切换上所需时间较少。 | It requires more time for creation, termination, and context switching. 它在创建、终止和上下文切换上所需时间较多。 |
| Processes with multiple threads use fewer resources. 具有多线程的进程使用更少的资源。 | Processes without threads use more resources. 没有线程的进程使用更多的资源。 |
| Threads are parts of a process, so they are dependent on each other but each thread executes independently. 线程是进程的一部分,因此它们相互依赖,但每个线程独立执行。 | Processes are independent of each other. 进程是相互独立的。 |
| There is a need for synchronization in threads to avoid unexpected scenarios or problems. 线程中需要同步以避免意外情况或问题。 | There is no need for synchronization in each process. 每个进程中不需要同步。 |
| They share data and information with each other. 它们彼此共享数据和信息。 | They do not share data with each other. 它们彼此不共享数据。 |
200. What’s the difference between class lock and object lock?
类锁和对象锁之间有什么区别?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4e97 | 官方: 否 | 付费: 否
答案:
Class Lock : In java, each and every class has a unique lock usually referred to as a class level lock. These locks are achieved using the keyword ‘static synchronized’ and can be used to make static data thread-safe. It is generally used when one wants to prevent multiple threads from entering a synchronized block. Example:
类锁:在Java中,每个类都有一个唯一的锁,通常称为类级锁。这些锁通过关键字'static synchronized'实现,可用于使静态数据线程安全。它通常用于防止多个线程进入同步块时。示例:
public class ClassLevelLockExample
public class ClassLevelLockExample
{
public void classLevelLockMethod()
public void classLevelLockMethod()
{
synchronized (ClassLevelLockExample.class)
synchronized (ClassLevelLockExample.class)
{
//DO your stuff here
//在这里做你的事情
}
}
}
Object Lock : In java, each and every object has a unique lock usually referred to as an object-level lock. These locks are achieved using the keyword ‘synchronized’ and can be used to protect non-static data. It is generally used when one wants to synchronize a non-static method or block so that only the thread will be able to execute the code block on a given instance of the class. Example :
对象锁:在Java中,每个对象都有一个唯一的锁,通常称为对象级锁。这些锁通过关键字'synchronized'实现,可用于保护非静态数据。它通常用于同步非静态方法或块,以便只有线程能在类的给定实例上执行代码块。示例:
public class ObjectLevelLockExample
public class ObjectLevelLockExample
{
public void objectLevelLockMethod()
public void objectLevelLockMethod()
{
synchronized (this)
synchronized (this)
{
//DO your stuff here
//在这里做你的事情
}
}
}
- Data Science
- All Events
- My Events
201. What's the difference between User thread and Daemon thread?
用户线程和守护线程有什么区别?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4e9a | 官方: 否 | 付费: 否
答案:
User and Daemon are basically two types of thread used in Java by using a ‘Thread Class’. User Thread (Non-Daemon Thread) : In Java, user threads have a specific life cycle and its life is independent of any other thread. JVM (Java Virtual Machine) waits for any of the user threads to complete its tasks before terminating it. When user threads are finished, JVM terminates the whole program along with associated daemon threads. Daemon Thread : In Java, daemon threads are basically referred to as a service provider that provides services and support to user threads. There are basically two methods available in thread class for daemon thread: setDaemon() and isDaemon(). User Thread vs Daemon Thread
用户和守护基本上是Java中通过“线程类”使用的两种线程类型。用户线程(非守护线程):在Java中,用户线程具有特定的生命周期,其生命周期独立于任何其他线程。JVM(Java虚拟机)在任何用户线程完成任务之前都会等待其完成,然后才终止。当用户线程完成后,JVM终止整个程序以及相关的守护线程。守护线程:在Java中,守护线程基本上被称为服务提供者,它为用户线程提供服务和支持。线程类中基本上有两个方法用于守护线程:setDaemon()和isDaemon()。用户线程与守护线程
| User Thread 用户线程 | Daemon Thread 守护线程 |
|---|---|
| JVM waits for user threads to finish their tasks before termination. JVM在终止前等待用户线程完成其任务。 | JVM does not wait for daemon threads to finish their tasks before termination. JVM在终止前不等待守护线程完成其任务。 |
| These threads are normally created by the user for executing tasks concurrently. 这些线程通常由用户创建,用于并发执行任务。 | These threads are normally created by JVM. 这些线程通常由JVM创建。 |
| They are used for critical tasks or core work of an application. 它们用于应用程序的关键任务或核心工作。 | They are not used for any critical tasks but to do some supporting tasks. 它们不用于任何关键任务,而是执行一些支持性任务。 |
| These threads are referred to as high-priority tasks, therefore are required for running in the foreground. 这些线程被视为高优先级任务,因此需要在前台运行。 | These threads are referred to as low priority threads, therefore are especially required for supporting background tasks like garbage collection, releasing memory of unused objects, etc. 这些线程被视为低优先级线程,因此特别需要支持后台任务,如垃圾回收、释放未使用对象的内存等。 |
202. How can we create daemon threads?
我们如何创建守护线程?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4e9d | 官方: 否 | 付费: 否
答案:
We can create daemon threads in java using the thread class setDaemon(true) . It is used to mark the current thread as daemon thread or user thread. isDaemon() method is generally used to check whether the current thread is daemon or not. If the thread is a daemon, it will return true otherwise it returns false. Example : Program to illustrate the use of setDaemon() and isDaemon() method.
我们可以使用线程类的setDaemon(true)方法在Java中创建守护线程。它用于将当前线程标记为守护线程或用户线程。isDaemon()方法通常用于检查当前线程是否为守护线程。如果线程是守护线程,它返回true,否则返回false。示例:展示setDaemon()和isDaemon()方法使用的程序。
public class DaemonThread extends Thread
public class DaemonThread extends Thread
{
public DaemonThread(String name){
public DaemonThread(String name){
super(name);
super(name);
}
public void run()
public void run()
{
// Checking whether the thread is Daemon or not
//检查线程是否为守护线程
if(Thread.currentThread().isDaemon())
if(Thread.currentThread().isDaemon())
{
System.out.println(getName() + " is Daemon thread");
System.out.println(getName() + " 是守护线程");
}
else
else
{
System.out.println(getName() + " is User thread");
System.out.println(getName() + " 是用户线程");
}
}
public static void main(String[] args)
public static void main(String[] args)
{
DaemonThread t1 = new DaemonThread("t1");
DaemonThread t1 = new DaemonThread("t1");
DaemonThread t2 = new DaemonThread("t2");
DaemonThread t2 = new DaemonThread("t2");
DaemonThread t3 = new DaemonThread("t3");
DaemonThread t3 = new DaemonThread("t3");
// Setting user thread t1 to Daemon
// 将用户线程 t1 设置为守护线程
t1.setDaemon(true);
t1.setDaemon(true);
// starting first 2 threads
// 启动前两个线程
t1.start();
t1.start();
t2.start();
t2.start();
// Setting user thread t3 to Daemon
// 将用户线程 t3 设置为守护线程
t3.setDaemon(true);
t3.setDaemon(true);
t3.start();
t3.start();
}
}
Output :
输出:
t1 is Daemon thread
t1 是守护线程
t3 is Daemon thread
t3 是守护线程
t2 is User thread
t2 是用户线程
But one can only call the setDaemon() method before start() method otherwise it will definitely throw IllegalThreadStateException as shown below:
但只能在 start() 方法之前调用 setDaemon() 方法,否则它肯定会抛出 IllegalThreadStateException,如下所示:
public class DaemonThread extends Thread
public class DaemonThread extends Thread
{
public void run()
public void run()
{
System.out.println("Thread name: " + Thread.currentThread().getName());
System.out.println("线程名称:" + Thread.currentThread().getName());
System.out.println("Check if its DaemonThread: "
System.out.println("检查其是否为守护线程:"
Thread.currentThread().isDaemon());
- Thread.currentThread().isDaemon());
}
public static void main(String[] args)
public static void main(String[] args)
{
DaemonThread t1 = new DaemonThread();
守护线程 t1 = new DaemonThread();
DaemonThread t2 = new DaemonThread();
守护线程 t2 = new DaemonThread();
t1.start();
t1.start();
// Exception as the thread is already started
// 异常:因为线程已经启动
t1.setDaemon(true);
t1.setDaemon(true);
t2.start();
t2.start();
}
}
Output :
输出:
- Thread.currentThread().isDaemon());
Thread name: Thread-0
线程名称:线程-0
Check if its DaemonThread: false
检查其是否为守护线程:false
203. What are the wait() and sleep() methods?
什么是 wait() 和 sleep() 方法?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4ea0 | 官方: 否 | 付费: 否
答案:
wait() : As the name suggests, it is a non-static method that causes the current thread to wait and go to sleep until some other threads call the notify () or notifyAll() method for the object’s monitor (lock). It simply releases the lock and is mostly used for inter-thread communication. It is defined in the object class, and should only be called from a synchronized context.
wait():顾名思义,它是一个非静态方法,导致当前线程等待并进入休眠状态,直到其他线程调用对象监视器(锁)的 notify() 或 notifyAll() 方法。它简单地释放锁,主要用于线程间通信。它定义在对象类中,且只能从同步上下文中调用。
Example :
示例:
synchronized(monitor)
synchronized(monitor)
{
monitor.wait(); Here Lock Is Released by Current Thread
monitor.wait(); 此处锁被当前线程释放
}
sleep() : As the name suggests, it is a static method that pauses or stops the execution of the current thread for some specified period. It doesn’t release the lock while waiting and is mostly used to introduce pause on execution. It is defined in thread class, and no need to call from a synchronized context.
sleep():顾名思义,它是一个静态方法,用于暂停或停止当前线程执行一段指定时间。它在等待时不会释放锁,并且主要用于在执行过程中引入暂停。它定义在线程类中,无需从同步上下文中调用。
Example :
示例:
synchronized(monitor)
synchronized(monitor)
{
Thread.sleep(1000); Here Lock Is Held by The Current Thread
Thread.sleep(1000); 此处锁由当前线程持有
//after 1000 milliseconds, the current thread will wake up, or after we call that is interrupt() method
//1000毫秒后,当前线程将唤醒,或在我们调用interrupt()方法之后
}
204. What’s the difference between notify() and notifyAll()?
notify()和notifyAll()之间有什么区别?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4ea3 | 官方: 否 | 付费: 否
答案:
notify() : It sends a notification and wakes up only a single thread instead of multiple threads that are waiting on the object’s monitor.
notify():它发送通知并仅唤醒一个线程,而不是唤醒等待对象监视器的多个线程。
notifyAll() : It sends notifications and wakes up all threads and allows them to compete for the object's monitor instead of a single thread.
notifyAll():它发送通知并唤醒所有线程,允许它们竞争对象的监视器,而不是仅唤醒一个线程。
205. Why wait(), notify(), and notifyAll() methods are present in Object class?
为什么wait()、notify()和notifyAll()方法存在于Object类中?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4ea6 | 官方: 否 | 付费: 否
答案:
We know that every object has a monitor that allows the thread to hold a lock on the object. But the thread class doesn't contain any monitors. Thread usually waits for the object’s monitor (lock) by calling the wait() method on an object, and notify other threads that are waiting for the same lock using notify() or notifyAll() method. Therefore, these three methods are called on objects only and allow all threads to communicate with each that are created on that object.
我们知道每个对象都有一个监视器,允许线程持有对象的锁。但线程类不包含任何监视器。线程通常通过调用对象的wait()方法来等待对象的监视器(锁),并使用notify()或notifyAll()方法通知其他等待同一锁的线程。因此,这三个方法仅在对象上调用,并允许在该对象上创建的所有线程相互通信。
206. What is Runnable and Callable Interface? Write the difference between them.
什么是Runnable和Callable接口?写出它们之间的区别。
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4ea9 | 官方: 否 | 付费: 否
答案:
Both the interfaces are generally used to encapsulate tasks that are needed to be executed by another thread. But there are some differences between them as given below: Running Interface : This interface is basically available in Java right from the beginning. It is simply used to execute code on a concurrent thread. Callable Interface : This interface is basically a new one that was introduced as a part of the concurrency package. It addresses the limitation of runnable interfaces along with some major changes like generics, enum, static imports, variable argument method, etc. It uses generics to define the return type of object.
这两个接口通常用于封装需要由另一个线程执行的任务。但它们之间存在一些区别,如下所示:Runnable接口:这个接口基本上从Java一开始就可用。它简单用于在并发线程上执行代码。Callable接口:这个接口基本上是作为并发包的一部分引入的新接口。它解决了runnable接口的局限性,并包含一些重大更改,如泛型、枚举、静态导入、可变参数方法等。它使用泛型来定义对象的返回类型。
public interface Runnable
public interface Runnable
{
public abstract void run();
public abstract void run();
}
public interface Callable
public interface Callable
{
V call() throws Exception;
V call() 抛出异常;
}
Runnable Interface vs Callable Interface
Runnable 接口与 Callable 接口
| Runnable Interface Runnable 接口 | Callable Interface Callable 接口 |
|---|---|
| It does not return any result and therefore, cannot throw a checked exception. 它不返回任何结果,因此不能抛出受检异常。 | It returns a result and therefore, can throw an exception. 它返回一个结果,因此可以抛出异常。 |
| It cannot be passed to invokeAll method. 它不能传递给 invokeAll 方法。 | It can be passed to invokeAll method. 它可以传递给 invokeAll 方法。 |
| It was introduced in JDK 1.0. 它在 JDK 1.0 中引入。 | It was introduced in JDK 5.0, so one cannot use it before Java 5. 它在 JDK 5.0 中引入,因此在 Java 5 之前无法使用。 |
| It simply belongs to Java.lang. 它属于 java.lang 包。 | It simply belongs to java.util.concurrent. 它属于 java.util.concurrent 包。 |
| It uses the run() method to define a task. 它使用 run() 方法来定义任务。 | It uses the call() method to define a task. 它使用 call() 方法来定义任务。 |
| To use this interface, one needs to override the run() method. 要使用此接口,需要重写 run() 方法。 | To use this interface, one needs to override the call() method. 要使用此接口,需要重写 call() 方法。 |
207. What are the benefits of using Multithreading?
使用多线程有哪些好处?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4eba | 官方: 否 | 付费: 否
答案:
There are various benefits of multithreading as given below: - Allow the program to run continuously even if a part of it is blocked.
多线程有许多好处,如下所示: - 即使程序的一部分被阻塞,也能允许程序持续运行。
- Improve performance as compared to traditional parallel programs that use multiple processes.
- Allows to write effective programs that utilize maximum CPU time
- Improves the responsiveness of complex applications or programs.
- Increase use of CPU resources and reduce costs of maintenance.
- Saves time and parallelism tasks.
- If an exception occurs in a single thread, it will not affect other threads as threads are independent.
- Less resource-intensive than executing multiple processes at the same time.
Successful Tech Career for FREE!
免费开启成功的科技职业生涯!
Successful Tech Career!
成功的技术职业生涯!
Interview Process
面试流程
CTC & Designation
CTC与职位级别
Projects on the Job
工作项目
Referral System
推荐系统
Try It Out
试试看
2 Lakh+ Roadmaps Created
已生成20万+职业规划
208. Explain thread pool?
解释什么是线程池?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4ec1 | 官方: 否 | 付费: 否
答案:
A Thread pool is simply a collection of pre-initialized or worker threads at the start-up that can be used to execute tasks and put back in the pool when completed. It is referred to as pool threads in which a group of fixed-size threads is created. By reducing the number of application threads and managing their lifecycle, one can mitigate the issue of performance using a thread pool. Using threads, performance can be enhanced and better system stability can occur. To create the thread pools, java.util.concurrent.Executors class usually provides factory methods.
线程池简单来说就是在启动时预先初始化的一组或工作线程的集合,可用于执行任务并在完成后放回池中。它被称为池线程,其中创建了一组固定大小的线程。通过减少应用程序线程的数量并管理其生命周期,可以使用线程池来缓解性能问题。使用线程,可以提高性能并实现更好的系统稳定性。要创建线程池,通常使用 java.util.concurrent.Executors 类提供工厂方法。
209. What’s the purpose of the join() method?
join() 方法的目的是什么?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4ec4 | 官方: 否 | 付费: 否
答案:
join() method is generally used to pause the execution of a current thread unless and until the specified thread on which join is called is dead or completed. To stop a thread from running until another thread gets ended, this method can be used. It joins the start of a thread execution to the end of another thread’s execution. It is considered the final method of a thread class.
join() 方法通常用于暂停当前线程的执行,直到调用 join 的指定线程死亡或完成。要阻止一个线程运行直到另一个线程结束,可以使用此方法。它将一个线程执行的开始连接到另一个线程执行的结束。它被认为是线程类的最终方法。
210. What do you mean by garbage collection?
你所说的垃圾收集是什么意思?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4ec7 | 官方: 否 | 付费: 否
答案:
Garbage collection is basically a process of managing memory automatically. It uses several GC algorithms among which the popular one includes Mark and Sweep. The process includes three phases i.e., marking, deletion, and compaction/copying. In simple words, a garbage collector finds objects that are no longer required by the program and then delete or remove these unused objects to free up the memory space.
垃圾收集基本上是一种自动管理内存的过程。它使用多种 GC 算法,其中流行的包括标记和清除。该过程包括三个阶段,即标记、删除和压缩/复制。简单来说,垃圾收集器会找到程序不再需要的对象,然后删除或移除这些未使用的对象,以释放内存空间。
211. Explain the meaning of the deadlock and when it can occur?
解释死锁的含义及其何时可能发生?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd758d557c902bb4eca | 官方: 否 | 付费: 否
答案:
Deadlock, as the name suggests, is a situation where multiple threads are blocked forever. It generally occurs when multiple threads hold locks on different resources and are waiting for other resources to complete their task.
死锁,顾名思义,是指多个线程被永远阻塞的情况。它通常发生在多个线程持有不同资源的锁,并等待其他资源来完成其任务时。
The above diagram shows a deadlock situation where two threads are blocked forever. Thread 1 is holding Object 1 but needs object 2 to complete processing whereas Thread 2 is holding Object 2 but needs object 1 first. In such conditions, both of them will hold lock forever and will never complete tasks.
上述图表显示了两个线程被永远阻塞的死锁情况。线程 1 持有对象 1,但需要对象 2 来完成处理,而线程 2 持有对象 2,但首先需要对象 1。在这种情况下,两者将永远持有锁,永远不会完成任务。
212. Explain volatile variables in Java?
解释 Java 中的 volatile 变量?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4ecd | 官方: 否 | 付费: 否
答案:
A volatile variable is basically a keyword that is used to ensure and address the visibility of changes to variables in multithreaded programming. This keyword cannot be used with classes and methods, instead can be used with variables. It is simply used to achieve thread-safety. If you mark any variable as volatile, then all the threads can read its value directly from the main memory rather than CPU cache, so that each thread can get an updated value of the variable.
volatile 变量基本上是一个关键字,用于确保和解决多线程编程中变量更改的可见性。此关键字不能用于类和方法,但可用于变量。它仅用于实现线程安全。如果将任何变量标记为 volatile,则所有线程可以直接从主内存读取其值,而不是从 CPU 缓存读取,这样每个线程都能获得变量的更新值。
213. How do threads communicate with each other?
线程之间如何相互通信?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4ed0 | 官方: 否 | 付费: 否
答案:
Threads can communicate using three methods i.e., wait(), notify(), and notifyAll().
线程可以通过三种方法进行通信,即 wait()、notify() 和 notifyAll()。
214. Can two threads execute two methods (static and non-static concurrently)?
两个线程可以同时执行两个方法(静态和非静态并发)吗?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4ed3 | 官方: 否 | 付费: 否
答案:
Yes, it is possible. If both the threads acquire locks on different objects, then they can execute concurrently without any problem.
是的,这是可能的。如果两个线程在不同的对象上获取锁,那么它们可以并发执行而没有任何问题。
215. What is the purpose of the finalize() method?
finalize() 方法的作用是什么?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4ed6 | 官方: 否 | 付费: 否
答案:
Finalize() method is basically a method of Object class specially used to perform cleanup operations on unmanaged resources just before garbage collection. It is not at all intended to be called a normal method. After the complete execution of finalize() method, the object gets destroyed automatically.
finalize() 方法基本上是 Object 类的一个方法,特别用于在垃圾回收之前对非托管资源执行清理操作。它完全不适合作为普通方法调用。在 finalize() 方法完全执行后,对象会自动被销毁。
216. What is a Critical Section in Operating System?
操作系统中的临界区是什么?
- 知识点: 操作系统与网络 (标签: interviewbit, nagarro, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Nagarro
- id: 69b37bf958d557c902bb616a | 官方: 否 | 付费: 否
答案:
A critical section is a section of code in an operating system where the execution cannot proceed until all threads reach the section. If any thread attempts to access the critical section before the other threads are finished, it will be blocked until all threads have reached the section. As a result, critical sections can be used to ensure that no thread can interrupt another thread's execution.
临界区是操作系统中的一段代码,在其中执行必须等到所有线程都到达该区域才能继续。如果任何线程在其他线程完成之前试图访问临界区,它将被阻塞,直到所有线程都到达该区域。因此,临界区可用于确保没有线程能中断另一个线程的执行。
217. Explain about TCP/IP Protocol?
解释 TCP/IP 协议?
- 知识点: 操作系统与网络 (标签: interviewbit, nagarro, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Nagarro
- id: 69b37bf958d557c902bb6173 | 官方: 否 | 付费: 否
答案:
TCP/IP is the networking protocol that allows computers to communicate with each other over a network. It is the foundation of modern internet communication. TCP/IP is an acronym for Transmission Control Protocol (TCP) and Internet Protocol (IP). Together they form the TCP/IP protocol suite, which is used to route information from one location to another over the internet. These two works together in order to ensure that data is sent from one computer to another without any problems. TCP/IP is the most widely used protocol today because it allows devices on a network to communicate with each other regardless of their location. It's also responsible for routing data between networks, so it's important for any device that needs to send or receive data across networks. This includes computers, smartphones, tablets, and even smart appliances like security cameras and baby monitors.
TCP/IP 是允许计算机通过网络相互通信的网络协议。它是现代互联网通信的基础。TCP/IP 是传输控制协议(TCP)和互联网协议(IP)的缩写。它们共同构成了 TCP/IP 协议套件,用于通过互联网将信息从一个位置路由到另一个位置。这两者协同工作,以确保数据从一台计算机发送到另一台计算机时没有任何问题。TCP/IP 是当今使用最广泛的协议,因为它允许网络上的设备相互通信,无论它们位于何处。它还负责在网络之间路由数据,因此对于任何需要跨网络发送或接收数据的设备都很重要。这包括计算机、智能手机、平板电脑,甚至安全摄像头和婴儿监视器等智能家电。
218. What is an IPv4 address? What are the different classes of IPv4?
什么是 IPv4 地址?IPv4 有哪些不同的类别?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb625c | 官方: 否 | 付费: 否
答案:
An IP address is a 32-bit dynamic address of a node in the network. An IPv4 address has 4 octets of 8-bit each with each number with a value up to 255.
IP 地址是网络中节点的 32 位动态地址。IPv4 地址有 4 个八位组,每个八位组为 8 位,每个数字的值最大为 255。
IPv4 classes are differentiated based on the number of hosts it supports on the network. There are five types of IPv4 classes and are based on the first octet of IP addresses which are classified as Class A, B, C, D, or E.
IPv4 类别根据其在网络上支持的主机数量进行区分。IPv4 有五种类型,基于 IP 地址的第一个八位组进行分类,分别称为 A 类、B 类、C 类、D 类或 E 类。
| IPv4 Class IPv4 类别 | IPv4 Start Address IPv4 起始地址 | IPv4 End Address IPv4 结束地址 | Usage 用途 |
|---|---|---|---|
| A | 0.0.0.0 | 127.255.255.255 | Used for Large Network 用于大型网络 |
| B | 128.0.0.0 | 191.255.255.255 | Used for Medium Size Network 用于中型网络 |
| C | 192.0.0.0 | 223.255.255.255 | Used for Local Area Network 用于局域网 |
| D | 224.0.0.0 | 239.255.255.255 | Reserved for Multicasting 保留用于组播 |
| E | 240.0.0.0 | 255.255.255.254 | Study and R&D 用于研究和开发 |
Also, check out Scaler topics' Free Computer Networks course with certification to learn the fundamentals of computer networking.
另外,请查看 Scaler 主题的免费计算机网络课程(含认证),以学习计算机网络的基础知识。
219. What are Private and Special IP addresses?
什么是私有和特殊 IP 地址?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb625f | 官方: 否 | 付费: 否
答案:
Private Address: For each class, there are specific IPs that are reserved specifically for private use only. This IP address cannot be used for devices on the Internet as they are non-routable.
私有地址:对于每个类别,都有一些特定的 IP 被专门保留仅供私有使用。这些 IP 地址不能用于互联网上的设备,因为它们是不可路由的。
| IPv4 Class IPv4 类别 | Private IPv4 Start Address 私有 IPv4 起始地址 | Private IPv4 End Address 私有 IPv4 结束地址 |
|---|---|---|
| A | 10.0.0.0 | 10.255.255.255 |
| B | 172.16.0.0 | 172.31.255.255 |
| C | 192.168.0.0 | 192.168.255.255 |
Special Address: IP Range from 127.0.0.1 to 127.255.255.255 are network testing addresses also known as loopback addresses are the special IP address.
特殊地址:IP 范围从 127.0.0.1 到 127.255.255.255 是网络测试地址,也称为回环地址,属于特殊 IP 地址。
220. Define different types of network topology
定义不同类型的网络拓扑
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6262 | 官方: 否 | 付费: 否
答案:
The different types of network topology are given below:
不同类型的网络拓扑结构如下所示:
Bus Topology:
总线拓扑:
Bus Topology - All the nodes are connected using the central link known as the bus.
总线拓扑 - 所有节点通过称为总线的中央链路连接。
- It is useful to connect a smaller number of devices.
If the main cable gets damaged, it will damage the whole network.
Star Topology:星型拓扑:
Star Topology - All the nodes are connected to one single node known as the central node.
星型拓扑 - 所有节点连接到称为中央节点的单一节点。
- It is more robust.
- If the central node fails the complete network is damaged.
- Easy to troubleshoot.
Mainly used in home and office networks.
Ring Topology:环形拓扑:
Ring Topology - Each node is connected to exactly two nodes forming a ring structure
环形拓扑 - 每个节点恰好连接到两个节点,形成环形结构。
- If one of the nodes are damaged, it will damage the whole network
It is used very rarely as it is expensive and hard to install and manage
Mesh Topology:网状拓扑:
Mesh Topology - Each node is connected to one or many nodes.
网状拓扑 - 每个节点连接到一个或多个节点。
- It is robust as failure in one link only disconnects that node.
It is rarely used and installation and management are difficult.
Tree Topology:树形拓扑:
Tree Topology - A combination of star and bus topology also know as an extended bus topology.
树形拓扑 - 星型和总线拓扑的组合,也称为扩展总线拓扑。
- All the smaller star networks are connected to a single bus.
If the main bus fails, the whole network is damaged.
Hybrid: - It is a combination of different topologies to form a new topology.混合拓扑: - 它是不同拓扑组合形成的新拓扑。
- It helps to ignore the drawback of a particular topology and helps to pick the strengths from other.
221. What is the network topology?
什么是网络拓扑?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6265 | 官方: 否 | 付费: 否
答案:
Network topology is a physical layout of the network, connecting the different nodes using the links. It depicts the connectivity between the computers, devices, cables, etc.
网络拓扑是网络的物理布局,通过链路连接不同的节点。它描述了计算机、设备、电缆等之间的连通性。
222. What are nodes and links?
什么是节点和链路?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6268 | 官方: 否 | 付费: 否
答案:
Node: Any communicating device in a network is called a Node. Node is the point of intersection in a network. It can send/receive data and information within a network. Examples of the node can be computers, laptops, printers, servers, modems, etc.
节点:网络中任何通信设备称为节点。节点是网络中的交叉点。它可以在网络内发送/接收数据和信息。节点的示例包括计算机、笔记本电脑、打印机、服务器、调制解调器等。
Link: A link or edge refers to the connectivity between two nodes in the network. It includes the type of connectivity (wired or wireless) between the nodes and protocols used for one node to be able to communicate with the other.
链接:链接或边指的是网络中两个节点之间的连接性。它包括节点之间的连接类型(有线或无线)以及一个节点与另一个节点通信所用的协议。
Nodes and Links
节点和链接
223. What are the different types of VPN?
VPN有哪些不同类型?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb626b | 官方: 否 | 付费: 否
答案:
Few types of VPN are: - Access VPN: Access VPN is used to provide connectivity to remote mobile users and telecommuters. It serves as an alternative to dial-up connections or ISDN (Integrated Services Digital Network) connections. It is a low-cost solution and provides a wide range of connectivity.
VPN的几种类型有:- 接入VPN:接入VPN用于为远程移动用户和远程办公人员提供连接性。它作为拨号连接或ISDN(综合业务数字网)连接的替代方案。这是一个低成本解决方案,并提供广泛的连接性。
- Site-to-Site VPN: A Site-to-Site or Router-to-Router VPN is commonly used in large companies having branches in different locations to connect the network of one office to another in different locations. There are 2 sub-categories as mentioned below:
- Intranet VPN: Intranet VPN is useful for connecting remote offices in different geographical locations using shared infrastructure (internet connectivity and servers) with the same accessibility policies as a private WAN (wide area network).
- Extranet VPN: Extranet VPN uses shared infrastructure over an intranet, suppliers, customers, partners, and other entities and connects them using dedicated connections.
224. What are the advantages of using a VPN?
使用VPN有哪些优势?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb626e | 官方: 否 | 付费: 否
答案:
Below are few advantages of using VPN: - VPN is used to connect offices in different geographical locations remotely and is cheaper when compared to WAN connections.
以下是使用VPN的几项优势:- VPN用于远程连接不同地理位置的办公室,与WAN连接相比更便宜。
- VPN is used for secure transactions and confidential data transfer between multiple offices located in different geographical locations.
- VPN keeps an organization’s information secured against any potential threats or intrusions by using virtualization.
- VPN encrypts the internet traffic and disguises the online identity.
225. Tell me something about VPN (Virtual Private Network)
请告诉我一些关于VPN(虚拟专用网络)的信息。
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6271 | 官方: 否 | 付费: 否
答案:
VPN or the Virtual Private Network is a private WAN (Wide Area Network) built on the internet. It allows the creation of a secured tunnel (protected network) between different networks using the internet (public network). By using the VPN, a client can connect to the organization’s network remotely. The below diagram shows an organizational WAN network over Australia created using VPN:
VPN或虚拟专用网络是构建在互联网上的私有WAN(广域网)。它允许通过互联网(公共网络)在不同网络之间创建安全隧道(受保护的网络)。通过使用VPN,客户端可以远程连接到组织的网络。下图显示了使用VPN在澳大利亚创建的组织WAN网络。
VPN (Virtual Private Network)
VPN(虚拟专用网络)
226. Explain LAN (Local Area Network)
解释LAN(局域网)
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6274 | 官方: 否 | 付费: 否
答案:
LANs are widely used to connect computers/laptops and consumer electronics which enables them to share resources (e.g., printers, fax machines) and exchange information. When LANs are used by companies or organizations, they are called enterprise networks . There are two different types of LAN networks i.e. wireless LAN (no wires involved achieved using Wi-Fi) and wired LAN (achieved using LAN cable). Wireless LANs are very popular these days for places where installing wire is difficult. The below diagrams explain both wireless and wired LAN.
LAN被广泛用于连接计算机/笔记本电脑和消费电子产品,使它们能够共享资源(例如打印机、传真机)并交换信息。当LAN被公司或组织使用时,它们被称为企业网络。有两种不同类型的LAN网络,即无线LAN(通过Wi-Fi实现,不涉及线缆)和有线LAN(通过LAN电缆实现)。无线LAN在难以安装线缆的地方如今非常流行。下图解释了无线LAN和有线LAN。
LAN (Local Area Network)
LAN(局域网)
227. Explain different types of networks.
解释不同类型的网络。
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6277 | 官方: 否 | 付费: 否
答案:
Below are few types of networks:
以下是一些网络类型:
| Type 类型 | Description 描述 |
|---|---|
| PAN (Personal Area Network) PAN(个人区域网) | Let devices connect and communicate over the range of a person. E.g. connecting Bluetooth devices. 让设备在个人范围内连接和通信。例如,连接蓝牙设备。 |
| LAN (Local Area Network) LAN(局域网) | It is a privately owned network that operates within and nearby a single building like a home, office, or factory 这是一个私有网络,运行在单个建筑(如家庭、办公室或工厂)内部及附近 |
| MAN (Metropolitan Area Network) MAN(城域网) | It connects and covers the whole city. E.g. TV Cable connection over the city 连接并覆盖整个城市。例如,城市内的电视有线连接 |
| WAN (Wide Area Network) WAN(广域网) | It spans a large geographical area, often a country or continent. The Internet is the largest WAN 它跨越一个大的地理区域,通常是国家或大陆。互联网是最大的WAN |
| GAN (Global Area Network) GAN(全球区域网) | It is also known as the Internet which connects the globe using satellites. The Internet is also called the Network of WANs. 它也被称为互联网,通过卫星连接全球。互联网也被称为WAN的网络。 |
228. How are Network types classified?
网络类型是如何分类的?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb627a | 官方: 否 | 付费: 否
答案:
Network types can be classified and divided based on the area of distribution of the network. The below diagram would help to understand the same:
网络类型可以根据网络的分布区域进行分类和划分。下图有助于理解这一点:
Network Types
网络类型
229. What are Real-Time Operating Systems (RTOS)?
什么是实时操作系统(RTOS)?
- 知识点: 操作系统与网络 (标签: interviewbit, ntt-data, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: NTT DATA
- id: 69b37bff58d557c902bb661b | 官方: 否 | 付费: 否
答案:
RTOS stands for "Real-Time Operating System". An RTOS is a type of operating system that is designed to support real-time applications, which are applications that require a guaranteed response within a specified time period.
RTOS 代表“实时操作系统”。RTOS 是一种操作系统,旨在支持实时应用程序,即需要在指定时间段内保证响应的应用程序。
RTOSs are used in a variety of applications, including industrial control systems, avionics, and automotive systems. They are typically used in situations where the accuracy and timeliness of the system's response is critical, such as in safety-critical systems or systems that control physical processes.
RTOS 用于各种应用,包括工业控制系统、航空电子设备和汽车系统。它们通常用于系统响应的准确性和及时性至关重要的场景,例如安全关键系统或控制物理过程的系统。
An RTOS typically provides the following features: - Preemptive scheduling: The ability to interrupt the execution of a task and run a higher-priority task in its place.
RTOS 通常提供以下功能:- 抢占式调度:能够中断任务的执行并在其位置运行更高优先级的任务。
- Real-time event handling: The ability to process events or interrupts in a timely manner.
- Resource management: The ability to manage and allocate system resources such as memory, I/O devices, and communication channels.
Error handling: The ability to handle and recover from errors or failures that may occur in the system.
An RTOS is a specialized type of operating system that is designed to meet the unique demands of real-time applications. It provides features such as preemptive scheduling, real-time event handling, resource management, and error handling, which are essential for ensuring the accuracy and timeliness of a system’s response. As technology continues to advance and the demand for real-time applications increases, the importance of RTOSs is likely to grow, making them a critical component in a wide range of industries and applications.RTOS 是一种专门类型的操作系统,旨在满足实时应用程序的独特需求。它提供抢占式调度、实时事件处理、资源管理和错误处理等功能,这些对于确保系统响应的准确性和及时性至关重要。随着技术的不断进步和实时应用需求的增加,RTOS 的重要性可能会增长,使其成为广泛行业和应用中的关键组成部分。
230. What port does HTTP use?
HTTP 使用什么端口?
- 知识点: 操作系统与网络 (标签: interviewbit, ntt-data, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: NTT DATA
- id: 69b37bff58d557c902bb662c | 官方: 否 | 付费: 否
答案:
HTTP (Hypertext Transfer Protocol) uses port 80 by default for communication between web servers and clients. However, HTTPS (HTTP Secure), which uses SSL/TLS encryption to secure the communication, typically uses port 443 by default.
HTTP(超文本传输协议)默认使用端口80在Web服务器和客户端之间进行通信。然而,HTTPS(安全超文本传输协议)使用SSL/TLS加密来保护通信,通常默认使用端口443。
231. List some of the most commonly used LINUX commands.
列出一些最常用的LINUX命令。
- 知识点: 操作系统与网络 (标签: interviewbit, nutanix, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Nutanix
- id: 69b37c0258d557c902bb67d2 | 官方: 否 | 付费: 否
答案:
Linux is one of the most commonly used operating systems, with a variety of applications and advances. Knowing the appropriate command to use when working on Linux saves a lot of time and effort. The most common LINUX networking commands are as follows: - Ifconfig (Interface configurator)
Linux是最常用的操作系统之一,具有各种应用和优势。在Linux上工作时知道合适的命令可以节省大量时间和精力。最常见的LINUX网络命令如下:- Ifconfig(接口配置器)
This command displays the route as well as the network interface. It can also be used to set up an interface, assign an IP address to it, and enable or disable it. Syntax: ifconfig - traceroute
此命令显示路由以及网络接口。它还可以用于设置接口、为其分配IP地址以及启用或禁用接口。语法:ifconfig - traceroute
This command is used to troubleshoot a network. It determines the path to the specified goal after detecting the delay. It labels and identifies all of the devices on the path. It takes the path that leads to the destination. It determines the source of network lag and reports it. Syntax : traceroute - tracepath.
此命令用于排查网络问题。它在检测到延迟后确定到指定目标的路径。它标记并识别路径上的所有设备。它采取通向目的地的路径。它确定网络延迟的来源并报告。语法:traceroute - tracepath。
It's a tool for detecting network delays. It follows the path to the selected destination, identifying each step along the way. It recognises the location where your network is weak if it is weak. Syntax: tracepath - Ping (Packet INternet Groper)
这是一个用于检测网络延迟的工具。它跟随到所选目的地的路径,识别沿途的每一步。如果网络薄弱,它会识别出网络薄弱的位置。语法:tracepath - Ping(数据包互联网探测器)
One of the most commonly used network troubleshooting commands on Linux is ping. It determines whether two nodes are connected via the network. To test network connectivity, the ping programme makes an ICMP echo request. It continues to run until it is interrupted. The ctrl+c key can be used to stop the execution.Syntax : ping
ping是Linux上最常用的网络故障排除命令之一。它确定两个节点是否通过网络连接。为了测试网络连接性,ping程序发出ICMP回显请求。它会持续运行直到被中断。可以使用ctrl+c键停止执行。语法:ping
We can also ping directly using the IP address. The "-c" option in the ping command can be used to limit the number of packets sent.Syntax : ping -c - netstat
我们也可以直接使用IP地址进行ping。ping命令中的"-c"选项可用于限制发送的数据包数量。语法:ping -c - netstat
The netstat command in Linux displays network statistics. It displays statistics on many interfaces, such as open sockets, routing tables, and connection information.Syntax: netstat
Linux中的netstat命令显示网络统计信息。它显示许多接口的统计信息,如打开的套接字、路由表和连接信息。语法:netstat
The netstat command is used in a few different ways, as seen below. To view the programs:Syntax: netstat -p
netstat命令有几种不同的使用方式,如下所示。要查看程序:语法:netstat -p
To find out more about the ports: Syntax: netstat -s This provides thorough information on all of the ports.
要了解更多关于端口的信息:语法:netstat -s 这提供了有关所有端口的详细信息。
To receive the routing table's details: Syntax: netstat -r This section contains information about the routing table. - ss
要获取路由表的详细信息:语法:netstat -r 此部分包含有关路由表的信息。 - ss
The ss command in Linux is a substitute for the netstat tool. It's thought to be a lot faster and more informative than netstat. Because ss gets all information from within the kernel userspace, it can respond faster. Syntax: ssAll TCP, UDP, and UNIX socket connections are listed using this command. - hostname:
Linux中的ss命令是netstat工具的替代品。它被认为比netstat更快且信息更丰富。由于ss从内核用户空间获取所有信息,因此它可以更快地响应。语法:ss 此命令列出所有TCP、UDP和UNIX套接字连接。 - hostname:
The simple command Linux hostname is used to view and change a system's hostname. Syntax: hostname - curl
简单的Linux命令hostname用于查看和更改系统的主机名。语法:hostname - curl
curl is a command-line program that allows you to transport data to or from a server using any of the protocols that are supported (HTTP, FTP, IMAP, POP3, SCP, SFTP, SMTP, TFTP, TELNET, LDAP, or FILE). Syntax: curl [options] [URL…] - nslookup
curl 是一个命令行程序,允许您使用所支持的任何协议(HTTP、FTP、IMAP、POP3、SCP、SFTP、SMTP、TFTP、TELNET、LDAP 或 FILE)向服务器传输数据或从服务器传输数据。语法:curl [options] [URL…] - nslookup
The nslookup command in Linux is also used for DNS inquiries. It can be used to receive domain names, IP addresses, and other DNS records. Syntax: nslookup - ip
Linux 中的 nslookup 命令也用于 DNS 查询。它可用于接收域名、IP 地址和其他 DNS 记录。语法:nslookup - ip
This is the most recent version of the ifconfig command. Syntax:ip a ip addr Like ifconfig, this tool displays the details of all networks. This command can also be used to retrieve information about a particular interface. - dig
这是 ifconfig 命令的最新版本。语法:ip a ip addr 与 ifconfig 类似,此工具显示所有网络的详细信息。此命令还可用于检索特定接口的信息。 - dig
Domain Information Groper is the Linux dig command. This command is used to query the DNS name server during a DNS lookup. It's also used to troubleshoot DNS-related problems. Its primary purpose is to verify DNS mappings, MX Records, host addresses, and all other DNS records in order to have a better understanding of the DNS topography. This is a modified version of the nslookup command. Syntax: dig - route
Domain Information Groper 就是 Linux 的 dig 命令。此命令用于在 DNS 查找期间查询 DNS 名称服务器。它也用于排查与 DNS 相关的问题。其主要目的是验证 DNS 映射、MX 记录、主机地址和所有其他 DNS 记录,以便更好地了解 DNS 拓扑。这是 nslookup 命令的修改版本。语法:dig - route
The Linux route command displays and manipulates your system's routing table. A router's job is to figure out the most efficient way to transport packets to their destination. Syntax: route - whois
Linux 的 route 命令显示并操作系统的路由表。路由器的工作是找出将数据包传输到目的地的最有效方式。语法:route - whois
The whois command in Linux is used to get all of the information about a website. You can find out everything you need to know about a website, including its registration and who owns it. Syntax: whois
Linux 中的 whois 命令用于获取网站的所有信息。您可以找到关于网站所需了解的一切信息,包括其注册信息和所有者。语法:whois
232. What's the main purpose of an OS? What are the different types of OS?
操作系统的主要目的是什么?操作系统有哪些不同类型?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb6973 | 官方: 否 | 付费: 否
答案:
The main purpose of an OS is to execute user programs and make it easier for users to understand and interact with computers as well as run applications. It is specially designed to ensure that the computer system performs better by managing all computational activities. It also manages computer memory, processes, and operation of all hardware and software. Types of OS: - Batched OS (Example: Payroll System, Transactions Process, etc.)
操作系统的主要目的是执行用户程序,使用户更容易理解和与计算机交互,以及运行应用程序。它专门设计用于通过管理所有计算活动来确保计算机系统性能更佳。它还管理计算机内存、进程以及所有硬件和软件的操作。操作系统类型:- 批处理操作系统(示例:工资系统、事务处理等)
- Multi-Programmed OS (Example: Windows O/S, UNIX O/S, etc.)
- Timesharing OS (Example: Multics, etc.)
- Distributed OS (LOCUS, etc.)
- Real-Time OS (PSOS, VRTX, etc.)
233. Why is the operating system important?
为什么操作系统很重要?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb6976 | 官方: 否 | 付费: 否
答案:
OS is the most essential and vital part of a computer without which it is considered useless. It enables an interface or acts like a link for interaction between computer software that is installed on OS and users. It also helps to communicate with hardware and also maintains balance among hardware and CPU. It also provides services to users and a platform for programs to run on. It performs all common tasks applications require.
操作系统是计算机中最基本且至关重要的部分,没有它,计算机就被认为毫无用处。它提供了一种接口,或充当安装在操作系统上的计算机软件与用户之间交互的链接。它还有助于与硬件通信,并维持硬件和CPU之间的平衡。它还为用户提供服务,并为程序提供运行平台。它执行应用程序所需的所有常见任务。
234. What are the benefits of a multiprocessor system?
多处理器系统有哪些好处?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb6979 | 官方: 否 | 付费: 否
答案:
A Multiprocessor system is a type of system that includes two or more CPUs. It involves the processing of different computer programs at the same time mostly by a computer system with two or more CPUs that are sharing single memory. Benefits: - Such systems are used widely nowadays to improve performance in systems that are running multiple programs concurrently.
多处理器系统是一种包含两个或更多CPU的系统。它涉及同时处理不同的计算机程序,通常由共享单个内存的两个或更多CPU的计算机系统来完成。好处:- 如今,这类系统被广泛用于提高同时运行多个程序的系统的性能。
- By increasing the number of processors, a greater number of tasks can be completed in unit time.
- One also gets a considerable increase in throughput and is cost-effective also as all processors share the same resources.
- It simply improves the reliability of the computer system.
235. What is RAID structure in OS? What are the different levels of RAID configuration?
操作系统中的RAID结构是什么?RAID配置有哪些不同级别?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb697c | 官方: 否 | 付费: 否
答案:
RAID (Redundant Arrays of Independent Disks) is a method used to store data on Multiple hard disks therefore it is considered as data storage virtualization technology that combines multiple hard disks. It simply balances data protection, system performance, storage space, etc. It is used to improve the overall performance and reliability of data storage. It also increases the storage capacity of the system and its main purpose is to achieve data redundancy to reduce data loss. Different levels of RAID Nowadays, RAID is available in various schemes or RAID level as given below:
RAID(独立磁盘冗余阵列)是一种用于在多个硬盘上存储数据的方法,因此它被视为一种结合多个硬盘的数据存储虚拟化技术。它简单地平衡了数据保护、系统性能、存储空间等。它用于提高数据存储的整体性能和可靠性。它还增加了系统的存储容量,其主要目的是实现数据冗余以减少数据丢失。不同级别的RAID 如今,RAID有多种方案或RAID级别,如下所示:
- RAID 0 - Non-redundant striping: This level is used to increase the performance of the server.
- RAID 1 - Mirroring and duplexing: This level is also known as disk mirroring and is considered the simplest way to implement fault tolerance.
- RAID 2 - Memory-style error-correcting codes: This level generally uses dedicated hamming code parity I.e., a liner form of error correction code.
- RAID 3 - Bit-interleaved Parity: This level requires a dedicated parity drive to store parity information.
- RAID 4 - Block-interleaved Parity: This level is similar to RAID 5 but the only difference is that this level confines all parity data to a single drive.
- RAID 5 - Block-interleaved distributed Parity: This level provides far better performance than disk mirroring and fault tolerance.
- RAID 6 - P+Q Redundancy: This level generally provides fault tolerance for two drive failures.
236. What is GUI?
什么是GUI?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb697f | 官方: 否 | 付费: 否
答案:
GUI (Graphical User Interface) is basically a type of user interface that allows users to use graphics to interact with OS. GUI is created because it is more user-friendly, less complex, and easier to understand rather than a command-line interface. Its main goal is to increase efficiency and ease of use. Instead of having to memorize commands, users can just click on a button to simply execute the procedure. Examples of GUI include Microsoft Windows, macOS, Apple’s iOS, etc.
GUI(图形用户界面)基本上是一种用户界面类型,允许用户使用图形与操作系统交互。GUI的创建是因为它比命令行界面更用户友好、更不复杂且更容易理解。其主要目标是提高效率和易用性。用户无需记住命令,只需点击按钮即可简单地执行操作。GUI的示例包括Microsoft Windows、macOS、Apple的iOS等。
- Data Science
- All Events
- My Events
237. What is a Pipe and when it is used?
什么是管道,何时使用它?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb6982 | 官方: 否 | 付费: 否
答案:
The pipe is generally a connection among two or more processes that are interrelated to each other. It is a mechanism that is used for inter-process communication using message passing. One can easily send information such as the output of one program process to another program process using a pipe. It can be used when two processes want to communicate one-way i.e., inter-process communication (IPC).
管道通常是两个或多个相互关联的进程之间的连接。它是一种使用消息传递进行进程间通信的机制。人们可以通过管道轻松地将信息(如一个程序进程的输出)发送到另一个程序进程。当两个进程想要进行单向通信(即进程间通信(IPC))时,可以使用它。
238. What are the different kinds of operations that are possible on semaphore?
信号量上可能有哪些不同类型的操作?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb6985 | 官方: 否 | 付费: 否
答案:
There are basically two atomic operations that are possible: - Wait()
基本上有两种原子操作是可能的:- Wait()
- Signal()
239. What is a bootstrap program in OS?
操作系统中的引导程序是什么?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37c0558d557c902bb6988 | 官方: 否 | 付费: 否
答案:
It is generally a program that initializes OS during startup i.e., first code that is executed whenever computer system startups. OS is loaded through a bootstrapping process or program commonly known as booting. Overall OS only depends on the bootstrap program to perform and work correctly. It is fully stored in boot blocks at a fixed location on the disk. It also locates the kernel and loads it into the main memory after which the program starts its execution.
它通常是一个在启动时初始化操作系统的程序,即每当计算机系统启动时执行的第一段代码。操作系统通过一个引导过程或程序(通常称为启动)加载。总体上,操作系统仅依赖引导程序来正确执行和工作。它完全存储在磁盘上固定位置的引导块中。它还会定位内核并将其加载到主内存中,之后程序开始执行。
240. Explain demand paging?
解释什么是按需分页?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb698b | 官方: 否 | 付费: 否
答案:
Demand paging is a method that loads pages into memory on demand. This method is mostly used in virtual memory. In this, a page is only brought into memory when a location on that particular page is referenced during execution. The following steps are generally followed: - Attempt to access the page.
按需分页是一种将页面按需加载到内存中的方法。这种方法主要用于虚拟内存。在这种方法中,只有当执行期间引用了特定页面上的某个位置时,该页面才会被调入内存。通常遵循以下步骤:- 尝试访问页面。
- If the page is valid (in memory) then continue processing instructions as normal.
- If a page is invalid then a page-fault trap occurs.
- Check if the memory reference is a valid reference to a location on secondary memory. If not, the process is terminated (illegal memory access). Otherwise, we have to page in the required page.
- Schedule disk operation to read the desired page into main memory.
- Restart the instruction that was interrupted by the operating system trap.
241. What do you mean by RTOS?
你所说的 RTOS 是什么意思?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb698e | 官方: 否 | 付费: 否
答案:
Real Time Operating System (RTOS) is an operating system that is used for real-time applications i.e., for those applications where data processing should be done in a fixed and small measure of time. It performs much better on tasks that are needed to be executed within a short time. It also takes care of execution, monitoring, and all-controlling processes. It also occupies less memory and consumes fewer resources.
实时操作系统(RTOS)是一种用于实时应用程序的操作系统,即用于那些需要在固定且小的时间量内完成数据处理的应用程序。它在需要在短时间内执行的任务上表现更好。它还负责执行、监控和所有控制过程。它占用更少的内存并消耗更少的资源。
Types of RTOS: - Hard Real-Time
RTOS 的类型:- 硬实时
- Firm Real-Time
- Soft Real-Time
RTOS is used in Air traffic control systems, Anti-lock Brake Systems, and Heart pacemakers.
RTOS 用于空中交通管制系统、防抱死制动系统和心脏起搏器。
242. What do you mean by process synchronization?
你所说的进程同步是什么意思?
- 知识点: 操作系统与网络 / 算法与数据结构 / 行为与软技能 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb6991 | 官方: 否 | 付费: 否
答案:
Process synchronization is basically a way to coordinate processes that use shared resources or data. It is very much essential to ensure synchronized execution of cooperating processes so that will maintain data consistency. Its main purpose is to share resources without any interference using mutual exclusion. There are two types of process synchronization: - Independent Process
进程同步基本上是一种协调使用共享资源或数据的进程的方式。它对于确保协作进程的同步执行以保持数据一致性至关重要。其主要目的是通过互斥来共享资源而不产生干扰。进程同步有两种类型:- 独立进程
- Cooperative Process
243. What is IPC? What are the different IPC mechanisms?
什么是 IPC?有哪些不同的 IPC 机制?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb6994 | 官方: 否 | 付费: 否
答案:
IPC (Interprocess Communication) is a mechanism that requires the use of resources like a memory that is shared between processes or threads. With IPC, OS allows different processes to communicate with each other. It is simply used for exchanging data between multiple threads in one or more programs or processes. In this mechanism, different processes can communicate with each other with the approval of the OS.
IPC(进程间通信)是一种需要使用如进程或线程间共享内存等资源的机制。通过 IPC,操作系统允许不同进程之间相互通信。它只是用于在一个或多个程序或进程中的多个线程之间交换数据。在这种机制中,不同进程可以在操作系统的批准下相互通信。
Different IPC Mechanisms: - Pipes
不同的 IPC 机制:- 管道
- Message Queuing
- Semaphores
- Socket
- Shared Memory
- Signals
Successful Tech Career for FREE!
免费开启成功的科技职业生涯!
Successful Tech Career!
成功的技术职业生涯!
Interview Process
面试流程
CTC & Designation
CTC与职位级别
Projects on the Job
工作项目
Referral System
推荐系统
Try It Out
试试看
2 Lakh+ Roadmaps Created
已生成20万+职业规划
244. What is different between main memory and secondary memory.
主内存和辅助内存有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb6997 | 官方: 否 | 付费: 否
答案:
Main memory: Main memory in a computer is RAM (Random Access Memory). It is also known as primary memory or read-write memory or internal memory. The programs and data that the CPU requires during the execution of a program are stored in this memory. Secondary memory: Secondary memory in a computer are storage devices that can store data and programs. It is also known as external memory or additional memory or backup memory or auxiliary memory. Such storage devices are capable of storing high-volume data. Storage devices can be hard drives, USB flash drives, CDs, etc.
主内存:计算机中的主内存是 RAM(随机存取存储器)。它也被称为主存储器或读写存储器或内部存储器。CPU 在执行程序期间所需的程序和存储在该内存中。辅助内存:计算机中的辅助内存是能够存储数据和程序的存储设备。它也被称为外部存储器或附加存储器或备份存储器或辅助存储器。此类存储设备能够存储大量数据。存储设备可以是硬盘驱动器、USB 闪存驱动器、光盘等。
| Primary Memory 主存储器 | Secondary Memory 辅助存储器 |
|---|---|
| Data can be directly accessed by the processing unit. 数据可以由处理单元直接访问。 | Firstly, data is transferred to primary memory and after then routed to the processing unit. 首先,数据被传输到主存储器,然后路由到处理单元。 |
| It can be both volatile and non-volatile in nature. 它可以是易失性的也可以是非易失性的。 | It is non-volatile in nature. 它是非易失性的。 |
| It is more costly than secondary memory. 它比辅助存储器更昂贵。 | It is more cost-effective or less costly than primary memory. 它比主存储器更具成本效益或更便宜。 |
| It is temporary because data is stored temporarily. 它是临时的,因为数据是临时存储的。 | It is permanent because data is stored permanently. 它是永久的,因为数据是永久存储的。 |
| In this memory, data can be lost whenever there is a power failure. 在这种内存中,断电时数据可能会丢失。 | In this memory, data is stored permanently and therefore cannot be lost even in case of power failure. 在这种内存中,数据是永久存储的,因此即使断电也不会丢失。 |
| It is much faster than secondary memory and saves data that is currently used by the computer. 它比辅助存储器快得多,并保存计算机当前使用的数据。 | It is slower as compared to primary memory and saves different kinds of data in different formats. 与主存储器相比,它较慢,并以不同格式保存各种数据。 |
| It can be accessed by data. 它可以按数据访问。 | It can be accessed by I/O channels. 它可以按 I/O 通道访问。 |
245. What do you mean by overlays in OS?
你所说的操作系统中的覆盖技术是什么意思?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb699a | 官方: 否 | 付费: 否
答案:
Overlays is basically a programming method that divides processes into pieces so that instructions that are important and need can be saved in memory. It does not need any type of support from the OS. It can run programs that are bigger in size than physical memory by only keeping only important data and instructions that can be needed at any given time.
覆盖是一种编程方法,将进程划分为片段,以便重要且需要的指令可以保存在内存中。它不需要操作系统提供任何类型的支持。它可以通过仅保留在任意给定时间可能需要的关键数据和指令,来运行比物理内存更大的程序。
246. Write top 10 examples of OS?
写出操作系统的10个顶级示例?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb699d | 官方: 否 | 付费: 否
答案:
Some of the top OS’s that are used mostly are given below: - MS-Windows
下面给出了一些最常用的顶级操作系统:- MS-Windows
- Ubuntu
- Mac OS
- Fedora
- Solaris
- Free BSD
- Chrome OS
- CentOS
- Debian
- Android
247. What is time sharing, and how does it help users?
什么是分时,它如何帮助用户?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69a0 | 官方: 否 | 付费: 否
答案:
Time sharing is a technique where the CPU switches rapidly between multiple processes, giving each process a small time slice.
分时是一种技术,CPU在多个进程之间快速切换,给每个进程分配一个小的时片。
This creates the illusion that multiple programs are running at the same time. Time sharing improves system responsiveness and allows multiple users or applications to share system resources efficiently.
这造成多个程序同时运行的假象。分时提高了系统响应性,并允许多个用户或应用程序高效地共享系统资源。
It is especially useful in multi-user and multitasking operating systems.
它在多用户和多任务操作系统中特别有用。
248. What is latency, and why does it matter in an operating system?
什么是延迟,它为什么在操作系统中很重要?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69a3 | 官方: 否 | 付费: 否
答案:
Latency refers to the time taken to respond to a request or event.
延迟是指响应请求或事件所花费的时间。
In an operating system, lower latency means faster response to user actions, interrupts, or system calls. High latency can make systems feel slow or unresponsive, even if overall throughput is high. This is especially important in real-time and interactive systems.
在操作系统中,更低的延迟意味着对用户操作、中断或系统调用的响应更快。高延迟会使系统感觉缓慢或无响应,即使总体吞吐量很高。这在实时和交互式系统中尤其重要。
249. What is context switching in simple terms?
简单来说,什么是上下文切换?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69a6 | 官方: 否 | 付费: 否
答案:
Context switching is the process of saving the state of one process and loading the state of another, so the CPU can switch between them.
上下文切换是保存一个进程的状态并加载另一个进程的状态的过程,以便CPU可以在它们之间切换。
When the operating system switches tasks, it stores information like registers and program counters of the current process and restores the saved state of the next process. This allows multiple processes to share the CPU effectively.
当操作系统切换任务时,它存储当前进程的寄存器、程序计数器等信息,并恢复下一个进程的已保存状态。这允许多个进程有效地共享CPU。
250. What is the difference between an interrupt, a trap, and an exception?
中断、陷阱和异常之间有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69a9 | 官方: 否 | 付费: 否
答案:
These terms describe different ways control is transferred to the operating system. - Interrupt is triggered by hardware or external events, such as I/O completion or a timer signal. It is asynchronous to the currently running program.
这些术语描述了控制权转移到操作系统的不同方式。 - 中断由硬件或外部事件触发,例如I/O完成或定时器信号。它与当前运行的程序是异步的。
- Trap is a deliberate, synchronous event caused by a program, commonly used to invoke a system call.
- Exception occurs due to an error during program execution, such as division by zero or invalid memory access.
251. What is the difference between a system call and a library call?
系统调用和库调用之间有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69ac | 官方: 否 | 付费: 否
答案:
A system call is a request made by a program to the operating system kernel to perform a privileged operation, such as reading a file or creating a process.
系统调用是程序向操作系统内核发出的请求,用于执行特权操作,例如读取文件或创建进程。
A library call is a function provided by a programming library that runs in user space. It may perform computations on its own or internally invoke a system call if kernel access is required.
库调用是由编程库提供的函数,运行在用户空间中。它可能自行执行计算,或者在需要内核访问时内部调用系统调用。
252. What is a system call, and why is it needed?
什么是系统调用,为什么需要它?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69af | 官方: 否 | 付费: 否
答案:
A system call is a mechanism that allows a program running in user mode to request services from the kernel.
系统调用是一种机制,允许运行在用户模式下的程序请求内核服务。
Operations like file access, process creation, and memory allocation require kernel-level permissions. Since user programs cannot access these resources directly, they use system calls to safely communicate with the operating system.
文件访问、进程创建和内存分配等操作需要内核级权限。由于用户程序无法直接访问这些资源,它们使用系统调用安全地与操作系统进行通信。
System calls help maintain control, security, and proper resource management in the system.
系统调用有助于维护系统的控制、安全性和适当的资源管理。
253. What is the difference between user mode and kernel mode?
用户模式和内核模式之间有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69b2 | 官方: 否 | 付费: 否
答案:
An operating system works in two modes to maintain security and stability. - User mode is where normal applications run. In this mode, programs have limited access to system resources and cannot directly interact with hardware.
操作系统以两种模式运行以维护安全性和稳定性。- 用户模式是普通应用程序运行的地方。在此模式下,程序对系统资源的访问受限,无法直接与硬件交互。
Kernel mode is where the operating system core runs. It has full access to hardware, memory, and system resources.
These categories ensure that if an application crashes or misbehaves in user mode, it does not affect the system entirely.这些分类确保如果应用程序在用户模式下崩溃或行为异常,不会完全影响整个系统。
254. What do you understand about system calls?
您对系统调用有何理解?
- 知识点: 操作系统与网络 (标签: interviewbit, paytm, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Paytm
- id: 69b37c1358d557c902bb710d | 官方: 否 | 付费: 否
答案:
A system call is a way for a computer programme to request a service from the kernel of the operating system it is executing on. A system call is a program's way of interacting with the operating system. A system call is when a piece of software makes a request to the operating system's kernel. The Application Program Interface (API) is used to provide services from the operating system to user programmes (API). It serves as a link between a process and the operating system, allowing user-level programmes to request services from the operating system. System calls are the sole way to get into the kernel system. Any software that consumes resources must make use of system calls.
系统调用是计算机程序从其运行所在的操作系统内核请求服务的一种方式。系统调用是程序与操作系统交互的一种方式。系统调用是软件向操作系统内核发出请求的行为。应用程序接口(API)用于将操作系统的服务提供给用户程序(API)。它充当进程与操作系统之间的链接,允许用户级程序向操作系统请求服务。系统调用是进入内核系统的唯一途径。任何消耗资源的软件都必须使用系统调用。
255. Describe the Unix kernel in detail.
详细描述 Unix 内核。
- 知识点: 操作系统与网络 (标签: interviewbit, paytm, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Paytm
- id: 69b37c1358d557c902bb7116 | 官方: 否 | 付费: 否
答案:
The UNIX kernel is the heart of the operating system. It connects to the processor, memory, and I/O management, as well as the hardware devices. The kernel manages user requests using system calls that shift the process from user to kernel space. Every time a user process makes a system call, such as read(), fork(), exec(), open(), and so on, a context switch happens. A context switch is a mechanism for changing the state of a process. The process can be stopped until the system call is finished, or it can continue and be notified when the system call is finished through a signal (nonblocking).
UNIX 内核是操作系统的核心。它连接到处理器、内存和 I/O 管理以及硬件设备。内核通过将进程从用户空间切换到内核空间的系统调用来管理用户请求。每当用户进程进行系统调用(例如 read()、fork()、exec()、open() 等)时,都会发生上下文切换。上下文切换是一种改变进程状态的机制。进程可以停止,直到系统调用完成,或者它可以继续运行,并在系统调用通过信号(非阻塞)完成时收到通知。
256. What do you understand about the concept of Virtual memory?
您对虚拟内存的概念有何理解?
- 知识点: 操作系统与网络 (标签: interviewbit, paytm, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Paytm
- id: 69b37c1358d557c902bb7119 | 官方: 否 | 付费: 否
答案:
Virtual memory is a type of memory that is created on the storage device for a brief period of time. When a computer's RAM is drained as a result of numerous processes running at the same time, this happens. The operating system makes a portion of the storage disc available for use as RAM. Virtual memory is significantly slower than main memory because processing power is used by moving data around rather than performing instructions. The operating systems guide explains how memory is managed by the operating system. Latency increases when the computer must use virtual memory. To move data between RAM and virtual memory, the operating system uses swapping. The operating system moves data from processes that aren't in use right now out of RAM and into virtual memory. When the process is required again, the data is copied back into RAM. Using virtual memory slows down the machine since transferring to a hard disc takes much longer than reading and writing RAM.
虚拟内存是一种在存储设备上临时创建的内存。当由于同时运行大量进程而导致计算机的 RAM 被耗尽时,就会发生这种情况。操作系统将部分存储磁盘提供出来用作 RAM。虚拟内存比主内存慢得多,因为处理能力被用于移动数据而非执行指令。操作系统指南解释了操作系统如何管理内存。当计算机必须使用虚拟内存时,延迟会增加。为了在 RAM 和虚拟内存之间移动数据,操作系统使用交换。操作系统将当前未使用的进程的数据从 RAM 移出到虚拟内存中。当再次需要该进程时,数据会被复制回 RAM。使用虚拟内存会减慢机器速度,因为传输到硬盘所需的时间比读写 RAM 长得多。
257. How well do you know Socket Programming? List the benefits and drawbacks of Sockets in Java.
您对 Socket 编程了解多少?列出 Java 中 Socket 的优点和缺点。
- 知识点: 操作系统与网络 (标签: interviewbit, paytm, company-specific)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: general
- 公司: Paytm
- id: 69b37c1358d557c902bb7122 | 官方: 否 | 付费: 否
答案:
Socket programming is a method for allowing two network nodes to communicate with one another. One socket (node) monitors traffic on a specific port at a given IP address, while the other socket connects to it. The server creates the listener socket while the client is connected to it.
Socket 编程是一种让两个网络节点相互通信的方法。一个套接字(节点)在给定 IP 地址的特定端口上监视流量,而另一个套接字连接到它。服务器创建监听套接字,而客户端连接到它。
The following are some of the benefits of Java Sockets: - Sockets are adaptable and plentiful. For routine communications, socket-based programming is simple to build.
以下是 Java Socket 的一些优点: - 套接字灵活且数量充足。对于常规通信,基于套接字的编程易于构建。
Low network traffic is caused by sockets. Unlike HTML forms and CGI scripts, which build and deliver complete web pages for each new request, Java applets can merely send the updated data.
The following are some of the drawbacks of Java Sockets: - Because a Java applet running in a Web browser can only connect to the machine from which it originated and nowhere else on the network, security constraints can be a pain at times.以下是 Java Socket 的一些缺点: - 由于在 Web 浏览器中运行的 Java 小程序只能连接到其来源的机器,而不能连接到网络上的其他任何地方,因此安全限制有时可能会很麻烦。
- Despite all of Java's advantages, socket-based connections are confined to the transfer of raw data packets between programs. Both the client and the server must provide techniques for converting data into usable information.
- Socket-based systems are limited in their reusability since data formats and protocols are application-specific.
258. What are schedulers and how do they work in operating systems? List and demonstrate the various types of schedulers found in operating systems.
什么是调度器,它们在操作系统中如何工作?列出并演示操作系统中发现的各种类型的调度器。
- 知识点: 操作系统与网络 (标签: interviewbit, paytm, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Paytm
- id: 69b37c1358d557c902bb712f | 官方: 否 | 付费: 否
答案:
Schedulers are specialised computer programs that govern how processes are scheduled in various ways. Their primary responsibility is to determine which jobs should be entered into the system and which processes should be carried out.
调度器是专门的计算机程序,以各种方式管理进程的调度。它们的主要职责是确定哪些作业应进入系统以及哪些进程应被执行。
The following are the three types of schedulers : - Long Term Scheduler: A long term scheduler is also known as a task scheduler. A long-term scheduler determines which applications are accepted for processing into the system. Before executing a process, it selects it from the ready queue and loads it into memory. For CPU scheduling, the process is loaded into memory. The job scheduler's primary goal is to deliver a well-balanced mix of operations, including input/output and CPU-bound workloads. It also regulates how much multiprogramming is done. If the degree of multiprogramming remains constant, the average rate of process formation must be equal to the average rate of process departure from the system.
以下是三种类型的调度器:- 长期调度器:长期调度器也称为任务调度器。长期调度器决定哪些应用程序被接受进入系统进行处理。在执行进程之前,它从就绪队列中选择进程并将其加载到内存中。对于CPU调度,进程被加载到内存中。作业调度器的主要目标是提供均衡的操作组合,包括输入/输出和CPU密集型工作负载。它还调节多道程序设计的程度。如果多道程序设计程度保持不变,进程创建的平均速率必须等于进程离开系统的平均速率。
- Medium Term Scheduler: The medium-term scheduler is used to shift programs in the main memory. It frees up RAM that has been consumed by the processes. As a result, multiprogramming is reduced to a minimum. The swapped out processes are managed by the medium-term scheduler.
- Short Term Scheduler: A short term scheduler is also known as a CPU scheduler. Its primary goal is to improve system performance in accordance with a set of predetermined criteria. It is the transition of a process from the ready to the operating state. The CPU scheduler picks one of the ready-to-run processes and allocates CPU time to it. Short term schedulers, often known as dispatchers, choose the next process to run.
259. Briefly explain what is PowerShell
简要解释什么是PowerShell
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb7763 | 官方: 否 | 付费: 否
答案:
PowerShell is a cross-platform task automation solution composed of a scripting language, command-line shell, and a configuration management framework. PowerShell operates on Windows, Linux, and macOS. In 2006, when PowerShell was released, this effective tool effectively substituted Command Prompt as the default way to ensue automatic batch processes and develop personalized system management tools. Multiple system administrators, such as MSPs (managed services providers) depend on Powershell's 130 plus command-line tools to simplify and scale tasks in remote and systems. Its abilities have been integrated into several other interfaces. It has always been crucial for MSPs to comprehend how PowerShell functions, what it is employed for, and how to make management tasks automatic, which will optimise time and effort.
PowerShell是一种跨平台的任务自动化解决方案,由脚本语言、命令行外壳和配置管理框架组成。PowerShell可在Windows、Linux和macOS上运行。2006年PowerShell发布时,这一高效工具有效取代了Command Prompt作为自动批处理过程和开发个性化系统管理工具的默认方式。多个系统管理员,例如MSP(托管服务提供商),依赖PowerShell的130多个命令行工具来简化和扩展远程及系统任务。其功能已被集成到多种其他界面中。对于MSP来说,理解PowerShell如何运作、用于什么目的以及如何自动化管理任务至关重要,这将优化时间和精力。
260. Explain briefly what are Help and comments in PowerShell.
简要解释PowerShell中Help和注释是什么。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb7766 | 官方: 否 | 付费: 否
答案:
PowerShell allows the accumulation of help topics for modules, scripts, and individual commands. To look at all the help topics, you can use the Get-Help command. While importing a module into a session, PowerShell transfers the help topics for that module automatically. In case of no help topics for a module, the Get-Help command demonstrates autogenerated help. There are three types of help content that exist in PowerShell: external help, comment-based help, and updatable help. Comment-based help indicates comments contained with a script or command for Get-Help to read. External help allows the author to describe help content in an external XML file documented in XAML. Updatable help utilizes external help but allows users to download the new help content with the Update-Help command.
PowerShell允许为模块、脚本和单个命令累积帮助主题。要查看所有帮助主题,可以使用Get-Help命令。在将模块导入会话时,PowerShell会自动传输该模块的帮助主题。如果模块没有帮助主题,Get-Help命令会显示自动生成的帮助。PowerShell中有三种帮助内容类型:外部帮助、基于注释的帮助和可更新帮助。基于注释的帮助指示脚本或命令中包含的注释,供Get-Help读取。外部帮助允许作者在外部XML文件中描述帮助内容,该文件以XAML格式记录。可更新帮助利用外部帮助,但允许用户使用Update-Help命令下载新的帮助内容。
261. What are language constructs?
什么是语言构造?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb7769 | 官方: 否 | 付费: 否
答案:
PowerShell offers a number of language constructs that allow you to manage the flow of your script and let you make decisions about what it should do. A few of the language constructs have conditionals, switches, loops, and variables. - Conditionals: This language construct is utilized to assess a conditional expression. If the conditional expression is true, a script block is accomplished:
PowerShell提供了许多语言构造,允许你管理脚本的流程并决定其应执行的操作。一些语言构造包括条件、开关、循环和变量。- 条件:此语言构造用于评估条件表达式。如果条件表达式为真,则执行脚本块:
if ( $i -eq 1)
if ( $i -eq 1)
{
}
Else
否则
{
} - Switch: The switch statement lets you deliver a variable and a list of potential values. If the value matches the variable, then its script block is completed..
} - 开关:开关语句允许你传递一个变量和一系列潜在值。如果值匹配变量,则完成其脚本块。
switch ($i) {
开关 ($i) {
0
{
Write-Host “I is 0”
写入主机 “I 是 0”
}
1
{
Write-Host “I is 0”
写入主机 “I 是 0”
}
Default
默认
{
Write-Host “I is 0”
写入主机 “I 是 0”
}
} - Loops: What while statement does is repeat a block of code as long as the below mentioned conditional expression is working:
} - 循环:while 语句的作用是,只要以下提到的条件表达式成立,就重复执行一段代码:
while ($i -eq 0) {
while ($i -eq 0) {
}
The do loop is identical to the while loop. The only distinction is PowerShell runs the do loop at the end of the loop.
do 循环与 while 循环相同。唯一的区别是 PowerShell 在循环结束时运行 do 循环。
do {
do {
} while ($i -lt 0)
} while ($i -lt 0)
When you employ a foreach loop, PowerShell repeats the code for every item cited in the script.
当你使用 foreach 循环时,PowerShell 会为脚本中引用的每个项目重复执行代码。
$array = ( ‘item1’ , ‘item2’ , ‘item3’)
$数组 = ( ‘项目1’ , ‘项目2’ , ‘项目3’)
foreach ($item in $array) {
foreach ($项目 in $数组) {
}
Make use of a for loop to execute statements constantly till a condition is met.
使用 for 循环来持续执行语句,直到满足条件为止。
for ($i = 0; $i -lt 5; $i++)
for ($i = 0; $i -lt 5; $i++)
{
$i
$i
}
262. Is Windows PowerShell similar to Command Prompt?
Windows PowerShell 与命令提示符相似吗?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb776c | 官方: 否 | 付费: 否
答案:
Though Windows Powershell 1.0 was released as a substitute for Command Prompt, it’s incorrect to assume PowerShell as just a recent version of the classic command-line interpreter. As a matter of fact, both programs still live on Windows 10, although PowerShell is much more effective. Some intermediate-level consumers may select to utilize Command Prompt if they are already acquainted with the language—its interface performs simple DOS commands, and for some consumers, that is enough. But the many benefits of PowerShell make it a more engaging tool for MSPs who desire true control over a network. By offering cmdlets that can go into registry management and WMI, PowerShell provides you access to additional system administration tasks than Command Prompt, particularly as PowerShell is not only meant for Windows but it is an open-source mechanism for Linux and Mac OS X as well. SolarWinds® Remote Monitoring & Management (RMM) delivers all the benefits of PowerShell without needing MSPs to even utilize PowerShell scripts. With the help of RMM, you can employ an easy drag-and-drop object to effortlessly devise a broad range of automated functions. This type of automation is required for busy MSPs eyeing effective, scalable business practices. RMM’s user-friendly interface allows you to leverage all the advantages of Windows PowerShell, faster.
尽管 Windows PowerShell 1.0 是作为命令提示符的替代品发布的,但认为 PowerShell 只是经典命令行解释器的最新版本是不正确的。事实上,这两个程序在 Windows 10 上仍然存在,尽管 PowerShell 效率更高。一些中级用户如果已经熟悉该语言,可能会选择使用命令提示符——其界面执行简单的 DOS 命令,对某些用户来说,这就足够了。但 PowerShell 的诸多优势使其成为希望真正控制网络的 MSP 更感兴趣的工具。通过提供能够深入注册表管理和 WMI 的 cmdlet,PowerShell 比命令提示符更能让您访问额外的系统管理任务,尤其是因为 PowerShell 不仅适用于 Windows,还是 Linux 和 Mac OS X 的开源机制。SolarWinds® 远程监控与管理 (RMM) 提供了 PowerShell 的所有优势,而无需 MSP 甚至使用 PowerShell 脚本。借助 RMM,您可以使用简单的拖放对象轻松设计广泛的自动化功能。这种类型的自动化对于寻求高效、可扩展业务实践的忙碌 MSP 是必需的。RMM 的用户友好界面允许您更快地利用 Windows PowerShell 的所有优势。
263. Mention the types of Powershell Scopes.
提到 PowerShell 作用域的类型。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb776f | 官方: 否 | 付费: 否
答案:
The four types of PowerShell scopes are Global, Local, Script, Private. - Global:
PowerShell 的四种作用域类型是全局、局部、脚本、私有。 - 全局:
The scope that is in effect while PowerShell runs or when you start a new session or run space. Variables and functions that are included when PowerShell begins have been designed in the global scope. This contains preference variables and automatic variables. This also comprises functions, variables, aliases that are within your PowerShell profile. - Local: The current scope. The local scope can be the global scope or any other scope.
当 PowerShell 运行或您启动新会话或运行空间时生效的作用域。PowerShell 启动时包含的变量和函数已设计在全局作用域中。这包含首选项变量和自动变量。这也包括 PowerShell 配置文件中的函数、变量、别名。 - 局部:当前作用域。局部作用域可以是全局作用域或任何其他作用域。
- Script:The scope is built while a script file runs. Just the commands in the script operate in the script scope. To the commands in a script, the script scope is the local scope.
- Private:You cannot see the items in private scope outside of the current scope. You can utilize the private scope to build a private version of an item having the exact name in another scope.
264. Explain the difference between CIM (Common Information Model) vs WMI (Windows Management Instrumentation).
解释 CIM(通用信息模型)与 WMI(Windows 管理规范)之间的区别。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb7776 | 官方: 否 | 付费: 否
答案:
| CIM | Old WMI 旧 WMI | New WMI 新 WMI |
|---|---|---|
| CIM is a Vendor-neutral and industry-standard designed way of manifestation of management information. CIM 是供应商中立且行业标准的管理信息展示方式。 | Old WMI is Microsoft’s initial incorporation of CIM. 旧 WMI 是微软最初对 CIM 的整合。 | New WMI was released alongside WMF v3 in the year 2012 and it was compliant to the latest CIM standards. 新 WMI 于 2012 年随 WMF v3 一起发布,符合最新的 CIM 标准。 |
| It is designed by another company named the DMTF 它由另一家名为 DMTF 的公司设计 | It is designed by Microsoft 它由微软设计 | It is designed by Microsoft as well. 它也由微软设计。 |
| It not available 它不可用 | It is available in PowerShell v1 它在 PowerShell v1 中可用 | It is available in PowerShell v3. 它在 PowerShell v3 中可用。 |
| It employs WSMan which is a standard developed by DMTF. 它使用 WSMan,这是由 DMTF 开发的标准。 | It used DCOM and RPCs Remote Procedure Calls. 它使用 DCOM 和 RPC 远程过程调用。 | It employs WSMan and no more DCOM errors are possible with this. 它使用 WSMan,不再可能发生 DCOM 错误。 |
| It can work on any platform. 它可以在任何平台上运行。 | Works on Windows only. 仅在 Windows 上运行。 | Works on Windows only. 仅在 Windows 上运行。 |
| It owns WSMan Port – 5985 (HTTP) and 5986(HTTPS) for its purpose. 它拥有 WSMan 端口 – 5985 (HTTP) 和 5986 (HTTPS) 供其使用。 | It has RPC port- 135 for use 它有 RPC 端口 - 135 供使用 | It owns WSMan Port – 5985 (HTTP) and 5986(HTTPS) for use. 它拥有 WSMan 端口 – 5985 (HTTP) 和 5986 (HTTPS) 供使用。 |
265. Distinguish between the notion of WMI between old and new ideas.
区分旧观念和新观念之间 WMI 的概念。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb7779 | 官方: 否 | 付费: 否
答案:
Old WMI - Employs the old-style native code providers and a repository.
旧 WMI - 使用旧式本机代码提供程序和存储库。
- Accessible only on Windows as mentioned.
It has been more or less deprecated which means it’s is not focused on further advancement or development but can be used..
New WMI - Backs old-style native code providers and a repository, along with new-style MI providers.新 WMI - 支持旧式本机代码提供程序和存储库,以及新式 MI 提供程序。
- Accessible only on Windows as mentioned. It has a stateless relationship with the remote machine.
- The main attraction of the new WMI is that it employs WSMan and no more DCOM errors are possible with this.
266. Explain how would you place a registry value with PowerShell?
解释如何使用 PowerShell 放置注册表值?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb777c | 官方: 否 | 付费: 否
答案:
Registry values are properties of keys and, as such, cannot be directly browsed. This requires us to understand that there are no registry-specific cmdlets, so we have to utilize the registry provider and Set-ItemProperty. You can also utilize the New-ItemProperty cmdlet to build the registry entry and its value and then make use of Set-ItemProperty to modify the value.
注册表值是键的属性,因此无法直接浏览。这要求我们理解没有注册表专用的 cmdlet,因此我们必须利用注册表提供程序和 Set-ItemProperty。您还可以利用 New-ItemProperty cmdlet 来构建注册表项及其值,然后使用 Set-ItemProperty 来修改该值。
The registry has been an essential part of Windows forever, thus this is hardly area-specific knowledge.
注册表一直是 Windows 的重要组成部分,因此这算不上特定领域的知识。
267. Mention the two important differences between Bash and PowerShell?
提到 Bash 和 PowerShell 之间的两个重要区别?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb777f | 官方: 否 | 付费: 否
答案:
This question is a great opportunity to get an understanding of the candidate's knowledge of PowerShell core concepts and his/her favourite PowerShell features.
这个问题是一个绝佳的机会,用以了解候选人对PowerShell核心概念的掌握程度以及他/她最喜欢的PowerShell特性。
For instance, one of the most essential distinctions between PowerShell and bash is that PowerShell is object-oriented whereas bash is text-oriented. PowerShell treats input and output as an object and Bash always considers input and output as a text structure.
例如,PowerShell与bash之间最本质的区别之一是PowerShell面向对象,而bash面向文本。PowerShell将输入和输出视为对象,而Bash始终将输入和输出视为文本结构。
PowerShell's user interface is a graphical command-line interface CLI. whereas Bash's user interface shell is a text-based command-line interface. PowerShell can run on any version of Windows ranging from Windows 97 to Windows 10. Bash is specifically designed for Linux and Unix operating systems from the first day.
PowerShell的用户界面是一个图形化命令行界面CLI,而Bash的用户界面shell是一个基于文本的命令行界面。PowerShell可以运行在从Windows 97到Windows 10的任何Windows版本上。Bash从第一天起就是专门为Linux和Unix操作系统设计的。
268. Why should developers use PowerShell?
为什么开发者应该使用PowerShell?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb7782 | 官方: 否 | 付费: 否
答案:
PowerShell is a famous instrument for many MSPs as its scalability allows to streamline management tasks and develop insights into instruments, specifically over medium or large networks.
PowerShell是许多MSP(托管服务提供商)中常用的工具,因为其可扩展性允许简化管理任务并深入洞察工具,特别是在中型或大型网络中。
Here’s how PowerShell's usefulness can change your workflow: - Automate time-consuming tasks: With the help of Automate time-consuming tasks provided by PowerShell, you don’t have to complete the identical task again and again or even take the time for manual configuration. For example, you can employ cmdlets like Get-Command to look for other cmdlets, Get-Help to find these cmdlets’ syntax and benefits, and Invoke-Command to drive a common script remotely or locally even with batch control.
以下是PowerShell的实用性如何改变您的工作流程:- 自动化耗时的任务:借助PowerShell提供的自动化耗时任务功能,您不必一遍又一遍地完成相同的任务,也不必费时进行手动配置。例如,您可以使用Get-Command等cmdlet来查找其他cmdlet,使用Get-Help来查找这些cmdlet的语法和好处,以及使用Invoke-Command在本地或远程驱动公共脚本,甚至支持批量控制。
- Offer network-wide workarounds: Making use of PowerShell allows you to get around the limitations of software or program, particularly on a business-wide scale. For example, PowerShell can be employed to reconfigure the default settings of a program over an entire network. This could be helpful if a company wishes to roll out a certain protocol to all its customers—say, convincing users to employ two-factor authentication (2FA) or modify their password every other month.
- Take your endeavours across various devices: PowerShell serves as a lifesaver if your script requires to be run across countless systems, especially if some of them are remote devices.If you’re attempting to incorporate a solution on quite a few devices or servers at once, you don’t want to log in individually into devices. In minutes PowerShell can assist you to collect information about numerous devices, as compared to the endless time it would require to scan each device manually. Once you allow PowerShell remoting, you’ll be able to enable your scripts to reach several machines at once, letting you install updates, settings configuration, compile information, and more importantly, cutting down hours of work and travel time.
The benefit of command-line interfaces: The added advantage of command-line interfaces such as PowerShell is the access they give you to a system's file system. PowerShell constructs the Windows Registry, hard-to-find data in files, and digital signature certificates visible even though it is housed on many systems. This information can then be exported for the purpose of reporting.
Ultimately, as every Windows 10 computer should have pre-installed it, it’s not challenging to understand PowerShell. As an MSP, comprehending PowerShell not only places you a step ahead of your peers but offers you a broad range of useful capabilities. If you are aware of scripting cmdlets for PowerShell, it’s that much uncomplicated for you to heighten your efforts and deliver precise, adjustable, and quick service to customers.最终,由于每台Windows 10计算机都应预装它,理解PowerShell并不困难。作为MSP,理解PowerShell不仅让您领先于同行,还为您提供了广泛的有用能力。如果您知道如何为PowerShell编写脚本cmdlet,那么提升您的努力并为客户提供精确、可调整和快速的服务就会变得非常容易。
269. What are PowerShell modules?
什么是PowerShell模块?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb7785 | 官方: 否 | 付费: 否
答案:
A PowerShell module is a conjoined portion of PowerShell functions or grouped code. All PowerShell cmdlets and providers are incorporated by a module or a snap-in. The receivers of these modules can add the commands included in the module to their PowerShell sessions to use them like built-in commands. The most uncomplicated method to build a PowerShell module is to save the script as a PSM1 file.
PowerShell模块是PowerShell函数或分组代码的连接部分。所有PowerShell cmdlet和提供程序都通过模块或嵌入式管理单元集成。这些模块的接收者可以将模块中包含的命令添加到其PowerShell会话中,像使用内置命令一样使用它们。构建PowerShell模块最简单的方法是将脚本保存为PSM1文件。
A PowerShell module includes 4 fundamental elements: - A PSM file, being the module;
PowerShell模块包括4个基本元素:- 一个PSM文件,即模块本身;
- Help files or scripts required by the module;
- A manifest file that defines the module
A directory that accumulates the content.
There are four types of PowerShell modules: - Script module: A PSM1 file that includes different functions to allow admins to execute management functions, import, and export.有四种类型的PowerShell模块:- 脚本模块:一个PSM1文件,包含不同的函数,允许管理员执行管理功能、导入和导出。
- Binary module: A .NET framework assembly (DLL file) that includes saved code. Programmers generally utilize a binary module to build cmdlets with strong features not easily done with a PowerShell script.
- Manifest module: A module (PSM1) file with an associated PSD1 file (manifest).
- Dynamic module: A dynamic module is dynamically built on demand by a script. It isn't reserved or loaded to persistent storage.
270. Define PowerShell Integrated Scripting Environment (ISE).
定义PowerShell集成脚本环境(ISE)。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb7789 | 官方: 否 | 付费: 否
答案:
PowerShell ISE(Integrated Scripting Environment), released by Microsoft in PowerShell version 2.0, is a PowerShell host application utilized to document, test, and debug scripts or compose commands in a Windows graphical user interface (GUI). PowerShell ISE is packed with numerous components, including syntax colouring, multiline editing, context-sensitive assistance, and tab completion. PowerShell ISE contains refined characteristics that Windows users are familiar with. For example, a customer can emphasize and copy a part of a PowerShell command with the help of a mouse or can opt for the Shift + Arrow hotkey combination. Also, the user can paste the content at any place in the editor window.
PowerShell ISE(集成脚本环境)由微软在PowerShell 2.0版本中发布,是一个PowerShell宿主应用程序,用于在Windows图形用户界面(GUI)中编写、测试和调试脚本或组合命令。PowerShell ISE包含许多组件,包括语法着色、多行编辑、上下文相关帮助和选项卡补全。PowerShell ISE包含Windows用户熟悉的精炼特性。例如,客户可以借助鼠标强调并复制PowerShell命令的一部分,或选择Shift + Arrow热键组合。此外,用户可以在编辑器窗口的任何位置粘贴内容。
Another beneficial attribute is the capacity to keep various versions of a command in the editor and execute commands you require in the PowerShell ISE. A command is directly launched by the F5 key from the editor. To run a certain line, choose it and press F8. The context-sensitive help exhibits matching cmdlets when the customer begins to enter a command. A command add-on displays a list of cmdlets to opt from.
另一个有益的特性是能够在编辑器中保留命令的多个版本,并在PowerShell ISE中执行您需要的命令。通过F5键可以直接从编辑器启动命令。要运行特定行,请选择它并按F8。上下文相关帮助在客户开始输入命令时显示匹配的cmdlet。命令附加组件显示可供选择的cmdlet列表。
PowerShell ISE enables tabs to work on numerous administrative tasks. PowerShell ISE facilitates speedy switching from the CLI to scripting mode.
PowerShell ISE支持使用选项卡处理多个管理任务。PowerShell ISE便于从CLI快速切换到脚本模式。
271. What are the key PowerShell features?
什么是关键的PowerShell特性?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb778f | 官方: 否 | 付费: 否
答案:
Microsoft implements updates and the latest features separately for the PowerShell version, but let us look at the list of the primary features and characteristics of PowerShell:
微软会针对不同版本的PowerShell分别实施更新和最新功能,但让我们先看看PowerShell的主要功能和特性列表:
- Discoverability: Consumers can uncover PowerShell's attributes with the help of cmdlets including Get-Command, which constructs a list of all the commands, like cmdlets and functions, accessible on a particular computer. Parameters can be utilized to limit the scope of the search.
- Remote commands: Admins can execute remote operations on one or numerous computers, taking the benefit of technologies like WS-Management and Windows Management Instrumentation. For example, the WS-Management protocol, allows the customer to execute PowerShell scripts and commands on remote computers.
- Pipelining: Owing to PowerShell, commands can be connected together via the pipe operator, represented as |. This approach permits the output from a particular command to turn into the input for the subsequent command in the pipeline sequence. The PowerShell pipeline allows objects, instead of flowing from one cmdlet to another and text strings.
- Tab expansion: Tab expansion is an execution of auto-completion, which executes the cmdlets, properties, and parameter names by pushing the Tab key once.
272. What are cmdlets?
什么是cmdlet?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb7793 | 官方: 否 | 付费: 否
答案:
A cmdlet is a lightweight command that is utilised in the PowerShell environment. The PowerShell runtime conjures these cmdlets in the context of automation scripts that are given at the command line. You can see the entire inventory of these commands by executing “Get-Command-Type Cmdlet” in PowerShell. Cmdlets can be USED individually, but they are more effective when conjoined—cmdlets can be used within scripts, then package scripts into more exhaustive modules. These are effective mechanisms largely as PowerShell is created on an underlying .NET framework, which lets PowerShell work more like a programming language rather than an easy command-line program. The program makes use of objects, which are a sort of manifestation of properties (attributes) or methods (instructions). With the help of PowerShell, you can utilize “pipes” that let you pass output of cmdlet to another cmdlet’s input as an object, letting numerous cmdlets operate jointly to configure the identical data. This is the basic change that has made PowerShell such a strong tool for Windows configuration.
cmdlet是一种轻量级命令,用于PowerShell环境中。PowerShell运行时会在命令行提供的自动化脚本上下文中调用这些cmdlet。你可以通过在PowerShell中执行“Get-Command-Type Cmdlet”来查看这些命令的完整列表。Cmdlet可以单独使用,但组合起来更有效——cmdlet可以在脚本中使用,然后将脚本打包成更全面的模块。这些机制之所以有效,很大程度上是因为PowerShell建立在底层.NET框架之上,这使得PowerShell更像一种编程语言而非简单的命令行程序。该程序利用对象,对象是属性(attributes)或方法(instructions)的一种表现形式。借助PowerShell,你可以使用“管道”(pipes),它将一个cmdlet的输出作为对象传递给另一个cmdlet的输入,让多个cmdlet协同操作同一数据。这是使PowerShell成为Windows配置强大工具的基本变革。
273. What does PowerShell do?
PowerShell是做什么的?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: powershell, windows;标签: interviewbit, powershell, topic-specific, windows)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c1d58d557c902bb7797 | 官方: 否 | 付费: 否
答案:
Microsoft created PowerShell to make system tasks automatic, like batch processing, to build system management mechanisms for generally implemented processes. The PowerShell language is quite similar to Perl and delivers different ways to automate tasks: - One way is with cmdlets, which are miniature in nature .NET classes emerge as system commands;
微软创建PowerShell是为了自动化系统任务,如批处理,并为普遍实施的流程构建系统管理机制。PowerShell语言与Perl相当相似,并提供了多种自动化任务的方式: - 一种方式是通过cmdlet,它们是轻量级的.NET类,以系统命令的形式出现;
- Another way is with scripts, these are an amalgamation of cmdlets and associated logic;
- It can be done with executables, these are stand-alone mechanisms
Also with the embodiment of standard .NET classes.
Admins can employ PowerShell to manage a broad range of activities like it can pull information on Operating Systems, as the particular version and service pack levels. "PowerShell providers" are programs that enable data included in specialized data stocks available at the command line. Those data stores contain Windows file system drives. PowerShell also acts as the substitute for Microsoft's Command Prompt, which goes way back to DOS. For example, Microsoft turned PowerShell the default command-line interface (CLI) for Windows 10 as of build 14791. PowerShell's function as a command-line shell is how most consumers become familiarized with the technology.管理员可以使用PowerShell管理广泛的活动,比如它可以获取操作系统信息,如特定版本和服务包级别。“PowerShell提供程序”是使命令行中可用的特殊数据存储中的数据结构得以访问的程序。这些数据存储包括Windows文件系统驱动器。PowerShell还充当微软命令提示符的替代品,后者可追溯至DOS时代。例如,微软自版本14791起将PowerShell设为Windows 10的默认命令行界面(CLI)。PowerShell作为命令行外壳的功能正是大多数用户熟悉该技术的方式。
274. How do you implement a semaphore in an operating system?
如何在操作系统中实现信号量?
- 知识点: 操作系统与网络 (标签: interviewbit, publicis-sapient, company-specific)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: general
- 公司: Publicis Sapient
- id: 69b37c2058d557c902bb7a32 | 官方: 否 | 付费: 否
答案:
A semaphore is a synchronization object that is used to control access to a shared resource in a multi-threaded program. A semaphore has a count value that is incremented or decremented to indicate the availability of the shared resource. When a thread acquires a semaphore, the count value is decremented, and when the semaphore is released, the count value is incremented.
信号量是一种同步对象,用于控制多线程程序中对共享资源的访问。信号量有一个计数值,通过递增或递减来表示共享资源的可用性。当线程获取信号量时,计数值递减;当信号量被释放时,计数值递增。
To implement a semaphore in an operating system, you can use a variety of techniques, depending on the specific needs of your program. Some common approaches include:
要在操作系统中实现信号量,您可以根据程序的具体需求使用多种技术。一些常见方法包括:
Using a lock variable: One way to implement a semaphore is to use a lock variable that is set to "locked" when the semaphore is acquired, and "unlocked" when the semaphore is released. When a thread attempts to acquire the semaphore, it can check the value of the lock variable and block if it is set to "locked". This approach is simple, but may not be suitable for multi-processor systems.
- 使用锁变量:实现信号量的一种方法是使用锁变量,当信号量被获取时设置为“锁定”,当信号量被释放时设置为“解锁”。当线程尝试获取信号量时,它可以检查锁变量的值,如果设置为“锁定”则阻塞。这种方法简单,但可能不适用于多处理器系统。
Using a lock variable to implement a semaphore is not the correct approach because it does not provide the necessary functionality for allowing multiple threads to access a shared resource. A lock variable only allows one thread to acquire the lock at a time, which would defeat the purpose of using a semaphore to coordinate access to a shared resource.
使用锁变量来实现信号量不是正确的方法,因为它不提供允许多个线程访问共享资源所必需的功能。锁变量只允许一次一个线程获取锁,这将违背使用信号量来协调对共享资源访问的目的。
Instead, a semaphore should use a counter variable that is incremented or decremented to indicate the availability of the shared resource. The counter variable should be initialized to the maximum number of threads that can access the resource simultaneously. When a thread wants to access the shared resource, it attempts to acquire the semaphore by decrementing the counter. If the counter is greater than zero, the thread can access the resource. If the counter is zero, the thread must block until another thread releases the semaphore by incrementing the counter.
相反,信号量应使用计数器变量,通过递增或递减来表示共享资源的可用性。计数器变量应初始化为可同时访问资源的最大线程数。当线程想要访问共享资源时,它尝试通过递减计数器来获取信号量。如果计数器大于零,线程可以访问资源。如果计数器为零,线程必须阻塞,直到另一个线程通过递增计数器释放信号量。
This approach allows multiple threads to access the shared resource simultaneously, up to the maximum number specified by the counter variable. It also ensures that threads are blocked when the shared resource is unavailable and unblocked when it becomes available, allowing for efficient coordination of access to the resource. - Using a kernel semaphore: Some operating systems provide kernel-level semaphores, which are implemented using low-level synchronization mechanisms such as atomic operations or hardware locks. Kernel semaphores can be more efficient than user-level semaphores, but are more difficult to use and may have stricter restrictions on their usage.
这种方法允许多个线程同时访问共享资源,最多达到计数器变量指定的最大数量。它还确保在共享资源不可用时线程被阻塞,在资源可用时被解除阻塞,从而实现对资源访问的高效协调。- 使用内核信号量:一些操作系统提供内核级信号量,它们是使用低级同步机制(如原子操作或硬件锁)实现的。内核信号量可能比用户级信号量更高效,但使用起来更困难,并且对其使用可能有更严格的限制。
Using a mutex and a condition variable: A mutex (short for "mutual exclusion") is a synchronization object that is used to protect shared resources from concurrent access, while a condition variable is a synchronization object that is used to signal the occurrence of a particular condition. Together, a mutex and a condition variable can be used to implement a semaphore by using the mutex to protect the count value and the condition variable to signal changes in the count value.
There are several different ways to implement a semaphore in an operating system, and the best approach depends on the specific needs of your program. Regardless of the technique you choose, it is important to ensure that your semaphore implementation is thread-safe and provides the necessary synchronization to control access to the shared resource.在操作系统中有几种不同的方法来实现信号量,最佳方法取决于程序的具体需求。无论您选择哪种技术,重要的是确保您的信号量实现是线程安全的,并提供必要的同步来控制对共享资源的访问。
275. How do you implement a mutex in an operating system?
如何在操作系统中实现互斥锁?
- 知识点: 操作系统与网络 (标签: interviewbit, publicis-sapient, company-specific)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: general
- 公司: Publicis Sapient
- id: 69b37c2058d557c902bb7a35 | 官方: 否 | 付费: 否
答案:
A mutex (short for "mutual exclusion") is a synchronization object that is used to protect shared resources from concurrent access in a multi-threaded program. When a thread acquires a mutex, it prevents other threads from accessing the shared resource until the mutex is released.
互斥锁(“mutual exclusion”的缩写)是一种同步对象,用于保护多线程程序中的共享资源免受并发访问。当线程获取互斥锁时,它会阻止其他线程访问共享资源,直到互斥锁被释放。
To implement a mutex in an operating system, you can use a variety of techniques, depending on the specific needs of your program. Some common approaches include:
要在操作系统中实现互斥锁,您可以根据程序的具体需求使用多种技术。一些常见方法包括:
Using a lock variable: One way to implement a mutex is to use a lock variable that is set to "locked" when the mutex is acquired, and "unlocked" when the mutex is released. When a thread attempts to acquire the mutex, it can check the value of the lock variable and block if it is set to "locked". This approach is simple, but may not be suitable for multi-processor systems. 2. Using a semaphore: Another way to implement a mutex is to use a semaphore, which is a synchronization object that controls access to a shared resource. A semaphore can be used to implement a mutex by setting the value of the semaphore to 1, and using the "wait" and "signal" operations to acquire and release the mutex. 3. Using a spinlock: A spinlock is a type of mutex that continuously spins in a loop, checking the status of the mutex, until it can acquire the mutex. This approach can be efficient but can consume a lot of CPU time if the mutex is held for a long time. 4. Using a kernel mutex: Some operating systems provide kernel-level mutexes, which are implemented using low-level synchronization mechanisms such as atomic operations or hardware locks. Kernel mutexes can be more efficient than user-level mutexes, but are more difficult to use and may have stricter restrictions on their usage.
- 使用锁变量:实现互斥锁的一种方法是使用锁变量,当互斥锁被获取时设置为“锁定”,当互斥锁被释放时设置为“解锁”。当线程尝试获取互斥锁时,它可以检查锁变量的值,如果设置为“锁定”则阻塞。这种方法简单,但可能不适用于多处理器系统。 2. 使用信号量:实现互斥锁的另一种方法是使用信号量,它是一种控制对共享资源访问的同步对象。可以通过将信号量的值设置为1,并使用“wait”和“signal”操作来获取和释放互斥锁,从而使用信号量实现互斥锁。 3. 使用自旋锁:自旋锁是一种互斥锁,它在循环中不断自旋,检查互斥锁的状态,直到能够获取互斥锁。这种方法可能高效,但如果互斥锁被长时间持有,可能会消耗大量CPU时间。 4. 使用内核互斥锁:一些操作系统提供内核级互斥锁,它们是使用低级同步机制(如原子操作或硬件锁)实现的。内核互斥锁可能比用户级互斥锁更高效,但使用起来更困难,并且对其使用可能有更严格的限制。
There are several different ways to implement a mutex in an operating system, and the best approach depends on the specific needs of your program. Regardless of the technique you choose, it is important to ensure that your mutex implementation is thread-safe and provides the necessary synchronization to protect shared resources.
在操作系统中实现互斥锁有几种不同的方法,最佳方法取决于程序的具体需求。无论您选择哪种技术,重要的是确保您的互斥锁实现是线程安全的,并提供必要的同步来保护共享资源。
276. What is the best way to run a script in the background?
在后台运行脚本的最佳方式是什么?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc7495 | 官方: 否 | 付费: 否
答案:
For a script to run in the background, simply add "&" at the end of the command.
要在后台运行脚本,只需在命令末尾添加“&”即可。
Example:
示例:
script.sh &
script.sh &
command &
command &
277. What is the use of the "$?" command?
“$?”命令有什么用?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc7498 | 官方: 否 | 付费: 否
答案:
By using the command "$?", you can find out the status of the last command executed.
使用“$?”命令,你可以查看最后执行命令的状态。
278. How to check whether a link is a hard one or a soft link?
如何检查链接是硬链接还是软链接?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc749b | 官方: 否 | 付费: 否
答案:
We can use -h and -L operators of the test command to check whether a link is hard or soft (symbolic link). - -h file //true if the file is a symbolic link
我们可以使用test命令的-h和-L运算符来检查链接是硬链接还是软(符号)链接。 - -h file //若文件是符号链接则返回真
-L file //true if the file is a symbolic link
One can also use:还可以使用:
readlink FILE; echo $? // This returns 1 if it's a hard link and 0 if it's a symbolic link.
readlink FILE; echo $? // 如果是硬链接则返回1,如果是符号链接则返回0。
279. Why is a shell script needed?
为什么需要 shell 脚本?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc749e | 官方: 否 | 付费: 否
答案:
Shell scripts can be written for a variety of reasons: - Keeping repetitive tasks to a minimum.
编写 shell 脚本的原因多种多样:- 将重复性任务降至最低。
- Can be used by system administrators for routine backups.
- Monitoring the system.
- Adding new functions to the shell.
- Shell scripting allows you to create your own tools.
- System admin can automate daily tasks.
280. Write some advantages of shell scripting.
写出 shell 脚本的一些优点。
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74a1 | 官方: 否 | 付费: 否
答案:
Shell scripting offers the following benefits: - An interactive debugging tool, as well as a quick start.
Shell 脚本提供以下好处:- 交互式调试工具,以及快速入门。
- Programmers need not change their syntax since both command and syntax are identical to those entered directly into the command line.
- Shell scripts are easy to use and quicker to write.
- It helps automate administrative tasks, so it is time-saving.
- As shell scripts are written in an interpreted language, they can be run without any additional effort on almost any modern operating system, including UNIX, Linux, BSD, and Mac OS X.
- They can be utilized for bulk execution rather than single instructions.
- Using it, you can develop your own custom operating system with relevant features.
- Software applications can be developed according to their respective platforms with this tool.
- Data Science
- All Events
- My Events
281. Write some limitations of shell scripting.
写出 shell 脚本的一些局限性。
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74a4 | 官方: 否 | 付费: 否
答案:
Shell scripting has the following disadvantages: - Errors are frequent and costly, and a single error can alter the command.
Shell 脚本具有以下缺点:- 错误频繁且代价高昂,一个错误可能改变命令。
- The execution speed is slow.
- Bugs or inadequacies in the language's syntax or implementation.
- Large, complex tasks aren't well suited to it.
- Contrary to other scripting languages, etc., it provides a minimal data structure.
- Every time a shell command is executed, a new process is launched.
282. Name the file in which shell programs are stored.
命名存储 shell 程序的文件。
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37c4f58d557c902bc74ab | 官方: 否 | 付费: 否
答案:
A file called sh stores shell programs. Sh files contain commands written in a scripting language that is run by Unix shells.
一个名为 sh 的文件存储 shell 程序。sh 文件包含用脚本语言编写的命令,这些命令由 Unix shell 运行。
283. Name different types of shells available.
命名可用的不同 shell 类型。
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74ae | 官方: 否 | 付费: 否
答案:
- Shells are divided into two categories:
Bourne shell: The $ character is the default prompt when using a Bourne-type shell.
Bourne shell:使用 Bourne 类型 shell 时,默认提示符是 $ 字符。
C shell: The % character is the default prompt when using a C-type shell.
C shell:使用 C 类型 shell 时,默认提示符是 % 字符。
The Bourne-type is subdivided into the following categories: - Bourne Again shell (BASH): This is the most common shell available on all Linux and based systems. It is open-source and freeware. In addition, it is an SH-compatible shell, with improved programming and interactive features over SH. It also allows you to efficiently perform many tasks.
Bourne 类型可细分为以下类别:- Bourne Again shell (BASH):这是所有 Linux 及基于 Linux 系统上最常见的 shell。它是开源且免费的。此外,它是一个与 SH 兼容的 shell,具有比 SH 改进的编程和交互功能。它还允许你高效地执行许多任务。
Korn shell (KSH): Korn is basically a Unix shell that was initially based on the Bash Shell Scripting. It's a high-level language that's quite advanced. It has associative arrays and handles the loop syntax better than Bash. It is basically an improved version of Bourne shell.
The C-type is subdivided into the following categories: - C shell (CSH): C shell is almost like C itself since it uses the shell syntax of the C programming language. In most cases, a command is executed either interactively from a terminal keyboard or from a file.C 类型可细分为以下类别:- C shell (CSH):C shell 几乎与 C 本身相似,因为它使用 C 编程语言的 shell 语法。在大多数情况下,命令要么从终端键盘交互式执行,要么从文件执行。
- TENEX/TOPS C shell (TCSH): TCSH does not have a specific full name. TCSH is considered as an enhanced version of the CSH as it includes some additional features over CSH like command-line editing and filename or command completion. As with the previous version, it supports C-style syntax also.
284. Write difference between Bourne Shell and C Shell.
写出 Bourne Shell 和 C Shell 之间的区别。
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74b1 | 官方: 否 | 付费: 否
答案:
- Bourne Shell: It has compactness and speed that set it apart from other shells. But it lacks interactive features such as the ability to recall previous commands. Additionally, the Bourne shell does not support arithmetic and logical expressions.
- C Shell: It is a UNIX enhancement that incorporates interactive features like aliases and history of commands. Besides its built-in arithmetic and expression syntax, it also includes convenient programming features.
Difference between Bourne shell and C shell
Bourne shell 和 C shell 之间的区别
- The C shell allows you to alias commands easily, whereas Bourne Shell does not allow this.
- In the C shell, long commands can be used repeatedly, but not in Bourne.
- Bourne does not have access to the command history, but the C shell does.
- In the case of C, there is no need to repeatedly type the command.
285. What do you mean by Shell variable?
你所说的 Shell 变量是什么意思?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74b4 | 官方: 否 | 付费: 否
答案:
Shell variables are integral parts of all Shell programs and scripts. In general, we know that variables usually store data either in the form of characters or numbers. Shell also stores and manipulates information using variables in its programs. Generally, shell variables are stored as strings. Variables in the shell provide the information needed for scripts/commands to execute. In the following example, a shell variable is created and then printed: variable ="Hello" echo $variable
外壳变量是所有外壳程序和脚本的组成部分。通常,我们知道变量通常以字符或数字的形式存储数据。外壳也使用变量来存储和操作其程序中的信息。一般来说,外壳变量以字符串形式存储。外壳中的变量提供脚本/命令执行所需的信息。在以下示例中,创建了一个外壳变量并打印出来:variable ="Hello" echo $variable
286. What are different types of variables mostly used in shell scripting?
外壳脚本中主要使用的变量类型有哪些不同?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74b7 | 官方: 否 | 付费: 否
答案:
Shell scripts usually have two types of variables: - System-defined variables: Also called environment variables, these are special built-in variables in the Linux kernel for each shell. They are normally defined in capital letters by the OS (Linux) and are standard variables.Example: SHELL It is a Unix Defined or System Variable, which specifies the default working shell.
外壳脚本通常有两种变量类型:- 系统定义变量:也称为环境变量,这些是Linux内核中为每个外壳提供的特殊内置变量。它们通常由操作系统(Linux)以大写字母定义,并且是标准变量。示例:SHELL 它是一个Unix定义或系统变量,指定默认的工作外壳。
- User-defined variables: These variables are created and defined by users in order to store, access, read, and manipulate data. In general, they are defined in lowercase letters. The Echo command allows you to view them.Example: $ a=10 In this case, the user has defined the variable ‘a’ and assigned it the value 10.
287. Explain the term positional parameters.
解释术语位置参数。
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74ba | 官方: 否 | 付费: 否
答案:
In a shell program, positional parameters specify arguments that are used to launch the current process. A special set of variables is usually maintained by the shell for storing positional parameter values. Bash is an example of a shell that uses positional parameters. The bash shell can be used on Linux, BSD, macOS X, and Windows 10.
在外壳程序中,位置参数指定用于启动当前进程的参数。外壳通常会维护一组特殊的变量来存储位置参数值。Bash 是使用位置参数的外壳之一。Bash 外壳可用于Linux、BSD、macOS X 和 Windows 10。
For example:
例如:
mycommand one five "six four”
mycommand one five "six four”
In this case, the command name is mycommand, and there are four parameters in the command line: one, five, and "six four”.
在这种情况下,命令名称是mycommand,命令行中有四个参数:one、five 和 "six four”。
Note: A space delimits each positional parameter and each thing after spaces are interpreted by the shell as individual parameters. Therefore, the parameter itself should be enclosed in quotation marks if it contains a space, as in "six four".
注意:每个位置参数由空格分隔,空格后的每个内容被外壳解释为单独的参数。因此,如果参数本身包含空格,则应将其括在引号中,如"six four"。
Successful Tech Career for FREE!
免费开启成功的科技职业生涯!
Successful Tech Career!
成功的技术职业生涯!
Interview Process
面试流程
CTC & Designation
CTC与职位级别
Projects on the Job
工作项目
Referral System
推荐系统
Try It Out
试试看
2 Lakh+ Roadmaps Created
已生成20万+职业规划
288. What are control instructions?
什么是控制指令?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74bd | 官方: 否 | 付费: 否
答案:
Control instructions specify how the different instructions will be executed in the script. They are primarily used to determine the control flow in Shell programs. The execution of a shell script proceeds in succession without these instructions. In shell programs, control instructions govern how execution flows.
控制指令指定脚本中不同指令将如何执行。它们主要用于确定外壳程序中的控制流。没有这些指令,外壳脚本的执行将按顺序进行。在外壳程序中,控制指令控制执行的流程。
289. How many types of control instructions are available in a shell?
外壳中有多少种类型的控制指令?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74c0 | 官方: 否 | 付费: 否
答案:
Shells provide four types of control instructions as given below: - Sequence Control Instruction: This assures that a program's command runs in the sequence they are listed. As soon as the first command in the sequence has been completed, the second command follows, and so on.
外壳提供四种类型的控制指令,如下所示:- 顺序控制指令:这确保程序的命令按其列出的顺序运行。一旦序列中的第一个命令完成,第二个命令就会跟上,以此类推。
- Decision Control Instruction: It is also known as Selection Control Instruction. This instructs the computer which instruction it should execute next. In this, checking a condition is the basis for deciding which section to execute. If a given condition is True, a statement or set of statements will be executed; otherwise, they will be ignored.
- Loop Control Instruction: It is also known as Repetition Instruction. This instruction allows a computer to continuously run a particular sequence of code. In a loop structure, the statements can be repeated until a condition is True or False, a particular number of times, or once for each element within the collection
- Case-Control Instruction: This is used for selecting among several choices. Typically, they are used to execute only a particular block of statements within a series of statements.
290. Explain ways to create shortcuts in Linux.
解释在Linux中创建快捷方式的方法。
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74c3 | 官方: 否 | 付费: 否
答案:
Links present in Linux OS can be used to create shortcuts as given below: - Hard Link: Hard links are mirror images of the originally linked files and are linked with an inode number. A hard-linked file remains even after the original file is deleted. Since hard links point to inodes, they cannot be implemented on directories. Hard links are created by the following command:
Linux操作系统中存在的链接可用于创建快捷方式,如下所示:- 硬链接:硬链接是原始链接文件的镜像,并与inode编号相关联。即使原始文件被删除,硬链接的文件仍然存在。由于硬链接指向inode,它们不能在目录上实现。硬链接通过以下命令创建:
$ ln [original filename] [link name]
- Soft Link: Generally, soft links (also referred to as Symbolic links) are linked to the file name and can reside on the same as well as different file systems. When a soft link is created or deleted, it does not affect the original file, but when the original file is deleted, the soft link stops working. Typically, soft links are aliases (alternative paths) for the original file. Soft links are created by the following command:
$ ln -s [original filename] [link name]
291. What is Shell?
什么是外壳?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74c6 | 官方: 否 | 付费: 否
答案:
A Shell is basically a command-line interpreter between user and kernel or a complete environment specially designed to run commands, shell scripts, and programs. In this, whenever a user enters human-readable commands (input commands) through the keyboard, the shell communicates with the kernel to execute these commands, and display output in a shell script. Just as there are different flavors of operating systems, there are also different types of shells. Every shell has its own set of commands and functions. Shells issue the prompt, $, called a command prompt. You can type into the prompt while it is displayed.
外壳基本上是用户与内核之间的命令行解释器,或者是一个专门设计用于运行命令、外壳脚本和程序的完整环境。在此环境中,每当用户通过键盘输入人类可读的命令(输入命令)时,外壳与内核通信以执行这些命令,并在外壳脚本中显示输出。正如操作系统有不同的风格一样,也有不同类型的外壳。每个外壳都有自己的一套命令和函数。外壳发出提示符$,称为命令提示符。在提示符显示时,您可以输入内容。
After you press enter, your input is read by the shell. Based on the first word of your input, it determines the command you want to run. The characters in a word are separated using spaces and tabs.
按回车键后,你的输入会被 shell 读取。根据输入的第一个单词,它确定你要运行的命令。单词中的字符使用空格和制表符分隔。
Example:
示例:
Here is an example of a date command that displays the current date and time:
下面是一个日期命令的示例,它显示当前日期和时间:
$date Tue Aug 10 06:03:35 MST 2021
$date Tue Aug 10 06:03:35 MST 2021
292. Write difference between Hard link and Soft Link.
写出硬链接和软链接之间的区别。
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74c9 | 官方: 否 | 付费: 否
答案:
| Hard Link 硬链接 | Soft Link 软链接 |
|---|---|
| Hard-linked files have the same inode number. 硬链接文件具有相同的 inode 号。 | Soft-linked files have different inode numbers. 软链接文件具有不同的 inode 号。 |
| Despite deleting the target file, it remains valid. 尽管删除目标文件,它仍然有效。 | When an original file is deleted, it becomes invalid. 当原始文件被删除时,它会变得无效。 |
| Hard links are faster than soft links. 硬链接比软链接快。 | Soft links are slower than hard links. 软链接比硬链接慢。 |
| The command used for creating a hard link in Linux is "ln". 在 Linux 中用于创建硬链接的命令是 "ln"。 | The command used for creating a soft link in Linux is “ln -s”. 在 Linux 中用于创建软链接的命令是 “ln -s”。 |
| There is no way to use it across file systems. 无法跨文件系统使用它。 | You can use it on any file system. 你可以在任何文件系统上使用它。 |
| Hard links cannot use relative paths. 硬链接不能使用相对路径。 | Both absolute and relative paths can be used in soft links. 绝对路径和相对路径都可以在软链接中使用。 |
293. What do you mean by GUI Scripting?
你说的 GUI 脚本是什么意思?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74cc | 官方: 否 | 付费: 否
答案:
The GUI (Graphical User Interface) is a client/server interface that uses graphical icons and visual indicators to allow users to interact with devices. Specifically, it is used to control a computer and its applications. A wide variety of applications are supported, and it is largely dependent on the operating system.
GUI(图形用户界面)是一种客户端/服务器接口,使用图形图标和视觉指示器允许用户与设备交互。具体来说,它用于控制计算机及其应用程序。支持各种应用程序,并且它在很大程度上依赖于操作系统。
294. What is the shebang line in shell scripting?
在 shell 脚本中,shebang 行是什么?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74cf | 官方: 否 | 付费: 否
答案:
Shell scripts or programs often contain shebang at the top. In general, the Shebang (the series of characters "#!") is used to indicate the operating system to use a particular interpreter to process the rest of the file. Here, the symbol '#' is referred to as hash, and "!" is referred to as bang. This usually aids developers in avoiding repetitive work. Scripts are generally executed by the engine; therefore, shebang determines the location of the engine that will be used to run the script.
Shell 脚本或程序通常在顶部包含 shebang。一般来说,Shebang(字符序列 "#!")用于指示操作系统使用特定的解释器来处理文件的其余部分。这里,符号 '#' 被称为 hash(井号),"!" 被称为 bang(感叹号)。这通常有助于开发者避免重复工作。脚本通常由引擎执行;因此,shebang 确定了用于运行脚本的引擎位置。
Example:
示例:
!/bin/bash
In addition, this line also specifies which shell to use.
此外,这一行还指定了使用哪个 shell。
295. What is a file system? Write down the four core components of a Linux file system.
什么是文件系统?写出 Linux 文件系统的四个核心组件。
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74d2 | 官方: 否 | 付费: 否
答案:
Generally, file systems are referred to as the collections of files, which include information related to those files. It would be impossible to tell where one piece of data stops and the next begins without a file system. There are four blocks in a file system: - Super Block: A superblock contains information about a file system, including block size, group size, usage statistics, empty/filled blocks, inode table size & location, and so on. One of the tools used to describe a file system, along with inodes, entries, and files, is the superblock. Multiple superblocks are created with the file system, as the superblock contains critical information.
通常,文件系统被称为文件的集合,其中包含与这些文件相关的信息。没有文件系统,就不可能知道一段数据在哪里结束,下一段从哪里开始。文件系统中有四个块:- 超级块:超级块包含关于文件系统的信息,包括块大小、组大小、使用统计、空/已填充块、inode 表大小和位置等。用于描述文件系统(连同 inode、目录项和文件)的工具之一是超级块。由于超级块包含关键信息,文件系统会创建多个超级块。
- Boot Block: Located on the disk label, a boot block is a special set of blocks that contains data or information on the disk layout. Normally, this block contains the bootstrap loader program, which a user runs upon launching the host computer. The boot block remains blank if the file system is not used for boot.
- Data Block: Also called storage blocks, data blocks contain the remainder of the space allocated to the file system. The data block's size is measured at the time of file system creation. For a regular file, the content of files is contained in the data blocks. For directories, the inode number and file name of the files are contained in the data blocks.
- Inode: Inodes contain information about each file in the filesystem. Normally, an inode doesn't contain a file's name, which is located in a directory instead. An inode contains information such as the type of file, the permission bits, the owner, the group, the file size, and the time when the file was modified.
296. Name the alternative command for echo.
说出 echo 的替代命令。
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74d5 | 官方: 否 | 付费: 否
答案:
The tput command is an alternative command for echo. We can use this command to control how the output is displayed. Additionally, shell scripts can do things such as underline text and center text, regardless of the size of the screen.
tput 命令是 echo 的替代命令。我们可以使用这个命令来控制输出的显示方式。此外,shell 脚本可以做诸如给文本加下划线和居中文本之类的事情,无论屏幕大小如何。
297. Explain the way you can connect to a database server.
解释你如何连接到数据库服务器。
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74d8 | 官方: 否 | 付费: 否
答案:
Open client driver comes with the isql utility that can be used to connect to a database server from Linux. Here's how to do it:
开放客户端驱动程序自带 isql 实用程序,可用于从 Linux 连接到数据库服务器。操作方法如下:
isql –S serverName –U username –P password
isql –S serverName –U username –P password
298. What is the importance of $#?
$#的重要性是什么?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74dc | 官方: 否 | 付费: 否
答案:
$# usually holds the number of arguments, although it may be different for functions. To put it simply, it was used to store the number of command-line arguments passed to a shell script.
$#通常保存参数的个数,尽管对函数而言可能有所不同。简而言之,它用于存储传递给shell脚本的命令行参数数量。
299. Write the command that is used to execute a shell file.
写出用于执行shell文件的命令。
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74e1 | 官方: 否 | 付费: 否
答案:
Firstly, use the chmod command to set execute permission on your script as shown below:
首先,使用chmod命令为你的脚本设置执行权限,如下所示:
chmod +x script-name-here.sh
chmod +x script-name-here.sh
Secondly, run or execute your script as follows:
其次,按如下方式运行或执行你的脚本:
. /script-name-here.sh
. /script-name-here.sh
Alternatively, you can execute shell script by:
或者,你也可以通过以下方式执行shell脚本:
sh script-name-here.sh
sh script-name-here.sh
300. Name the command that can be used to find out the number of arguments passed to the script?
说出可用于查找传递给脚本的参数个数的命令是什么?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74e4 | 官方: 否 | 付费: 否
答案:
The following command will display the number of arguments passed to the script: echo $ #
以下命令将显示传递给脚本的参数个数:echo $#
301. How long does a variable in a shell script last?
shell脚本中的变量能持续多久?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74e7 | 官方: 否 | 付费: 否
答案:
Variables inside shell scripts have a lifespan of only as long as the execution lasts.
shell脚本中的变量仅在脚本执行期间存在。
302. What does the . (dot) indicate at the beginning of the file name? How can it be listed?
文件名开头的.(点)表示什么?如何列出这类文件?
- 知识点: 操作系统与网络 (主题: shell, linux, scripting;标签: interviewbit, shell-scripting, topic-specific, shell, linux, scripting)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c4f58d557c902bc74ea | 官方: 否 | 付费: 否
答案:
If the file name begins with ".", it is a hidden file. When a dot appears at the beginning of a filename, the file is hidden in most file managers and shell programs. A Shell usually lists all the files except hidden files when you try to list the files in a shell. Despite this, hidden files can be found in the directory. The Is command must be run with the "–a" flag if you wish to see hidden files.
如果文件名以“.”开头,则它是一个隐藏文件。当点出现在文件名开头时,该文件在大多数文件管理器和shell程序中是隐藏的。当你在shell中尝试列出文件时,shell通常只列出除隐藏文件以外的所有文件。尽管如此,隐藏文件仍存在于目录中。如果你想查看隐藏文件,必须使用带“–a”标志的ls命令来运行。
303. What are system calls?
什么是系统调用?
- 知识点: 操作系统与网络 (标签: interviewbit, siemens, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Siemens
- id: 69b37c5158d557c902bc75cd | 官方: 否 | 付费: 否
答案:
A system call is a method through which a computer programme asks a service from the kernel of the operating system on which it is running. A system call is a method of interacting with the operating system via programmes. When a computer software makes a request to the kernel of the operating system, it is called a system call. The operating system's services are provided to user programmes via the Application Program Interface (API). It acts as a link between a process and the operating system, allowing user-level programmes to request operating system services. The kernel system can only be accessed using system calls. System calls are required for any programmes that use resources.
系统调用是计算机程序向其运行所在的操作系统内核请求服务的一种方法。系统调用是一种通过程序与操作系统交互的方法。当计算机软件向操作系统内核发出请求时,就称为系统调用。操作系统的服务通过应用程序接口 (API) 提供给用户程序。它充当进程和操作系统之间的链接,允许用户级程序请求操作系统服务。内核系统只能通过系统调用来访问。任何使用资源的程序都需要系统调用。
304. Explain the Unix kernel.
解释 Unix 内核。
- 知识点: 操作系统与网络 (标签: interviewbit, siemens, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Siemens
- id: 69b37c5158d557c902bc75db | 官方: 否 | 付费: 否
答案:
The operating system's central core is the UNIX kernel. It connects to the hardware devices, as well as to the processor, memory, and I/O management. Users' requests are managed by the kernel using system calls that move the process from user space to kernel space.
操作系统的核心是 UNIX 内核。它连接到硬件设备,以及处理器、内存和 I/O 管理。用户请求由内核通过系统调用进行管理,这些系统调用将进程从用户空间移动到内核空间。
A context switch occurs every time a user process performs a system call, such as read(), fork(), exec(), open(), and so on. A context switch is a mechanism that allows a process to change its state. The process can either be blocked until the system call is completed, or it can continue and be told of the completion of the system call via a signal (nonblocking).
每当用户进程执行系统调用(例如 read()、fork()、exec()、open() 等)时,都会发生上下文切换。上下文切换是一种允许进程改变其状态的机制。进程可以被阻塞直到系统调用完成,或者它可以继续运行并通过信号(非阻塞)被告知系统调用已完成。
305. What is a virtual memory?
什么是虚拟内存?
- 知识点: 操作系统与网络 (标签: interviewbit, siemens, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Siemens
- id: 69b37c5158d557c902bc75e1 | 官方: 否 | 付费: 否
答案:
A segment of memory that is produced momentarily on the storage device is referred to as virtual memory. It occurs when a computer's RAM gets depleted as a result of multiple processes executing at the same time.
在存储设备上临时产生的一部分内存被称为虚拟内存。当计算机的 RAM 因同时执行多个进程而耗尽时,就会发生这种情况。
A part of the storage disc is made accessible for usage as RAM by the operating system. Because processor power is consumed by moving data around rather than performing instructions, virtual memory is substantially slower than main memory. The operating systems guide shows how the operating system handles memory. When the computer needs to use virtual memory, latency increases. The operating system employs swapping to transport data between RAM and virtual memory. Data from processes that aren't in use right now is moved out of RAM and stored in virtual memory by the operating system. When the process is needed again, it copies the data back into RAM.
操作系统将存储磁盘的一部分设为可用作 RAM。由于处理器能力消耗在来回移动数据而不是执行指令上,虚拟内存比主内存慢得多。操作系统指南展示了操作系统如何处理内存。当计算机需要使用虚拟内存时,延迟会增加。操作系统采用交换技术在 RAM 和虚拟内存之间传输数据。当前未使用的进程的数据被操作系统移出 RAM 并存储在虚拟内存中。当再次需要该进程时,它会将数据复制回 RAM。
As transferring to a hard disc takes far longer than reading and writing RAM, using virtual memory slows down the machine.
由于传输到硬盘所需的时间远长于读写 RAM,因此使用虚拟内存会降低机器的速度。
306. What is DNS? How does it operate on an internal network?
什么是DNS?它如何在内网中运作?
- 知识点: 操作系统与网络 (主题: system-engineer;标签: interviewbit, system-engineer, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c6758d557c902bc8312 | 官方: 否 | 付费: 否
答案:
DNS stands for Domain Name System. It is the Internet's phone book. On the internet, humans access information by using domain names, such as scaler.com or interviewbit.com. Internet Protocol (IP) addresses are used by web browsers to interact with websites. A domain name is translated to an IP address (such as 152.178.1.1) by DNS, and the browser requests that IP address from the DNS server to make a connection and access the internet resources. In a nutshell, DNS is a network service that allows connections to be made to local or internet addresses using domain names rather than IP addresses.
DNS代表域名系统。它是互联网的电话簿。在互联网上,人们通过使用域名(如scaler.com或interviewbit.com)来访问信息。网页浏览器使用互联网协议(IP)地址与网站交互。域名通过DNS被转换为IP地址(如152.178.1.1),然后浏览器向DNS服务器请求该IP地址以建立连接并访问互联网资源。简而言之,DNS是一种网络服务,允许使用域名而非IP地址来建立到本地或互联网地址的连接。
307. What is Socket Programming? What Are The Benefits And Drawbacks Of Java Sockets?
什么是套接字编程?Java 套接字的优点和缺点是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (标签: interviewbit, tcs, company-specific)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: general
- 公司: Tata Consultancy Services
- id: 69b37c6a58d557c902bc84e0 | 官方: 否 | 付费: 否
答案:
Socket programming is a method of allowing two network nodes to communicate with each other. One socket (node) listens on a specific port at an IP address, while the other socket connects with it. While the client connects to the server, the server creates the listener socket.
套接字编程是一种允许两个网络节点相互通信的方法。一个套接字(节点)在某个IP地址的特定端口上监听,而另一个套接字则与它连接。当客户端连接到服务器时,服务器会创建监听套接字。
Java Socket Benefits: - Sockets are adaptable and adequate. For general communications, efficient socket-based programming is simple to build.
Java套接字的优点:- 套接字适应性强且功能充足。对于一般通信,基于套接字的高效编程易于构建。
Low network traffic is caused by sockets. Unlike HTML forms and CGI scripts, which construct and send entire web pages for each new request, Java applets can simply send the information that has changed.
Java Socket Drawbacks: - Because a Java applet running in a Web browser can only connect to the machine from which it originated and nowhere else on the network, security restrictions can be oppressive at times.Java套接字的缺点:- 因为Web浏览器中运行的Java小程序只能连接到其来源机器,而不能连接到网络上的其他任何地方,所以安全限制有时可能令人感到束缚。
- Despite all of Java's beneficial capabilities, Socket-based connections merely allow for the transmission of raw data packets between programs. Both the client and the server must provide ways for making the data valuable in some way.
- Because data formats and protocols are application-specific, the re-use of socket-based systems is limited.
308. What is the tunnel mode in networking?
网络中的隧道模式是什么?
- 知识点: 操作系统与网络 (标签: interviewbit, tcs, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Tata Consultancy Services
- id: 69b37c6a58d557c902bc84fe | 官方: 否 | 付费: 否
答案:
Tunnel Mode is a way of transmitting data over the Internet that encrypts both the contents and the original IP address information. It secures communications between security gateways, firewalls, and other devices in a Site-to-Site VPN. In Transport Mode or Tunnel Mode, the Encapsulating Security Payload (ESP) is used. ESP encrypts the data and the IP header information in Tunnel Mode.
隧道模式是一种通过互联网传输数据的方式,它同时加密数据内容和原始IP地址信息。它保护了站点到站点VPN中安全网关、防火墙和其他设备之间的通信。在传输模式或隧道模式中,使用了封装安全载荷(ESP)。在隧道模式下,ESP加密数据和IP头信息。
309. Explain the TCP/IP model?
解释TCP/IP模型?
- 知识点: 操作系统与网络 (标签: interviewbit, tcs-ninja, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Tata Consultancy Services
- id: 69b37c7258d557c902bc8860 | 官方: 否 | 付费: 否
答案:
TCP/IP stands for Transmission Control Protocol/Internet Protocol. It assists us in figuring out the best way to connect a particular computer to the internet and the best way to transfer data between them. When several computer networks are linked together, we can more easily establish a virtual network. To enable communication across large distances, the TCP/IP protocol was created.
TCP/IP代表传输控制协议/互联网协议。它帮助我们发现将特定计算机连接到互联网的最佳方式以及它们之间传输数据的最佳方式。当多个计算机网络连接在一起时,我们可以更容易地建立一个虚拟网络。为了支持远距离通信,创建了TCP/IP协议。
It is a connection-oriented protocol.
它是一种面向连接的协议。
Layers in the TCP/IP model: There are four layers in the TCP model: - Application Layer: It manages the standards for user interfaces and is responsible for node-to-node communication.
TCP/IP模型中的层:TCP模型中有四层:- 应用层:它管理用户界面的标准,并负责节点到节点的通信。
- Transport Layer: It is in charge of ensuring a seamless end-to-end connection and error-free data transfer.
- Internet Layer: It specifies the protocols that control the logical transmission of data throughout the whole network.
- Network Access Layer: The protocols available in this layer enable the physical transport of data while keeping an eye out for hardware addressing.
310. What is TCP/IP Protocol?
什么是TCP/IP协议?
- 知识点: 操作系统与网络 (标签: interviewbit, tcs-nqt, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Tata Consultancy Services
- id: 69b37c7458d557c902bc894d | 官方: 否 | 付费: 否
答案:
TCP stands for Transfer Control Protocol. The TCP is a connection-oriented protocol implemented at the Transport Layer of the OSI Model. TCP is responsible for breaking the data into the form of small frames called framing and later, at the receiver end, it also reassembles the frames back into the sequence to get the data back.
TCP代表传输控制协议。TCP是一种实现于OSI模型传输层的面向连接协议。TCP负责将数据分解成称为帧的小单元,然后在接收端,它再将帧重新组装成序列以恢复数据。
IP stands for Internet Protocol. It is present at the Network Layer of the OSI model. IP is not reliable and it is a connectionless model. IP is responsible for sending and receiving the data that is broken into the form of frames by the TCP. The IP is combined with TCP to form a reliable data sending-receiving Protocol.
IP代表互联网协议。它位于OSI模型的网络层。IP不可靠,是一种无连接模型。IP负责发送和接收由TCP分解成帧的数据。IP与TCP结合形成可靠的发送-接收数据协议。
311. What exactly is the Windows Recovery Environment (WRE)? How do you gain access to it?
Windows恢复环境(WRE)具体是什么?你如何访问它?
- 知识点: 操作系统与网络 (主题: technical-support;标签: interviewbit, technical-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c7958d557c902bc8bb7 | 官方: 否 | 付费: 否
答案:
Windows RE (Windows Recovery Environment) is a recovery environment. It's used to fix the most common causes of operating system failure. The Windows Recovery Environment (Windows RE) is centred on the Windows Pre-installation Environment (Windows PE) (Windows PE). Additional drivers, languages, Windows PE Optional Components, as well as other Troubleshooting and diagnostic tools, can all be simply added. Windows RE comes preinstalled in Windows 8.1, Windows 10, and Windows Server 2012 R2 installs by default.
Windows RE(Windows恢复环境)是一种恢复环境。它用于修复操作系统故障的最常见原因。Windows恢复环境(Windows RE)以Windows预安装环境(Windows PE)为核心。可以简单添加额外的驱动程序、语言、Windows PE可选组件,以及其他故障排除和诊断工具。Windows RE在Windows 8.1、Windows 10和Windows Server 2012 R2的默认安装中预装。
Using either of the following steps, we may simply access the Windows RE features from the Boot Options menu: - Select Start, Power, Shift, and Restart, then press down the Shift key.
使用以下任一方法,我们可以从启动选项菜单轻松访问Windows RE功能:- 选择“开始”、“电源”、“Shift”和“重启”,然后按住Shift键。
- Choose Start, Settings, Update and Security, Recovery from the Start menu. Now, select Restart from the "Advanced startup" menu.
- To accomplish this, open a command prompt and type shutdown /r /o.
312. Mention some common networking issues.
提一些常见的网络问题。
- 知识点: 操作系统与网络 (主题: troubleshooting;标签: interviewbit, troubleshooting, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c7f58d557c902bc8ebe | 官方: 否 | 付费: 否
答案:
Some common networking issues are: - Problem with the cable: The cable that connects two devices can become defective, shorter, or physically damaged.
一些常见的网络问题是:- 电缆问题:连接两个设备的电缆可能变得有缺陷、更短或物理损坏。
- Connectivity Issue: The port or interface to which the device is attached or configured may be physically down or malfunctioning, preventing communication between the source and destination hosts.
- Incorrect configurations: Network faults and service disruptions can occur as a result of incorrect configuration, IP looping, routing problems, and other configuration difficulties.
- Software Issue: The transmission of IP data packets between the source and destination is disrupted due to software compatibility difficulties and version mismatches.
- Traffic overload: When a network (or a portion of a network) or a network node is overburdened with data, this is known as network congestion. Every network has a limit on the amount of data it can manage. This capacity establishes a limit on how much bandwidth and traffic your network can handle before performance suffers.
- Network IP problems: The source will be unable to reach the target IP over the network due to poor configuration of IP addresses, subnet masks, and routing IP to the next hop.
313. In operating systems, define spooling.
在操作系统中,定义假脱机。
- 知识点: 操作系统与网络 (标签: interviewbit, uber, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: 优步
- id: 69b37c8258d557c902bc908e | 官方: 否 | 付费: 否
答案:
Spooling is the temporary storage of data so that it can be used and processed by a device, software, or system. Data is supplied to and stored in memory or other volatile storage until it is required by a programme or computer for execution. SPOOL is an abbreviation for "Simultaneous Peripheral Operations Online." The spool is typically stored in physical memory, buffers, or interrupts for Input/Output devices on the computer. To process the spool in ascending order, the FIFO (first in, first out) approach is employed. Spooling is the process of gathering data from a large number of Input/Output processes and storing it in a buffer. This buffer is a memory or hard disc area that Input/Output devices can access. In a distributed context, an operating system does the following: - Controls data spooling for Input/Output devices with varying data access rates.
假脱机是数据的临时存储,以便设备、软件或系统可以使用和处理这些数据。数据被提供给并存储在内存或其他易失性存储中,直到程序或计算机需要它执行。SPOOL是“同时进行外围在线操作”的缩写。假脱机数据通常存储在物理内存、缓冲区或用于计算机输入/输出设备的中断中。为了按升序处理假脱机数据,采用FIFO(先进先出)方法。假脱机是从大量输入/输出进程中收集数据并将其存储在缓冲区中的过程。该缓冲区是输入/输出设备可以访问的内存或硬盘区域。在分布式环境中,操作系统执行以下操作:- 控制数据访问速率不同的输入/输出设备的假脱机。
- Maintains the spooling buffer, which acts as a data holding space while the slower device catches up.
- The spooling procedure preserves parallel computing since a computer can perform Input/Output in parallel sequence. The computer can now read data from a tape, write data to disc, and print data to a tape printer all at the same time.
Printing is the most visible application of spooling. Before being added to the printing queue, the papers to be printed are held in the SPOOL. Several programmes can run and use the CPU during this period without having to wait for the printer to finish printing on each paper individually. Many additional features, such as defining priorities, receiving notifications when the printing process is complete, and selecting different types of paper to print on based on the user's preferences, can be added to the Spooling printing process.
打印是假脱机技术最直观的应用。在加入打印队列之前,待打印的文件被保存在SPOOL中。在此期间,多个程序可以运行并使用CPU,而不必等待打印机逐张完成打印。假脱机打印过程中还可以添加许多附加功能,例如定义优先级、在打印过程完成时接收通知,以及根据用户的偏好选择不同类型的纸张进行打印。
Useful Interview Resources
有用的面试资源
- Data Structures Interview Questions & Answers
- Algo Interview Questions
- Software Engineer Resume – Full Guide
- Technical Interview Questions: Complete List
314. Can you name the important standard streams in the UNIX shell scripting?
你能说出UNIX shell脚本中的重要标准流吗?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c8658d557c902bc9274 | 官方: 否 | 付费: 否
答案:
These are Standard Input, Standard Output as well as Standard Error.
这些是标准输入、标准输出以及标准错误。
315. Define a single-user system.
定义单用户系统。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c8658d557c902bc9277 | 官方: 否 | 付费: 否
答案:
Single-user systems are the ones with an operating system to cater to only one user at a time. These are commonly our personal computers and became popular due to low hardware cost and wide range of software.
单用户系统是指那些操作系统同时只能服务一个用户的系统。这些通常是我们个人电脑,由于硬件成本低和软件范围广而变得流行。
316. Name a few significant features of UNIX?
列举UNIX的几个重要特性?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c8658d557c902bc927a | 官方: 否 | 付费: 否
答案:
The following are a few features of UNIX: - Hardware independent
以下是UNIX的几个特性:- 硬件无关性
- Multi-user operations
- Unix Shells
- Hierarchical file system
- Pipes and filters
- Utilities
- Development tools
317. Can you write a command to erase all files in the current directory including all its sub-directories?
你能写一个命令来擦除当前目录中的所有文件,包括其所有子目录吗?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c8658d557c902bc927d | 官方: 否 | 付费: 否
答案:
rm –r* is used to erase all files in the current directory including all its sub-directories. rm is used for deleting files, but with the addition of option -r it erases all files in directories and subdirectories, and finally, an asterisk represents all entries.
rm –r* 用于擦除当前目录中的所有文件,包括其所有子目录。rm用于删除文件,但加上选项-r后,它会擦除目录和子目录中的所有文件,最后,星号表示所有条目。
318. Describe a link in UNIX.
描述UNIX中的链接。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c8658d557c902bc9280 | 官方: 否 | 付费: 否
答案:
Link is used to assigning more than one name to a file. It is like a pointer to a file and one file can have multiple pointers. There are two types of link - Hard link- These hard-linked files are assigned to the same inode value as the original and thus reference the same physical location of the file. Also if the file is moved to a different directory the link will still work
链接用于为一个文件分配多个名称。它类似于指向文件的指针,一个文件可以有多个指针。链接有两种类型——硬链接——这些硬链接文件被分配到与原始文件相同的inode值,因此引用文件的同一物理位置。此外,如果文件移动到不同目录,链接仍然有效。
ln [original filename] [link name] - Symbolic link- A soft link is similar to the file shortcut feature and it contains a separate inode than the original one. If the original file is moved then the link might not work, but it can reference across the different file systems.
ln [原文件名] [链接名] — 符号链接——软链接类似于文件快捷方式功能,它包含与原始文件不同的inode。如果原始文件被移动,链接可能失效,但它可以跨不同文件系统引用。
ln -s [original filename] [link name]
ln -s [原文件名] [链接名]
319. Describe pipes in Unix
描述Unix中的管道
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c8658d557c902bc9283 | 官方: 否 | 付费: 否
答案:
A pipe is a unidirectional mechanism of interprocess communication. In a Unix command line, if a pipe is being used, the first process is assumed to be writing to stdout and the second is assumed to be reading from stdin.
管道是进程间通信的单向机制。在Unix命令行中,如果使用管道,第一个进程假定写入stdout,第二个进程假定从stdin读取。
$who | sort | lpr
$who | sort | lpr
This will create 3 processes with 2 pipes in between them.
这将创建3个进程,它们之间有2个管道。
320. In Shell scripting, how do you separate the grep and egrep?
在Shell脚本中,如何区分grep和egrep?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c8658d557c902bc9286 | 官方: 否 | 付费: 否
答案:
egrep is an extended version of grep, in addition to searching using regular expressions, egrep can use extended regular expressions for searching. $ ls | grep '.env|.json'
egrep是grep的扩展版本,除了使用正则表达式搜索外,egrep还可以使用扩展正则表达式进行搜索。 $ ls | grep '.env|.json'
This will check whether any file has extension ‘.env|.json’ literally $ ls | egrep '.env|.json'
这将检查是否有任何文件具有字面上的扩展名'.env|.json'。 $ ls | egrep '.env|.json'
But in this case, it checks whether any file has extension ‘.env’ or ‘.json’ since ‘|’ this will be considered as a metacharacter.
但在这种情况下,由于'|'被视为元字符,它会检查是否有任何文件具有扩展名'.env'或'.json'。
321. What is the fork() system call?
什么是fork()系统调用?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c8658d557c902bc9289 | 官方: 否 | 付费: 否
答案:
This is used to create another process that duplicates the entire process structure and address space. The newly created process is called the child process and the one from which it got replicated is called the parent process. This was used to achieve parallelism before threads. The fork() system call takes no arguments and returns an integer. - 0 means that the child process is created successfully, and 0 refers to the child process within the parent process.
这用于创建另一个进程,该进程复制整个进程结构和地址空间。新创建的进程称为子进程,被复制的进程称为父进程。这在线程出现之前用于实现并行性。fork()系统调用不带参数并返回一个整数。- 0表示子进程创建成功,且在父进程中0指代子进程。
- –1 means that the system was unable to create another process.
- default positive integer > 0 is returned to the parent process which represents the process ID of the child process.
322. What is meant by the term Super User?
术语“超级用户”是什么意思?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c8658d557c902bc928c | 官方: 否 | 付费: 否
答案:
The Super User is a user with access to all files and commands within the system. In general, this superuser login is to access root and it is secured with the root password.
超级用户是能够访问系统内所有文件和命令的用户。通常,此超级用户登录是为了访问root,并通过root密码进行安全保护。
323. What do chmod, chown, chgrp commands do?
chmod、chown、chgrp命令有什么作用?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c8658d557c902bc928f | 官方: 否 | 付费: 否
答案:
These are file management commands. These are used for: - chmod - It changes the permission set of a file
这些是文件管理命令。它们用于:- chmod - 它更改文件的权限集
- chown - It changes the ownership of the file.
- chgrp - It changes the group of the file.
$ chmod g+w testfile
It changes permission for a user group to write. $ chown sroy8091 testfile
它更改用户组对文件的写入权限。$ chown sroy8091 testfile
It changes the owner of testfile to sroy8091.
它将testfile的所有者更改为sroy8091。
$ chgrp moderators testfile
It changes a group of testfile to moderators.
它将testfile的组更改为moderators。
324. Explain Unix Architecture
解释Unix架构
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: easy | 子类型: system-design
- 分类: fullstack
- id: 69b37c8758d557c902bc9292 | 官方: 否 | 付费: 否
答案:
The Unix comprises mainly three layers such as kernel, shell, and user application.
Unix主要由三层组成,如内核、shell和用户应用程序。
Kernel - This is the core layer of the operating system which interacts with the hardware of the system. The kernel provides API via system calls to process the user requests. The kernel also provides services such as signal handling, synchronization, interprocess communication, file system services, network services, and hardware monitoring. Each time a process is started, the kernel has to initialize the process, assign the process apriority, allocate memory and resources for the process, and schedule the process to run. When the process terminates, the kernel frees any memory and/or resources held by the process.
内核 - 这是操作系统的核心层,与系统的硬件交互。内核通过系统调用提供API来处理用户请求。内核还提供服务,如信号处理、同步、进程间通信、文件系统服务、网络服务和硬件监控。每次启动一个进程时,内核必须初始化该进程,分配进程优先级,为进程分配内存和资源,并调度该进程运行。当进程终止时,内核释放该进程持有的任何内存和/或资源。
325. What is the ‘nohup’ in UNIX?
UNIX中的“nohup”是什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc9295 | 官方: 否 | 付费: 否
答案:
nohup is a special command to run a process in the background even when a user logs off from the system. It also helps in creating daemon processes or some cleanup script of logs.
nohup是一个特殊命令,用于在用户从系统注销后仍能在后台运行进程。它也有助于创建守护进程或某些日志清理脚本。
326. Write a code that accepts the URL string and decodes the URL into its tiny version. The output URL must have the predecessor of “https://www.tinyURL/”
编写一段代码,接受URL字符串并将该URL解码为其精简版本。输出的URL必须带有前缀“https://www.tinyURL/”
- 知识点: 操作系统与网络 (标签: interviewbit, virtusa, company-specific)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: general
- 公司: Virtusa
- id: 69b37c8a58d557c902bc9417 | 官方: 否 | 付费: 否
答案:
For example -
例如——
Input URL = “https://www.interviewbit.com/java-interview-questions/”
输入URL = “https://www.interviewbit.com/java-interview-questions/”
The Output will be - “https://www.tinyURL/xsf34”
输出将是 - “https://www.tinyURL/xsf34”
We can do one thing to solve this problem we can create an index that will be used as an index such that it can map to the long URL. And when it wants to access then it can be accessed in constant time.
我们可以做一件事来解决这个问题,我们可以创建一个索引,将其用作索引以便映射到长URL。当需要访问时,可以在常数时间内访问它。
The code implementation can be -
代码实现可以是 -
public class encodeURL{
public class encodeURL{
HashMap<String, String> hm = new HashMap<>();
HashMap<String, String> hm = new HashMap<>();
//Method that generates an encoded URL that will be used as index.
//生成一个将用作索引的编码URL的方法。
private String generateHashURL(){
private String generateHashURL(){
String AlphaNumericString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
String AlphaNumericString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+"0123456789"
+"abcdefghijklmnopqrstuvxyz";
+"abcdefghijklmnopqrstuvxyz";
StringBuilder sb = new StringBuilder(10);
StringBuilder sb = new StringBuilder(10);
for (int i = 0; i < 10; i++) {
for (int i = 0; i < 10; i++) {
int index = (int)(AlphaNumericString.length() * Math.random());
int index = (int)(AlphaNumericString.length() * Math.random());
sb.append(AlphaNumericString.charAt(index));
sb.append(AlphaNumericString.charAt(index));
}
//This creates a random string and returns it.
//这会创建一个随机字符串并返回它。
return sb.toString();
return sb.toString();
}
// Encodes a URL to a shortened URL and returns it.
// 将一个URL编码为缩短后的URL并返回它。
public String encode(String longUrl) {
public String encode(String longUrl) {
String predecessorURL = "https://www.tinyURL/";
String predecessorURL = "https://www.tinyURL/";
String hashURL = predecessorURL+generateHashURL();
String hashURL = predecessorURL+generateHashURL();
while(hm.containsKey(hashURL)){
while(hm.containsKey(hashURL)){
hashURL = predecessorURL+generateHashURL();
hashURL = predecessorURL+generateHashURL();
}
hm.put(hashURL, longUrl);
hm.put(hashURL, longUrl);
return hashURL;
return hashURL;
}
}
327. What do you know about DNS?
你对DNS了解多少?
- 知识点: 操作系统与网络 (标签: interviewbit, virtusa, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Virtusa
- id: 69b37c8a58d557c902bc9430 | 官方: 否 | 付费: 否
答案:
The Domain Name Service (DNS) is what converts a domain name (such as www.interviewbit.com ) into an IP address 13.227.138.126 . The technical term for this is querying. DNS is what you would use if you wanted to type http://www.interviewbit.com into your web browser. Instead of just typing in the domain, you would type the word interviewbit.com , and the DNS would look up the IP address associated with that domain. Names are great, but IP addresses are harder to remember. To avoid having to memorize the IP addresses of all the devices on your network, you can use a DNS server, which can be configured to return the correct IP address for a particular hostname. This can be done on a single computer or on a server.
域名服务(DNS)是将域名(如 www.interviewbit.com )转换为IP地址 13.227.138.126 的服务。技术术语称之为查询。如果你想要在网页浏览器中输入 http://www.interviewbit.com ,DNS 就是你所需要的。你可以输入 interviewbit.com 这个词,而非仅仅输入域名,DNS 会查找与该域名关联的IP地址。名称很好,但IP地址更难记住。为了避免必须记住网络上所有设备的IP地址,你可以使用DNS服务器,它可以被配置为返回特定主机名的正确IP地址。这可以在单台计算机或服务器上完成。
328. What are the different types of Shells in Linux?
Linux中有哪些不同类型的Shell?
- 知识点: 操作系统与网络 (标签: interviewbit, wipro, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Wipro
- id: 69b37c9858d557c902bc9ba9 | 官方: 否 | 付费: 否
答案:
SHELL is a program that acts as the interface between the user and the operating system. It is a command-line interface to the Unix operating system. It collects data from you and runs programs depending on that data. The output of the program is displayed once it has completed its execution.
SHELL是一个程序,充当用户与操作系统之间的接口。它是Unix操作系统的命令行界面。它从你那里收集数据,并根据这些数据运行程序。程序执行完成后会显示其输出。
Shell allows us to run commands, programs, and shell scripts. Kernel maintains resources between processes and regulates all-important computer operations. It also restricts hardware access, organizes all performing utilities, and manages resources between processes. Only kernel users have access to the operating system's utilities.
Shell 允许我们运行命令、程序和 shell 脚本。内核维护进程之间的资源并调节所有重要的计算机操作。它还限制硬件访问,组织所有执行实用程序,并管理进程之间的资源。只有内核用户才能访问操作系统的实用程序。
Types of Shells: - The C Shell: It included aliases and command history, among other features. It has features like built-in math and C-like expression syntax that make programming easier.
Shell 的类型: - C Shell:它包含别名和命令历史等功能。它具有内置数学和类似 C 的表达式语法等功能,使编程更容易。
- The Bourne Shell: It's the very first UNIX shell. It is more convenient and faster. It lacks interactive features such as the ability to recall past commands. It also has no built-in support for arithmetic and logical expressions. It is the default shell for the Solaris operating system.
- The Korn Shell: The Bourne shell is a subset of it. As a result, everything in the Bourne shell is supported. It includes interactive elements. Built-in arithmetic and C-like arrays, functions, and string manipulation facilities are among the features. It is more efficient than a C shell. It works with scripts written in the C shell.
The GNU Bourne-Again Shell: It can be used with the Bourne shell. It incorporates Korn and Bourne shell features.
Wipro Interview Preparation
329. Q10. Describe the OSI Reference Model.
问题10. 描述 OSI 参考模型。
- 知识点: 操作系统与网络 / 算法与数据结构 (标签: computer science fundamentals)
- 类型: technical | 难度: medium | 子类型:
- 分类: general
- 公司: Google
- id: 696470f1a9243c30c87057d3 | 官方: 是 | 付费: 否
答案:
(补充答案·AI 生成(AI-Generated))
OSI(Open Systems Interconnection,开放系统互连)七层(自下而上):1 物理层(Physical layer)(比特/介质);2 数据链路层(Data link layer)(帧、MAC(Media Access Control,介质访问控制)、成帧与差错检测);3 网络层(Network layer)(IP(Internet Protocol,互联网协议)、路由);4 传输层(Transport layer)(TCP/UDP(Transmission Control Protocol/User Datagram Protocol,传输控制协议/用户数据报协议)、端口、可靠传输);5 会话层(Session layer)(会话管理);6 表示层(Presentation layer)(编码/加密/压缩);7 应用层(Application layer)(HTTP/DNS/SMTP(Hypertext Transfer Protocol/Domain Name System/Simple Mail Transfer Protocol,超文本传输协议/域名系统/简单邮件传输协议)等)。记忆:物数网传会表应。数据发送时自上而下封装,接收时自下而上解封装。
330. What exactly are the HTTP and HTTPS protocols?
HTTP 和 HTTPS 协议究竟是什么?
- 知识点: 操作系统与网络
- 类型: technical | 难度: medium | 子类型:
- 分类: general
- 公司: Google
- id: 6964718ba9243c30c87060ab | 官方: 是 | 付费: 否
答案:
HTTP stands for HyperText Transfer Protocol, and it outlines the set of rules and standards that govern how information is sent on the World Wide Web (WWW). It facilitates communication between web browsers and servers. It is a stateless protocol, which means that each command is independent of the previous command. TCP provides the foundation for HTTP, which is an application layer protocol. Port 80 is the default.
HTTP代表超文本传输协议,它概述了管理万维网(WWW)上信息发送方式的一套规则和标准。它促进了Web浏览器和服务器之间的通信。它是一种无状态协议,这意味着每个命令独立于前一个命令。TCP为HTTP提供了基础,HTTP是一种应用层协议。端口80是默认端口。
HTTPS stands for HyperText Transfer Protocol Secure. It is a sophisticated and secure variant of HTTP. To offer security on top of HTTP, the SSL/TLS protocol is utilized. It secures transactions by encrypting communication and also assists in securely identifying network servers.
HTTPS代表安全超文本传输协议。它是HTTP的一种高级且安全的变体。为了在HTTP之上提供安全性,使用了SSL/TLS协议。它通过加密通信来确保交易安全,并有助于安全地识别网络服务器。
331. How does a scheduler work in an operating system?
操作系统中的调度器是如何工作的?
- 知识点: 操作系统与网络
- 类型: technical | 难度: medium | 子类型:
- 分类: general
- 公司: Google
- id: 6964718ba9243c30c87060af | 官方: 是 | 付费: 否
答案:
The scheduler in an operating system is responsible for assigning system resources (such as CPU time) to processes or threads to maximize system efficiency and responsiveness. The scheduler determines which process or thread should be executed next based on a predetermined scheduling policy or algorithm.
操作系统中的调度器负责将系统资源(如CPU时间)分配给进程或线程,以最大化系统效率和响应速度。调度器根据预定的调度策略或算法决定下一个应执行的进程或线程。
332. 同步(synchronization)和异步(asynchronization)有何异同,在什么情况下分别使用他们?举例说明。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency, async;标签: Synchronous, Asynchronous, Thread Safety)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965d432f760bfe7d4f8b700 | 官方: 是 | 付费: 否
答案:
答案如果数据将在线程间共享。例如正在写的数据以后可能被另一个线程读到,或者正在读的数据可能已经被另一个线程写过了,那么这些数据就是共享数据,必须进行同步(synchronization)存取。
当应用程序在对象上调用了一个需要花费很长时间来执行的方法,并且不希望让程序等待方法的返回时,就应该使用异步编程(asynchronous programming),在很多情况下采用异步途径往往更有效率。
333. Java 中能创建 volatile 数组吗?
- 知识点: 操作系统与网络 / 算法与数据结构 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency, volatile;标签: volatile, array, memory visibility)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965dbd4fa809e6d38860b5d | 官方: 是 | 付费: 否
答案:
答案能,Java 中可以创建 volatile(易变)类型数组,不过只是一个指向数组的引用,而不是整个数组。我的意思是,如果改变引用指向的数组,将会受到 volatile 的保护,但是如果多个线程同时改变数组的元素,volatile 标示符就不能起到之前的保护作用了。
334. 10 个线程和 2 个线程的同步代码,哪个更容易写?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency, synchronization;标签: contention, lock splitting, synchronization strategy)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965dbd4fa809e6d38860b73 | 官方: 是 | 付费: 否
答案:
答案从写代码的角度来说,两者的复杂度是相同的,因为同步(synchronization)代码与线程数量是相互独立的。但是同步策略的选择依赖于线程的数量,因为越多的线程意味着更大的竞争,所以你需要利用同步技术,如锁分离(lock splitting),这要求更复杂的代码和专业知识。
335. 你是如何调用 wait() 方法的?使用 if 块还是循环?为什么?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency, wait-notify;标签: wait, notify, spurious wakeup, loop)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965dbd4fa809e6d38860b77 | 官方: 是 | 付费: 否
答案:
答案wait() 方法应该在循环调用,因为当线程获取到 CPU 开始执行的时候,其他条件可能还没有满足,所以在处理前,循环检测条件是否满足会更好。
下面是一段标准的使用 wait(等待)和 notify(通知)方法的代码:
// The standard idiom for using the wait method
// 使用wait方法的标准惯用法
synchronized (obj) { while (condition does not hold) obj.wait();
synchronized (obj) { while (condition does not hold) obj.wait();
// (Releases lock, and reacquires on wakeup) ... // Perform action appropriate to condition }参见 Effective Java 第 69 条,获取更多关于为什么应该在循环中来调用 wait(等待)方法的内容。
336. Java 中怎么获取一份线程 dump(转储)文件?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, jvm, troubleshooting;标签: thread dump, kill -3, Ctrl+Break)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965dbd5fa809e6d38860b83 | 官方: 是 | 付费: 否
答案:
答案在 Linux 下,你可以通过命令 kill -3 PID (Java 进程的进程 ID)来获取 Java 应用的 dump(转储)文件。在 Windows 下,你可以按下 Ctrl + Break 来获取。这样 JVM 就会将线程的 dump(转储)文件打印到标准输出或错误文件中,它可能打印在控制台或者日志文件中,具体位置依赖应用的配置。如果你使用Tomcat。
337. Swing(Swing)是线程安全的(thread-safe)吗?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, swing, concurrency;标签: Swing, AWT, invokeLater, invokeAndWait)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965dbd5fa809e6d38860b87 | 官方: 是 | 付费: 否
答案:
答案不是,Swing(Swing)不是线程安全的(thread-safe)。你不能通过任何线程来更新 Swing(Swing)组件,如 JTable(JTable)、JList(JList)或 JPanel(JPanel),事实上,它们只能通过 GUI(GUI)或 AWT(AWT)线程来更新。这就是为什么 Swing(Swing)提供 invokeAndWait()(invokeAndWait())和 invokeLater()(invokeLater())方法来获取其他线程的 GUI(GUI)更新请求。这些方法将更新请求放入 AWT(AWT)的线程队列中,可以一直等待,也可以通过异步更新直接返回结果。你也可以在参考答案中查看和学习到更详细的内容。
338. Java(Java)中 sleep(sleep)方法和 wait(wait)方法的区别?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency;标签: sleep, wait, lock)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965dbd5fa809e6d38860c5f | 官方: 是 | 付费: 否
答案:
答案虽然两者都是用来暂停当前运行的线程,但是 sleep()(sleep())实际上只是短暂停顿,因为它不会释放锁(lock),而 wait()(wait())意味着条件等待,这就是为什么该方法要释放锁(lock),因为只有这样,其他等待的线程才能在满足条件时获取到该锁(lock)。
339. 怎么获取 Java(Java)程序使用的内存?堆使用的百分比?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, jvm, memory;标签: Runtime, freeMemory, totalMemory, maxMemory)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965dcf6fa809e6d388632d6 | 官方: 是 | 付费: 否
答案:
答案可以通过 java.lang.Runtime(java.lang.Runtime)类中与内存相关方法来获取剩余的内存,总内存及最大堆内存。通过这些方法你也可以获取到堆使用的百分比及堆内存的剩余空间。Runtime.freeMemory()(Runtime.freeMemory())方法返回剩余空间的字节数,Runtime.totalMemory()(Runtime.totalMemory())方法总内存的字节数,Runtime.maxMemory()(Runtime.maxMemory())返回最大内存的字节数。
340. Java(Java)中堆和栈有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, jvm, memory;标签: heap, stack, local variables, objects)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965dcf6fa809e6d388632e1 | 官方: 是 | 付费: 否
答案:
答案JVM(JVM)中堆和栈属于不同的内存区域,使用目的也不同。栈常用于保存方法帧和局部变量,而对象总是在堆上分配。栈通常都比堆小,也不会在多个线程之间共享,而堆被整个 JVM(JVM)的所有线程共享。 Difference between stack and heap memory in Java
341. 在我 Java(Java)程序中,我有三个 socket(socket),我需要多少个线程来处理?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, io, nio, networking;标签: socket, threads, BIO, NIO, AIO, selector)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965de58fa809e6d388650ba | 官方: 是 | 付费: 否
答案:
答案在题目中没有提供答案,因此这里给出一个通用回答:线程数量不一定与 socket(socket)数量一一对应,取决于 IO(IO)模型与并发方式。传统阻塞 IO(BIO)(BIO)下常见做法是每个连接/Socket(Socket)一个线程;使用 NIO/Selector(NIO/Selector)时,一个线程可以处理多个 socket(socket)的读写事件;使用异步 IO(AIO)(AIO)或基于事件循环/线程池的模型时,也可以用较少线程处理多个 socket(socket)。
342. socket(socket)选项 TCP NO DELAY(TCP_NODELAY)是指什么?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, networking, tcp;标签: TCP_NODELAY, Nagle, latency)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965de58fa809e6d388650f8 | 官方: 是 | 付费: 否
答案:
答案在题目中没有提供答案,因此这里给出一个通用回答:TCP_NODELAY(TCP_NODELAY)用于禁用 Nagle 算法(Nagle algorithm)。开启 TCP_NODELAY(TCP_NODELAY)(即禁用 Nagle 算法)会让小包尽快发送以降低延迟,但可能增加网络包数量与开销;适合低延迟交互场景,不适合吞吐优先的批量发送场景。
343. Java(Java)中,编写多线程程序的时候你会遵循哪些最佳实践?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency;标签: thread naming, volatile, synchronized, concurrent collections)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965de58fa809e6d38865113 | 官方: 是 | 付费: 否
答案:
答案这是我在写Java(Java)并发程序的时候遵循的一些最佳实践:
a)给线程命名,这样可以帮助调试。
c)如果可以,更偏向于使用 volatile(volatile)而不是 synchronized(synchronized)。
e)优先使用并发集合(Concurrent Collections),而不是对集合进行同步(Synchronization)。并发集合提供更好的可扩展性(Scalability)。
344. 说出至少 5 点在 Java 中使用线程(Thread)的最佳实践。
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency;标签: threads, thread pool, Runnable, Callable)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965de58fa809e6d3886511d | 官方: 是 | 付费: 否
答案:
答案这个问题与之前的问题类似,你可以使用上面的答案。对线程来说,你应该:
a)对线程命名(Thread Naming)
b)将线程和任务分离,使用线程池执行器(Thread Pool Executor)来执行 Runnable 或 Callable。
c)使用线程池(Thread Pool)
345. 说出 5 条 IO 的最佳实践
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, io, nio;标签: I/O, buffered, NIO, try-with-resources, memory-mapped)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965de58fa809e6d38865121 | 官方: 是 | 付费: 否
答案:
答案IO 对 Java 应用的性能非常重要。理想情况下,你不应该在你应用的关键路径(Critical Path)上避免 IO 操作。下面是一些你应该遵循的 Java IO 最佳实践:
a)使用有缓冲区的 IO 类(Buffered IO Classes),而不要单独读取字节或字符。
b)使用 NIO(New I/O)和 NIO2(New I/O 2)
c)在 finally 块中关闭流,或者使用 try-with-resource(Java7) 语句。
d)使用内存映射文件(Memory-Mapped Files)获取更快的 IO。
346. 在多线程环境下,SimpleDateFormat(简单日期格式) 是线程安全的(Thread-Safe)吗?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, datetime, concurrency;标签: SimpleDateFormat, thread safety, ThreadLocal, joda-time)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965de58fa809e6d3886513b | 官方: 是 | 付费: 否
答案:
答案不是,非常不幸,DateFormat(日期格式) 的所有实现,包括 SimpleDateFormat 都不是线程安全的,因此你不应该在多线程序中使用,除非是在对外线程安全的环境中使用,如 将 SimpleDateFormat 限制在 ThreadLocal(线程本地变量) 中。如果你不这么做,在解析或者格式化日期的时候,可能会获取到一个不正确的结果。因此,从日期、时间处理的所有实践来说,我强力推荐 joda-time 库(Joda-Time Library)。
347. 设计4个线程(Threads),其中两个线程每次对j增加1,另外两个线程对j每次减少1。写出程序。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: Thread, synchronized, Runnable)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965e772fa809e6d388763cd | 官方: 是 | 付费: 否
答案:
答案以下程序使用内部类(Inner Class)实现线程,对j增减的时候没有考虑顺序问题。
package com.sxy;
package com.sxy;
/**
*
@author sunxy
- @author sunxy
*/
public class TestDemo {
public class TestDemo {
private int j;
private int j;
- @author sunxy
public static void main(String args[]) {
public static void main(String args[]) {
TestDemo tt = new TestDemo();
TestDemo tt = new TestDemo();
Inc inc = tt.new Inc();
Inc inc = tt.new Inc();
Dec dec = tt.new Dec();
Dec dec = tt.new Dec();
for (int i = 0; i < 2; i++) {
for (int i = 0; i < 2; i++) {
Thread t = new Thread(inc);
Thread t = new Thread(inc);
t.start();
t.start();
t = new Thread(dec);
t = new Thread(dec);
t.start();
t.start();
}
}
private synchronized void inc() {
private synchronized void inc() {
j++;
j++;
System.out.println(Thread.currentThread().getName() + "-inc:" + j);
System.out.println(Thread.currentThread().getName() + "-inc:" + j);
}
private synchronized void dec() {
private synchronized void dec() {
j--;
j--;
System.out.println(Thread.currentThread().getName() + "-dec:" + j);
System.out.println(Thread.currentThread().getName() + "-dec:" + j);
}
class Inc implements Runnable {
class Inc implements Runnable {
public void run() {
public void run() {
for (int i = 0; i < 100; i++) {
for (int i = 0; i < 100; i++) {
inc();
inc();
}
}
}
class Dec implements Runnable {
class Dec implements Runnable {
public void run() {
public void run() {
for (int i = 0; i < 100; i++) {
for (int i = 0; i < 100; i++) {
dec();
dec();
}
}
}
}
348. 当一个线程(Thread)进入一个对象的一个synchronized方法后,其它线程是否可进入此对象的其它方法?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: synchronized, Lock, Thread)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965e772fa809e6d388763f1 | 官方: 是 | 付费: 否
答案:
答案可以,但是其它线程不可以进入此对象的这个synchronized方法
349. java 中操作字符串都有哪些类?它们之间有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 / 编程语言基础 (主题: java;标签: String, StringBuffer, StringBuilder, Immutability, Thread Safety)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965e90cfa809e6d38877fa6 | 官方: 是 | 付费: 否
答案:
答案操作字符串的类有:String、StringBuffer、StringBuilder。
String 和 StringBuffer、StringBuilder 的区别在于 String 声明的是不可变(Immutable)的对象,每次操作都会生成新的 String 对象,然后将指针指向新的 String 对象,而 StringBuffer、StringBuilder 可以在原有对象的基础上进行操作,所以在经常改变字符串内容的情况下最好不要使用 String。
StringBuffer 和 StringBuilder 最大的区别在于,StringBuffer 是线程安全(Thread-safe)的,而 StringBuilder 是非线程安全的,但 StringBuilder 的性能却高于 StringBuffer,所以在单线程环境下推荐使用 StringBuilder,多线程环境下推荐使用 StringBuffer。
350. ThreadLocal 是什么?有哪些使用场景?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: ThreadLocal, 并发)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965e90efa809e6d3887816b | 官方: 是 | 付费: 否
答案:
答案ThreadLocal 为每个使用该变量的线程提供独立的变量副本,所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。
ThreadLocal 的经典使用场景是数据库连接(Database Connection)和 session 管理等。
351. 说一下 synchronized 底层实现原理?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: synchronized, monitor)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965e90efa809e6d38878248 | 官方: 是 | 付费: 否
答案:
答案synchronized 是由 monitorenter/monitorexit 指令实现的,monitor 对象是同步的基本实现单元。
在 Java 6 之前,monitor 的实现完全是依靠操作系统内部的互斥锁(Mutex Lock),因为需要进行用户态到内核态的切换,所以同步操作是一个无差别的重量级操作,性能也很低。但在 Java 6 的时候,Java 虚拟机(JVM)对其进行了大幅优化,提供了三种不同的 monitor 实现,也就是常说的三种不同的锁:偏向锁(Biased Locking)、轻量级锁(Lightweight Locking)和重量级锁,大大改进了其性能。
352. synchronized 和 volatile 的区别是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: volatile, synchronized)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965e90ffa809e6d3887824c | 官方: 是 | 付费: 否
答案:
答案- volatile 是变量修饰符;synchronized 是修饰类、方法、代码段。
- volatile 只能保证变量的修改可见性,不能保证原子性;而 synchronized 可以保证变量的修改可见性和原子性。
- volatile 不会造成线程的阻塞;synchronized 可能会造成线程的阻塞。
353. synchronized 和 Lock 有什么区别?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: Lock, synchronized)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965e90ffa809e6d3887832f | 官方: 是 | 付费: 否
答案:
答案- synchronized 可以给类、方法、代码块加锁;而 Lock 只能给代码块加锁。
- synchronized 不需要手动获取锁和释放锁,使用简单,发生异常会自动释放锁,不会造成死锁;而 Lock 需要自己加锁和释放锁,如果使用不当没有 unLock() 去释放锁就会造成死锁。
- 通过 Lock 可以知道有没有成功获取锁;而 synchronized 却无法办到。
354. synchronized 和 ReentrantLock(可重入锁)区别是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: ReentrantLock, synchronized)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965e90ffa809e6d38878333 | 官方: 是 | 付费: 否
答案:
答案synchronized(同步锁)早期的实现比较低效,对比 ReentrantLock(可重入锁),大多数场景性能都相差较大,但是在 Java 6 中对 synchronized(同步锁)进行了非常多的改进。
主要区别如下:
- ReentrantLock 使用起来比较灵活,但是必须有释放锁的配合动作;
- ReentrantLock 必须手动获取与释放锁,而 synchronized 不需要手动释放和开启锁;
- ReentrantLock 只适用于代码块锁,而 synchronized 可用于修饰方法、代码块等。
- volatile 标记的变量不会被编译器优化;synchronized 标记的变量可以被编译器优化。
355. 说一下 atomic(原子类)的原理?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: CAS, atomic)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965e90ffa809e6d38878337 | 官方: 是 | 付费: 否
答案:
答案atomic(原子类)主要利用 CAS(Compare And Swap,比较并交换)和 volatile(易变变量)和 native(本地)方法来保证原子操作,从而避免 synchronized(同步锁)的高开销,执行效率大为提升。
356. 创建线程有哪几种方式?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: Thread, Runnable, Callable, Future, FutureTask)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965ea1dfa809e6d3887b8a5 | 官方: 是 | 付费: 否
答案:
答案①. 继承Thread(线程)类创建线程类
定义Thread(线程)类的子类,并重写该类的run(运行)方法,该run(运行)方法的方法体就代表了线程要完成的任务。因此把run()方法称为执行体。
创建Thread(线程)子类的实例,即创建了线程对象。
调用线程对象的start()方法来启动该线程。
②. 通过Runnable(可运行)接口创建线程类
定义runnable(可运行)接口的实现类,并重写该接口的run()方法,该run()方法的方法体同样是该线程的线程执行体。
创建 Runnable(可运行)实现类的实例,并依此实例作为Thread(线程)的target(目标)来创建Thread(线程)对象,该Thread(线程)对象才是真正的线程对象。
调用线程对象的start()方法来启动该线程。
③. 通过Callable(可调用)和Future(未来)创建线程
创建Callable(可调用)接口的实现类,并实现call()方法,该call()方法将作为线程执行体,并且有返回值。
创建Callable实现类的实例,使用FutureTask类来包装Callable对象,该FutureTask对象封装了该Callable对象的call()方法的返回值。
使用FutureTask对象作为Thread对象的target创建并启动新线程。
调用FutureTask对象的get()方法来获得子线程执行结束后的返回值。
357. 说一下 runnable 和 callable 有什么区别?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: Runnable, Callable, Future, Async Result)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965ea1dfa809e6d3887b8a9 | 官方: 是 | 付费: 否
答案:
答案有点深的问题了,也看出一个Java程序员学习知识的广度。
Runnable接口中的run()方法的返回值是void,它做的事情只是纯粹地去执行run()方法中的代码而已;
Callable接口中的call()方法是有返回值的,是一个泛型,和Future、FutureTask配合可以用来获取异步执行的结果。
358. sleep(睡眠)() 和 wait(等待)() 有什么区别?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: sleep, wait, synchronized, notify, notifyAll)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965ea1dfa809e6d3887b996 | 官方: 是 | 付费: 否
答案:
答案sleep():方法是线程类(Thread)的静态方法,让调用线程进入睡眠状态,让出执行机会给其他线程,等到休眠时间结束后,线程进入就绪状态和其他线程一起竞争cpu的执行时间。因为sleep() 是static静态的方法,他不能改变对象的机锁,当一个synchronized块中调用了sleep() 方法,线程虽然进入休眠,但是对象的机锁没有被释放,其他线程依然无法访问这个对象。
wait():wait()是Object类的方法,当一个线程执行到wait方法时,它就进入到一个和该对象相关的等待池,同时释放对象的机锁,使得其他线程能够访问,可以通过notify,notifyAll方法来唤醒等待的线程。
359. tcp 为什么要三次握手,两次不行吗?为什么?
- 知识点: 操作系统与网络 (主题: networking, tcp;标签: TCP, Three-way Handshake, Sequence Number, Reliability)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965ee67fa809e6d38881858 | 官方: 是 | 付费: 否
答案:
答案为了实现可靠数据传输, TCP 协议的通信双方, 都必须维护一个序列号, 以标识发送出去的数据包中, 哪些是已经被对方收到的。 三次握手的过程即是通信双方相互告知序列号起始值, 并确认对方已经收到了序列号起始值的必经步骤。
如果只是两次握手, 至多只有连接发起方的起始序列号能被确认, 另一方选择的序列号则得不到确认。
360. 什么时候应该使用序列化(serialization)?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Serialization, Networking)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965f3d7fa809e6d3888b8d0 | 官方: 是 | 付费: 否
答案:
答案当需要通过网络传输数据时使用序列化。通过序列化,对象状态会被保存并转换为字节流,然后将字节流通过网络传输,在目的地重新创建对象。
361. 什么是多线程(multi-threading)?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Multithreading, Concurrency, Threads)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965f3d9fa809e6d3888bad4 | 官方: 是 | 付费: 否
答案:
答案多线程(Multi threading)是一种编程概念,用于在一个程序中以并发的方式运行多个任务。线程共享同一个进程栈并行运行,有助于提升程序性能。
362. 为什么 Java(Java)要使用 Runnable(Runnable)接口(Interface)?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Runnable, Multithreading)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965f590fa809e6d3888f466 | 官方: 是 | 付费: 否
答案:
答案Runnable(Runnable)接口(Interface)用于在 Java(Java)中实现多线程(Multithreading)应用。类(Class)通过实现 java.lang.Runnable(java.lang.Runnable)接口(Interface)来支持多线程(Multithreading)。
363. Java(Java)中实现多线程(Multithreading)有哪两种方式?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Runnable, Thread)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965f590fa809e6d3888f484 | 官方: 是 | 付费: 否
答案:
答案Java(Java)中可以通过以下两种方式开发多线程(Multithreading)应用:
- 使用 java.lang.Runnable(java.lang.Runnable)接口(Interface):类(Class)实现该接口(Interface)以启用多线程(Multithreading)。该接口(Interface)中有一个 Run()(Run())方法(Method)需要实现。
- 编写一个继承 java.lang.Thread(java.lang.Thread)类(Class)的类(Class)。
364. 多线程(Multithreading)中如何确保资源不会被多个线程(Thread)同时使用?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: synchronized, Synchronization, Thread Safety)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965f591fa809e6d3888f58a | 官方: 是 | 付费: 否
答案:
答案在多线程(Multithreading)中,共享资源可以通过同步(Synchronization)机制来控制访问。使用 synchronized(synchronized)关键字(Keyword),可以确保同一时刻只有一个线程(Thread)使用共享资源,其他线程(Thread)只能在资源释放后才能获取控制权。
365. 因为有垃圾回收机制(Garbage Collection),Java(Java)程序就永远不会内存溢出(Memory Overflow)吗?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Garbage Collection, OutOfMemory)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6965f597fa809e6d3888fc3b | 官方: 是 | 付费: 否
答案:
答案不正确。尽管 Java(Java)提供自动垃圾回收(Garbage Collection),但并不能保证 Java(Java)程序不会内存溢出(Memory Overflow)。如果 Java(Java)对象(Object)创建速度快于垃圾回收(Garbage Collection)速度,所有可用内存资源仍可能被占满。
因此垃圾回收(Garbage Collection)能降低内存溢出(Memory Overflow)发生的概率,但不能保证一定不会发生。
366. String(String)、StringBuilder(StringBuilder)、StringBuffer(StringBuffer)有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 / 编程语言基础 (主题: java;标签: String, StringBuilder, StringBuffer, Thread Safety)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69660512fa809e6d388b2e7a | 官方: 是 | 付费: 否
答案:
答案String(String):String(String)变量(Variable)存储在“常量字符串池(Constant String Pool)”中。一旦 String(String)引用(Reference)发生变化,常量池(Constant Pool)中的旧值不会被清除。
示例:
String name = “book”;如果 name 从 “book” 变为 “pen”,旧值仍保留在常量池(Constant Pool)中。
StringBuffer:
StringBuffer:
- 字符串值存储在栈(stack)中,值改变时新值会替换旧值
- StringBuffer 是同步的(synchronized),线程安全
- 性能比 StringBuilder 慢
示例:
String Buffer(字符串缓冲区) name =”book”;当 name 变为 “pen” 时,栈中的 “book” 会被清除并替换。
StringBuilder(字符串构建器):与 StringBuffer(字符串缓冲区) 类似,但 StringBuilder(字符串构建器) 不是线程安全的(不 synchronized(同步)),因此性能更快。
367. 解释 join()(线程连接) 方法。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: join, Thread Coordination)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69660863fa809e6d388bd213 | 官方: 是 | 付费: 否
答案:
答案join()(线程连接) 方法用于将一个线程加入到当前运行线程的末尾。
示例:
public static void main (String[] args){
公共静态 void main (String[] args){
Thread t = new Thread ();
线程 t = 新线程 ();
t.start ();
t.start ();
t.join ();
t.join ();
}上述代码中,main thread(主线程) 开始执行。当执行到 t.start()(线程启动) 时,线程 t 开始自己的执行栈。JVM(Java虚拟机) 在 main thread(主线程) 和线程 t 之间切换。
当执行到 t.join()(线程连接) 时,只有线程 t 会继续执行并完成任务,之后 main thread(主线程) 才会继续执行。
join()(线程连接) 是一个非静态方法,且有重载版本,因此也可以在 join()(线程连接) 中指定时间长度(“.s”)。
368. Thread(线程) 类的 yield()(线程让出) 方法有什么作用?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: yield, Thread Scheduling)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69660863fa809e6d388bd217 | 官方: 是 | 付费: 否
答案:
答案yield()(线程让出) 方法会把当前正在运行的线程移动到 runnable(可运行) 状态,并允许其他线程执行,使得同优先级线程有机会运行。它是一个静态方法,不会释放任何锁。
yield()(线程让出) 只会将线程移回 Runnable(可运行) 状态,不会让线程进入 sleep()(线程休眠)、wait()(线程等待) 或 block(阻塞) 状态。
示例:
public static void main (String[] args){
公共静态 void main (String[] args){
Thread t = new Thread ();
线程 t = 新线程 ();
t.start ();
t.start ();
}
public void run(){
public void run(){
Thread.yield();
Thread.yield();
}
}
369. 解释 wait()(线程等待) 方法。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: wait, Synchronization)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69660863fa809e6d388bd21b | 官方: 是 | 付费: 否
答案:
答案wait()(线程等待) 方法用于让线程在 waiting pool(等待池) 中等待。当线程执行过程中调用 wait()(线程等待) 时,线程会立即放弃对象锁并进入 waiting pool(等待池)。wait()(线程等待) 会让线程等待一段时间,然后在线程被 notify()(线程通知) 或 notifyAll()(线程全通知) 唤醒后继续。
wait()(线程等待) 以及上述提到的方法,在当前执行线程完成 synchronized(同步) 代码之前,不会立即释放对象锁。它主要用于同步(synchronization)。
示例:
public static void main (String[] args){
公共静态 void main (String[] args){
Thread t = new Thread ();
线程 t = 新线程 ();
t.start ();
t.start ();
Synchronized (t) {
同步(t){
Wait();
等待();
}
}
370. 如何在 Java(Java)中停止线程(Thread)?并解释 sleep()(sleep())方法。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: sleep, Thread States)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69660864fa809e6d388bd22f | 官方: 是 | 付费: 否
答案:
答案我们可以通过以下线程状态(Thread State)/方法让线程(Thread)停止运行:
- Sleeping
- Waiting
Blocked
Sleep:睡眠:
sleep()(sleep())方法用于让当前执行线程(Thread)休眠指定时间。线程(Thread)醒来后可以进入 runnable(Runnable)状态,因此 sleep()(sleep())用于延迟执行一段时间。
它是静态方法(Static Method)。
示例:
Thread. Sleep(Thread.sleep())(2000)这会让线程(Thread)休眠 2 毫秒。sleep()(sleep())会抛出 InterruptedException(InterruptedException),因此需要用 try/catch(try/catch)包裹。
public class ExampleThread implements Runnable{
公共类 ExampleThread 实现了 Runnable{
public static void main (String[] args){
公共静态 void main (String[] args){
Thread t = new Thread ();
线程 t = 新线程 ();
t.start ();
t.start ();
}
public void run(){
public void run(){
try{
try{
Thread.sleep(2000);
线程.睡眠(2000);
}catch(InterruptedException e){
}捕获(中断异常 e){
}
}
}
371. 解释 Java(Java)中线程(Thread)的生命周期(Lifecycle)。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Thread Lifecycle, States)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69660864fa809e6d388bd268 | 官方: 是 | 付费: 否
答案:
答案线程(Thread)具有以下状态(State):
- New
- Runnable
- Running
- Non-runnable (Blocked)
- Terminated
New(New):在 New(New)状态中,线程实例(Thread Instance)已被创建,但 start()(start())方法尚未调用,此时线程(Thread)不被认为是活跃的。
Runnable(Runnable):调用 start()(start())后但 run()(run())尚未执行时,线程(Thread)处于 runnable(Runnable)状态。线程(Thread)也可能从 waiting/sleeping(waiting/sleeping)返回 runnable(Runnable)状态。在此状态线程(Thread)被认为是活跃的。
Running(Running):线程(Thread)调用 run()(run())方法后进入 Running(Running)状态,开始执行。
Non-Runnable(Blocked)(Non-Runnable(Blocked)):线程(Thread)是活跃的,但不具备运行资格;不在 runnable(Runnable)状态,但会在一段时间后返回 runnable(Runnable)状态。例如:wait(wait)、sleep(sleep)、block(block)。
Terminated(Terminated):run()(run())方法执行完成后线程(Thread)终止,此时线程(Thread)不再活跃。
372. 什么是同步(Synchronization)?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: Synchronization, synchronized, Locks)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69660864fa809e6d388bd26c | 官方: 是 | 付费: 否
答案:
答案同步(Synchronization)确保同一时刻只有一个线程(Thread)可以访问某段代码。如果多个线程(Thread)同时访问同一段代码,最终结果可能不准确。为避免这个问题,可以对敏感代码块进行同步(Synchronization)。
synchronized(synchronized)关键字表示线程(Thread)需要“钥匙”才能访问同步代码。
锁(Lock)是对象级别的。每个 Java 对象都有一个锁,锁只有一把钥匙。只有获得对象锁钥匙的线程(Thread),才可以访问 synchronized 方法。
因此我们使用 “Synchronized” 关键字。
示例:
public class ExampleThread implements Runnable{
公共类 ExampleThread 实现了 Runnable{
public static void main (String[] args){
公共静态 void main (String[] args){
Thread t = new Thread ();
线程 t = 新线程 ();
t.start ();
t.start ();
}
public void run(){
public void run(){
synchronized(object){
synchronized(object){
{
}
}
373. volatile 变量的作用是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java;标签: volatile, Memory Visibility)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69660865fa809e6d388bd42a | 官方: 是 | 付费: 否
答案:
答案volatile 变量(Variable)的值始终从主内存(Main Memory)读取,而不是从线程的缓存内存(Cache Memory)读取。它主要用于同步(Synchronization),仅适用于变量(Variable)。
示例:
volatile int number;
volatile int number;
374. Request对象的主要方法:
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, servlet, web;标签: HttpServletRequest, Request)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696700d8fa809e6d389eba5e | 官方: 是 | 付费: 否
答案:
答案setAttribute(String name,Object):设置名字为name的request的参数值
getAttribute(String name):返回由name指定的属性值
getAttributeNames():返回request对象所有属性的名字集合,结果是一个枚举(Enumeration)的实例
getCookies():返回客户端的所有Cookie对象,结果是一个Cookie数组
getCharacterEncoding():返回请求中的字符编码方式
getContentLength():返回请求的Body的长度
getHeader(String name):获得HTTP协议定义的文件头信息
getHeaders(String name):返回指定名字的request Header的所有值,结果是一个枚举(Enumeration)的实例
getHeaderNames():返回所以request Header的名字,结果是一个枚举(Enumeration)的实例
getInputStream():返回请求的输入流(InputStream),用于获得请求中的数据
getMethod():获得客户端向服务器端传送数据的方法
getParameter(String name):获得客户端传送给服务器端的有name指定的参数值
getParameterNames():获得客户端传送给服务器端的所有参数的名字,结果是一个枚举(Enumeration)的实例
getParameterValues(String name):获得有name指定的参数的所有值
getProtocol():获取客户端向服务器端传送数据所依据的协议(Protocol)名称
getQueryString():获得查询字符串(Query String)
getRequestURI():获取发出请求字符串的客户端地址
getRemoteAddr():获取客户端的IP地址(IP Address)
getRemoteHost():获取客户端的名字
getSession([Boolean create]):返回和请求相关Session(会话)
getServerName():获取服务器的名字
getServletPath():获取客户端所请求的脚本文件的路径
getServerPort():获取服务器的端口号(Port Number)
removeAttribute(String name):删除请求中的一个属性
375. http 响应码(HTTP Status Code) 301 和 302 代表的是什么?有什么区别?
- 知识点: 操作系统与网络 (主题: networking, http;标签: HTTP, 301, 302)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69673754fa809e6d38a406ba | 官方: 是 | 付费: 否
答案:
答案301:永久重定向(Permanent Redirect)。
302:暂时重定向(Temporary Redirect)。
它们的区别是,301 对搜索引擎优化(SEO)(Search Engine Optimization)更加有利;302 有被提示为网络拦截的风险。
376. 说一下 tcp 粘包是怎么产生的?
- 知识点: 操作系统与网络 (主题: networking, tcp;标签: TCP, Sticky Packet)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69673754fa809e6d38a406d1 | 官方: 是 | 付费: 否
答案:
答案tcp 粘包(TCP Sticky Packet)可能发生在发送端或者接收端,分别来看两端各种产生粘包的原因:
- 发送端粘包:发送端需要等缓冲区满才发送出去,造成粘包;
- 接收方粘包:接收方不及时接收缓冲区的包,造成多个接收。
377. 什么是流程建模(Process Modeling)与分析?BA(Business Analyst)为什么需要它?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: process-modeling, business-analysis;标签: business-analyst, optimization, process)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6967574efa809e6d38a7e7dd | 官方: 是 | 付费: 否
答案:
答案流程建模(Process Modeling)是用流程图(Flowchart)、泳道图(Swimlane Diagram)等方式把业务从开始到结束“画出来”,让复杂协作变得可视。BA 通过流程分析(Process Analysis)识别瓶颈、重复与风险点,提出优化建议以降本增效,并为系统改造或产品迭代提供清晰的需求与边界。
378. Python 中与文件相关的模块(File-Related Modules)能做什么?你能举出一些文件相关模块吗?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: python;标签: file, os, shutil)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 6969ab753695832c6e08a527 | 官方: 是 | 付费: 否
答案:
答案Python 自带一些文件相关模块,提供了在文件系统中操作文本文件和二进制文件的函数。这些模块可以用于创建文本/二进制文件、更新内容、复制、删除等。
一些文件相关模块包括 os、os.path 和 shutil.os。os.path 模块包含访问文件系统的函数,而 shutil.os 模块可用于复制或删除文件。
379. 小规模排行榜常用的 cache-aside 读写流程是什么?分别如何处理更新与展示?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: system-design, cache, reliability;标签: cache-aside, websocket, leaderboard)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696dd4bae6ae93548e947f66 | 官方: 是 | 付费: 否
答案:
答案更新流程:客户端与负载均衡(Load Balancer)建立长连接(WebSocket/SSE),请求路由到最近机房;服务端先写关系库,再按 cache-aside 更新缓存(或失效缓存)。展示流程:优先查缓存命中直接返回;未命中再查关系库并回填缓存。该模式实现简单,但要注意一致性窗口与缓存击穿(Cache Penetration)(可用互斥锁(Mutex Lock)/热点保护)。
380. 系统设计面试中的容量评估(Capacity Estimation)要算什么?怎么快速估出量级?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: system-design, architecture, scalability, reliability;标签: capacity, qps, storage, bandwidth, memory)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696ddbfce6ae93548e957c2a | 官方: 是 | 付费: 否
答案:
答案容量评估(Capacity Estimation)的核心,是用数量级指导架构选择(要不要缓存、要不要分片、要不要异步)。不一定每题都要精算,但至少要给出“粗估+关键假设”。
建议覆盖 5 类指标- Users:DAU(Daily Active Users)/MAU(Monthly Active Users)、峰值并发。
- Traffic:读写 QPS、峰值倍率、突发流量(spike)。
- Storage:单条数据大小 × 写入量 × 保留周期(含增长率)。
- Memory:缓存命中目标、热点数据规模、需要多少内存顶住核心读流量。
- Network:入站/出站带宽=QPS × payload 大小(注意图片/视频等大对象)。
表达方式:先说假设(例如 DAU、读写比、单条记录大小),再给出计算结果与结论(例如“需要 Redis 缓存/需要分区/需要 CDN”(Content Delivery Network))。
381. 分布式计数器(Distributed Counter)在系统层面通常是怎么工作的?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: websocket, sse, crdt, distributed-systems;标签: gateway, heartbeat, CRDT)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696de47de6ae93548e966c96 | 官方: 是 | 付费: 否
答案:
答案典型实现会通过网关(Gateway)把计数结果以 WebSocket/SSE(Server-Sent Events)的方式推送给前端,实现“实时刷新”。为防止连接泄漏,会用心跳(Heartbeat)识别并清理不活跃连接。计数存储层通常需要支持多副本(Replication)与分区(Partitioning);在需要跨地域并发写入时,常用基于 CRDT(Conflict-Free Replicated Data Type)的计数器数据类型来做冲突合并,保证在网络分区(Network Partition)/副本延迟下仍能最终收敛到正确值。
382. 实现实时在线人数时,为什么需要 WebSocket(网络套接字)心跳(Heartbeat)?它解决了什么问题?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: websocket, reliability;标签: heartbeat, presence)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696de486e6ae93548e9675fd | 官方: 是 | 付费: 否
答案:
答案在线人数往往依赖“连接是否还活着”来判断用户是否仍在页面上。WebSocket 心跳可以周期性探测连接状态,及时发现断网、浏览器挂起、NAT(Network Address Translation,网络地址转换)超时等导致的“僵尸连接”,并主动清理与触发递减逻辑,避免计数长期虚高。心跳也能作为负载与容量指标,帮助网关做连接分流与限流。
383. P2P(Peer-to-Peer,点对点)网络的“自组织(Self-Organizing)”是什么意思?常见的节点发现方式有哪些?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: system-design, networking;标签: DHT, Peer Discovery, Self-organizing)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696def25623565038f41c596 | 官方: 是 | 付费: 否
答案:
答案自组织指节点动态加入/离开时,网络能自动调整拓扑并维持可用连接与路由,而无需人工集中编排。常见发现方式包括:中心化目录(Centralized Directory,如 tracker/registry)、分布式哈希表(DHT,Distributed Hash Table)用于键到节点的映射、以及 peer exchange/邻居交换协议(Peer Exchange)让节点互相传播可用 peer 列表。
384. P2P 网络为什么通常更容易水平扩展(Horizontal Scaling)?它的扩展上限可能受哪些因素影响?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: system-design, networking;标签: Scalability, NAT Traversal, Overlay Network)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696def25623565038f41c5a3 | 官方: 是 | 付费: 否
答案:
答案随着更多 peer 加入,网络同时获得更多带宽、存储与连接机会,因此容量往往随节点数增长而增长。扩展上限常受制于:节点质量参差(带宽/在线率)、拓扑维护开销(心跳、邻居表)、NAT(Network Address Translation)/防火墙导致直连困难、以及一致性/安全策略带来的额外协议成本。
385. P2P 网络的容错(Fault Tolerance)与冗余(Redundancy)通常怎么做?举例说明“多源下载(Multi-Source Download)”带来的好处。
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: system-design, networking;标签: Redundancy, Chunking, Fault Tolerance)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696def25623565038f41c5ab | 官方: 是 | 付费: 否
答案:
答案常见做法是把数据切分成块并在多个 peer 上形成副本或可替代来源;节点离线时,客户端可从其他 peer 继续拉取。多源下载的好处是:吞吐更高(并行拉取)、更抗故障(某个源断开可切换)、更抗热点(热门内容被更多节点缓存后分摊压力)。
386. P2P 网络的主要优势和主要劣势分别是什么?如何判断某个业务适不适合 P2P?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: system-design, networking;标签: Pros/Cons, Tradeoffs, System Design)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696def25623565038f41c5ae | 官方: 是 | 付费: 否
答案:
答案优势:去中心化(Decentralization)、抗单点故障(Single Point of Failure Resistance)、易水平扩展(Horizontal Scalability)、资源利用率高、基础设施成本更低、直连降低部分场景延迟。劣势:缺乏统一治理、网络管理复杂、依赖 peer 在线与质量、性能波动大、安全与可信更难、以及合规/版权风险。适用性判断可看:是否需要大规模分发/边缘协作、是否允许最终一致(Eventual Consistency)或波动、是否能接受更复杂的安全与运维、以及是否具备激励/治理机制。
387. P2P 技术在即时通信/音视频里通常怎么用?什么时候仍然需要中继服务器(Relay Server)?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: system-design, networking;标签: WebRTC, STUN/TURN, Real-time)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696def26623565038f41c5d8 | 官方: 是 | 付费: 否
答案:
答案音视频通常优先尝试端到端直连(End-to-End Direct Connection)以降低延迟与服务器带宽成本(例如基于 WebRTC,即 Web Real-Time Communication)。但在 NAT(Network Address Translation)/防火墙限制或网络质量差时,直连可能失败或不稳定,此时需要 TURN(Traversal Using Relays around NAT)等中继把媒体流转发出去。工程上常采用“能直连就直连,不能就中继”的自适应策略。
388. 为什么说 P2P 可能引发合规/版权风险?产品设计上可以怎么规避?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: system-design, networking;标签: Compliance, Copyright, Governance)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696def26623565038f41c5e5 | 官方: 是 | 付费: 否
答案:
答案P2P 易被用于未经授权的内容传播(盗版资源共享),平台可能面临版权投诉或合规责任。规避思路包括:只分发自有/授权内容、对内容做签名与白名单校验、完善举报与下架流程、对节点与内容做审计与追踪、以及在敏感区域采用中心化授权与访问控制。
389. P2P(Peer-to-Peer)与加密货币/区块链(Blockchain)的关系是什么?为什么区块链需要 P2P 网络(P2P Network)?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: system-design, networking;标签: Blockchain, Cryptocurrency, P2P)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696def26623565038f41c5e9 | 官方: 是 | 付费: 否
答案:
答案区块链需要一个去中心化的通信与传播层来广播交易与区块,并让节点(Node)彼此同步账本状态。P2P 网络提供节点发现(Node Discovery)、消息传播(Message Propagation)与冗余路径(Redundant Paths),使得系统不依赖单一中心服务器;配合共识机制(Consensus Mechanism),节点可以在不信任环境下达成对账本状态的共同认可。
390. 请描述 OSI 七层模型(OSI Seven-Layer Model),并说明每层的大致职责。
- 知识点: 操作系统与网络 (主题: networking, osi;标签: osi, networking, tcp, ip)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696f113f120fcc1591159282 | 官方: 是 | 付费: 否
答案:
答案OSI 七层:物理层(Physical Layer)传比特;数据链路层(Data Link Layer)负责同链路可靠传输(帧(Frame)/MAC(Media Access Control)/差错);网络层(Network Layer)负责路由(IP(Internet Protocol));传输层(Transport Layer)负责端到端传输与可靠性(TCP(Transmission Control Protocol)/UDP(User Datagram Protocol));会话层(Session Layer)管理会话;表示层(Presentation Layer)做编码转换/压缩/加密;应用层(Application Layer)提供 HTTP(Hypertext Transfer Protocol)/SMTP(Simple Mail Transfer Protocol)/DNS(Domain Name System) 等服务。工程上常用 TCP/IP(Transmission Control Protocol/Internet Protocol),但 OSI 便于分层理解与排障。
391. 操作系统的调度器(Scheduler)是怎么工作的?
- 知识点: 操作系统与网络 / 算法与数据结构 / 系统设计/架构 (主题: operating-systems, scheduling;标签: os, scheduler, threads, cpu)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696f113f120fcc1591159288 | 官方: 是 | 付费: 否
答案:
答案调度器把 CPU 时间分配给进程/线程,目标是在公平、响应、吞吐与实时性之间做平衡。它维护就绪队列(Ready Queue)并按策略选择下一个任务(RR(Round Robin)、优先级(Priority)、MLFQ(Multi-Level Feedback Queue) 等),还要考虑上下文切换(Context Switch)成本、I/O 阻塞唤醒与实时期限。回答要说清目标与策略取舍。
392. 材料中的 Hiring Committee(招聘委员会)会看哪些信息?为什么它是关键一关?
- 知识点: 操作系统与网络 (主题: process, evaluation;标签: hiring-committee, calibration, packet-review)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696f121e120fcc159115a3aa | 官方: 是 | 付费: 否
答案:
答案材料指出 Hiring Committee 由资深工程师组成,会综合审阅完整“packet”,包括:简历、各轮面试评分与文字反馈、内部推荐等(以及可能的 hiring manager(招聘经理)支持说明)。它关键在于:把分散的面试信号做一致性校准,避免单点面试官偏差,并基于标准化维度给出最终录用建议。
393. 解释一下 Python 的全局解释器锁(GIL(Global Interpreter Lock))。它对多线程有什么影响?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: python, concurrency;标签: Python, GIL, Threading)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696f1b27120fcc159116906a | 官方: 是 | 付费: 否
答案:
答案GIL 是 CPython(C Python)的机制:同一进程内同一时刻只允许一个线程执行 Python 字节码(Bytecode),主要用于简化内存管理与保护解释器内部结构。影响是:CPU 密集型任务多线程难以获得并行加速;但 I/O 密集型任务(网络/磁盘)在 I/O 时会释放 GIL,线程仍能提升吞吐。CPU 并行通常用多进程或原生扩展释放 GIL。
394. 如何在 Python 中实现多线程?需要注意什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: python, concurrency;标签: Python, Threading)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696f1b27120fcc1591169099 | 官方: 是 | 付费: 否
答案:
答案可用 threading 模块:定义目标函数 → 创建 Thread(target=...) → 调用 start() 启动并用 join() 等待。注意 GIL:CPU 密集型线程难并行;I/O 密集型更适合。共享数据需用锁(Lock/RLock(Reentrant Lock))、队列(queue)等避免竞态;并做好异常处理与线程生命周期管理。
395. Python 如何进行内存管理?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: python;标签: Python, Memory, GC)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696f1b28120fcc15911690fb | 官方: 是 | 付费: 否
答案:
答案Python 通过自动内存管理完成对象分配与回收。CPython 主要依赖引用计数(Reference Counting)跟踪对象是否仍被引用;当计数为 0 时释放内存。同时还有循环垃圾回收(GC(Garbage Collection))用于处理引用环。开发者通常无需手动释放,但要关注对象生命周期、循环引用与大型对象的内存占用。
396. 什么是 DNS forwarder(DNS 转发器)?它解决了什么问题?
- 知识点: 操作系统与网络 (主题: networking, dns;标签: DNS, Forwarder)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696f35a4120fcc15911a942e | 官方: 是 | 付费: 否
答案:
答案DNS forwarder 是一种会把对外部域名的 DNS 查询转发给其他 DNS 服务器(通常是更上游或权威/公共 DNS)的 DNS 服务器。它会先查本地缓存(Cache),命中则直接返回;未命中则转发查询,从而减轻本地解析压力并提升整体解析效率,也便于组织在本地层面做策略控制与统一管理。
397. 实时操作系统(Real-Time Operating System,RTOS)有哪些类型?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: operating-systems, rtos;标签: Hard/Soft/Firm, deadline, 实时系统)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696f3cca120fcc15911c53b7 | 官方: 是 | 付费: 否
答案:
答案常见分为:硬实时(Hard RTOS)——必须严格按时完成,错过截止期(deadline)会造成严重后果;软实时(Soft RTOS)——偶尔错过截止期可容忍但体验/质量会下降;准实时/稳实时(Firm RTOS)——少量错过可接受,但连续错过会带来明显负面影响。面试加分点:解释“deadline miss 的代价”决定属于哪类。
398. 什么是多线程(multithreading)?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: operating-systems, concurrency;标签: 多线程, 并发风险, 线程池)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696f3cd1120fcc15911c6184 | 官方: 是 | 付费: 否
答案:
答案多线程是一个进程(process)内并发执行多个线程(thread)的模型,线程共享进程资源但各自独立执行,从而提升吞吐、响应速度与资源利用率(尤其在I/O密集或多核CPU场景)。风险点是并发带来的竞态(race condition)、死锁(deadlock)与可见性(visibility)问题,因此需要合理的同步(synchronization)与并发设计(锁粒度、无锁结构、线程池等)。
399. 什么是用户级线程(user-level thread)?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: operating-systems, concurrency;标签: 用户级线程, 线程库, 阻塞问题)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696f3cd7120fcc15911c6781 | 官方: 是 | 付费: 否
答案:
答案用户级线程由用户态线程库管理(创建、调度、同步),内核(kernel)不感知每个线程的存在。优点是创建/切换开销小、可做自定义调度、可移植性强;缺点是遇到阻塞系统调用(blocking system call)时可能阻塞整个进程,且难以充分利用多核并行(取决于实现模型)。
400. 什么是内核级线程(kernel-level thread)?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: operating-systems, concurrency;标签: 内核线程, 多核并行, 调度)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696f3cda120fcc15911c6a25 | 官方: 是 | 付费: 否
答案:
答案内核级线程由操作系统内核直接管理与调度,内核能把不同线程调度到不同CPU核上,从而实现更好的并行性。优点是阻塞不会影响同进程其他线程、可利用多核;缺点是创建与上下文切换(context switch)成本更高,需要更多内核参与。现代主流系统通常支持内核级线程。
401. Java 中的同步(synchronization)是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: synchronized, 锁, 并发)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696f3cde120fcc15911c6d44 | 官方: 是 | 付费: 否
答案:
答案同步用于控制多线程对共享资源的访问顺序,避免竞态导致的数据不一致。Java 常见同步手段包括:synchronized 关键字(对象锁/类锁)、Lock(如ReentrantLock)、以及并发工具类(Semaphore、CountDownLatch等)。面试建议强调:同步解决互斥(mutual exclusion)与可见性问题,但过度使用会降低并发度,需要权衡锁粒度与性能。
402. Java 中 System.gc() 的作用是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, jvm, memory;标签: System.gc, GC触发, 性能影响)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 696f3cde120fcc15911c6d48 | 官方: 是 | 付费: 否
答案:
答案System.gc() 是向 JVM “建议”进行一次垃圾回收(garbage collection,GC)的提示(hint),不保证立刻执行,也可能被忽略。JVM 会根据自身的GC策略、堆压力与启发式规则决定是否触发。实际工程中不建议频繁主动调用,通常通过优化对象生命周期、减少临时对象、调整GC参数来解决内存问题。
403. 操作系统(Operating System,OS)有哪些主要功能?
- 知识点: 操作系统与网络 (主题: operating-system;标签: OS Basics)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: general
- id: 696f4e72120fcc15911fb553 | 官方: 是 | 付费: 否
答案:
An operating system's functions are as follows:
操作系统的功能如下:
- User interface: acts as a conduit between hardware and users.
- Maintains system functionality: monitors system health to assist performance and debugging.
- Security: password protection and prevention of unauthorized access.
- Error detection: continuously monitors to detect errors and prevent failures.
- Memory management: tracks and allocates main memory, schedules access, and releases memory.
- Device management: manages device connectivity via drivers and I/O controllers; allocates/deallocates devices.
- File management: organizes directories/files and tracks storage, access settings, and file status.
404. 在操作系统语境下,解释进程(Process)与线程(Thread)的区别。
- 知识点: 操作系统与网络 (主题: operating-system;标签: Process, Thread)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: general
- id: 696f4e72120fcc15911fb55d | 官方: 是 | 付费: 否
答案:
Process: a program in execution, managed by a PCB (process id, state, priority, registers, etc.). Processes are isolated and take longer to create.
进程:执行中的程序,由 PCB(进程 ID、状态、优先级、寄存器等)管理。进程相互隔离,创建时间较长。
Thread: a segment of a process; a process may have multiple threads. Threads are lighter-weight, faster to create/terminate, and share process memory, but blocking can affect the process.
线程:进程的一个片段;一个进程可包含多个线程。线程更轻量,创建/终止更快,并共享进程内存,但阻塞可能影响整个进程。
405. 在操作系统中,什么是死锁(deadlock)?死锁发生的必要条件是什么?
- 知识点: 操作系统与网络 (主题: operating-system;标签: Deadlock)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: general
- id: 696f4e7a120fcc15911fc059 | 官方: 是 | 付费: 否
答案:
Deadlock occurs when two or more processes hold resources and wait indefinitely for resources held by others.
死锁发生在两个或多个进程持有资源并无限期等待其他进程持有的资源时。
Prerequisites (Coffman conditions):
必要条件(科夫曼条件):
- Mutual exclusion: at least one resource is non-shareable.
- Hold and wait: a process holds resources while requesting others.
- No preemption: resources can't be forcibly taken; only released voluntarily.
- Circular wait: processes wait in a cycle for each other's resources.
406. 从操作系统角度解释什么是虚拟内存(virtual memory)。
- 知识点: 操作系统与网络 (主题: operating-system;标签: Virtual Memory)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: general
- id: 696f4e86120fcc15911fd108 | 官方: 是 | 付费: 否
答案:
Virtual memory is a storage allocation method that lets secondary storage be addressed as if it were main memory. Program-generated addresses are translated to physical machine addresses. It increases the effective address space beyond physical RAM limits, constrained by the system's addressing scheme.
虚拟内存是一种存储分配方法,使辅助存储器可以被当作主内存来寻址。程序生成的地址被转换为物理机器地址。它通过系统寻址方案扩展了超出物理 RAM 限制的有效地址空间。
407. 操作系统中有哪三类调度器(Schedulers)?分别负责什么?
- 知识点: 操作系统与网络 (主题: operating-system;标签: Schedulers)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: general
- id: 696f4e86120fcc15911fd10d | 官方: 是 | 付费: 否
答案:
Schedulers control process/job scheduling:
调度器控制进程/作业调度:
- Long-term scheduler (job scheduler): selects which jobs enter the system and are loaded into memory; balances I/O-bound and CPU-bound workload and controls degree of multiprogramming.
- Medium-term scheduler: swaps processes in/out of main memory to free RAM and reduce multiprogramming degree.
- Short-term scheduler (CPU scheduler/dispatcher): selects the next ready process to run, allocating CPU time to optimize system performance.
408. 请详细解释什么是异步编程(asynchronous programming),以及它解决了什么问题、有哪些常见坑。
- 知识点: 操作系统与网络 (主题: async, concurrency;标签: Async, I/O)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- 公司: Carsales
- id: 69704548120fcc1591308feb | 官方: 是 | 付费: 否
答案:
答案异步编程(asynchronous programming)的核心是:当任务在等待 I/O(网络、磁盘、数据库)时,不阻塞线程,让线程去处理其他工作,从而提高吞吐与资源利用率。常见实现包括:回调(callback)、Promise/Future、async/await、事件循环(event loop)或线程池(thread pool)。
常见坑:忘记 await 导致未捕获异常/竞态;死锁(deadlock)(例如错误地阻塞等待异步结果);过度并发导致资源打爆;上下文切换(context switching)与线程安全问题。建议配合超时、取消(Cancellation)、限流和可观测性。
409. 你在项目中用过哪些编程锁(locks)或并发控制手段?分别适用于什么场景?
- 知识点: 操作系统与网络 (主题: concurrency;标签: Locks, Thread Safety)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- 公司: Carsales
- id: 69704548120fcc1591308ff1 | 官方: 是 | 付费: 否
答案:
答案可按“范围+代价”回答:互斥锁(mutex)/monitor(保护临界区)、读写锁(read-write lock)(读多写少)、信号量(semaphore)(限流/资源池)、自旋锁(spinlock)(极短临界区)、乐观并发(optimistic concurrency)(CAS/版本号)、无锁队列(lock-free queue)/原子操作(atomic operation)。
说明取舍:锁越重越影响吞吐;优先缩小临界区、避免嵌套锁;配合超时与指标监控防止死锁(deadlock)与锁竞争。
410. 请描述你对 Agile 开发方法的理解。
- 知识点: 操作系统与网络 / 行为与软技能 (主题: agile, scrum;标签: agile, scrum)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- 公司: Telstra
- id: 69709b25120fcc15913a2a3a | 官方: 是 | 付费: 否
答案:
答题要点- 核心:迭代交付、快速反馈、持续改进
- Scrum实践:Sprint计划/站会/评审/回顾、Backlog管理
- 工程配套:CI/CD、测试金字塔、DoD、可观测性
示例回答Agile(敏捷开发)强调用短迭代持续交付可用增量,通过反馈快速调整方向。我熟悉 Scrum 的站会、迭代计划、评审与回顾,并会用清晰的DoD(Definition of Done)、自动化测试与CI/CD保证每个迭代都能稳定上线。
411. 你如何处理项目中的变更需求?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: delivery, communication;标签: scope-management, stakeholders)
- 类型: behavioral | 难度: medium | 子类型: behavioral
- 分类: fullstack
- 公司: Telstra
- id: 69709b3e120fcc15913a4064 | 官方: 是 | 付费: 否
答案:
答题要点- 先评估:范围、风险、成本、依赖与截止日期
- 再对齐:和PO/Stakeholder确认优先级与验收标准
- 再落地:拆分任务、更新计划与Backlog,必要时做技术方案/PoC
- 控制风险:分阶段发布、Feature Flag、回滚方案
示例回答我会先评估变更对范围、时间与风险的影响,并和需求方确认优先级与验收标准。然后把变更拆成可交付的迭代,更新Backlog(产品待办列表)与时间线;复杂变更先做PoC(Proof of Concept,概念验证)验证。上线时用Feature Flag(功能开关)或灰度发布控制风险,并准备回滚(rollback)方案。
412. 解释 pointer-to-pointer(指向指针的指针)地址,并用代码说明。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: c, cpp, pointers;标签: Pointer to Pointer, Indirection, Memory)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69773802a39c9c5c3a8e14ac | 官方: 是 | 付费: 否
答案:
答案指向指针的指针(pointer-to-pointer,T)用于保存“另一个指针变量的地址”,因此可以间接修改指针本身(例如在函数中改变指针指向、动态分配二维数组、链表操作等)。例如在 C/C++ 中:int x=10; int p=&x; int pp=&p; 通过 pp 得到 p,通过 **pp 得到 x 的值。它常用于需要在函数内更新指针或处理多级间接引用的场景。
413. 解释 Process(进程)和 Thread(线程)之间的区别。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: operating-systems, concurrency;标签: wipro, freshers, process, thread)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69781f2ea39c9c5c3ab3c569 | 官方: 是 | 付费: 否
答案:
答案Process(进程)是正在执行的程序实例,拥有独立的地址空间(代码、数据、堆、栈等)和系统资源;不同进程默认彼此隔离,需要显式的 IPC(Inter-Process Communication,进程间通信)(如管道、消息队列、共享内存等)才能通信。
Thread(线程)是进程内的轻量级执行单元,多个线程共享同一进程的地址空间与资源(如内存、打开的文件句柄),因此通信更方便,但也更容易因共享数据引发竞态(Race Condition)、死锁(Deadlock)等并发问题,需要同步机制(锁、信号量等)保障线程安全。
414. 编程语言中垃圾回收(Garbage Collection)的目的是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: memory-management, runtime;标签: wipro, freshers, gc)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69781f33a39c9c5c3ab3c975 | 官方: 是 | 付费: 否
答案:
答案垃圾回收(GC,Garbage Collection)的目的,是自动管理内存的分配与释放:识别不再被引用或不可达的对象并回收其占用的内存,从而减少内存泄漏风险、提升资源利用率,并降低开发者手动内存管理的负担。高效的 GC 还能在性能与暂停时间之间做权衡,提升程序稳定性与整体运行效率。
415. 解释多线程(Multithreading)的概念及其优势。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: concurrency, operating-systems;标签: wipro, freshers, multithreading)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69781f33a39c9c5c3ab3c97f | 官方: 是 | 付费: 否
答案:
答案多线程是一种在同一进程内并发运行多个线程的编程方式,每个线程可独立执行任务,从而实现同时处理多个工作负载。其优势包括:提升程序响应速度、提高 CPU 利用率、通过并行执行缩短任务完成时间。但多线程也会带来共享资源的竞争问题,需要使用锁、信号量等同步手段,遵循线程安全(Thread Safety)实践,避免竞态条件(Race Condition)与死锁(Deadlock)。
416. 操作系统(Operating System)在计算机系统中的作用是什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: operating-systems;标签: wipro, os)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 69781f33a39c9c5c3ab3c998 | 官方: 是 | 付费: 否
答案:
答案操作系统(OS,Operating System)是用户/应用与硬件之间的核心中介,负责管理与调度系统资源:进程/线程调度、内存管理、文件系统、设备管理与 I/O(Input/Output,输入/输出)、权限与安全控制等。它通过抽象硬件细节,让应用以统一接口访问底层资源,同时支持多程序并发运行,提升资源利用率与系统稳定性,并为用户提供交互界面与运行环境。
417. Java 中 StringBuilder 和 StringBuffer 有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 / 编程语言基础 (主题: java, concurrency;标签: stringbuilder, stringbuffer)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 697825b8a39c9c5c3ab5859d | 官方: 是 | 付费: 否
答案:
答案StringBuffer 早于 StringBuilder 出现,方法多数带 synchronized,因此线程安全(Thread Safety)但通常更慢;StringBuilder 不做同步,非线程安全,但在单线程场景下性能更好。实际选择:单线程或局部变量拼接用 StringBuilder;多线程共享同一可变字符串时才考虑 StringBuffer(或用更高层并发控制)。
- 线程安全:StringBuffer ✅(synchronized);StringBuilder ❌
- 性能:StringBuilder 通常更快(少了同步开销)
- 使用场景:单线程优先 StringBuilder;共享可变对象再考虑 StringBuffer
418. 什么是析构函数(Destructor)?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: cpp, memory-management;标签: destructor)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 697825c0a39c9c5c3ab58c48 | 官方: 是 | 付费: 否
答案:
答案析构函数(Destructor)用于在对象生命周期结束时释放资源。在 C++ 中析构函数在对象离开作用域或被 delete 时自动调用,用于释放内存、文件句柄、锁等;而在 Java/C# 中主要依赖 GC(Garbage Collection,垃圾回收),通常通过 try-with-resources/using 或显式 close/dispose 来管理外部资源。
419. 什么是同步(Synchronization)?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: synchronization, synchronized)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 697825cca39c9c5c3ab5992f | 官方: 是 | 付费: 否
答案:
答案同步(Synchronization)是控制多个线程对共享资源的访问,保证操作的原子性与可见性,避免数据竞争。Java 中可用 synchronized 关键字实现基于监视器锁的互斥访问,也可用 Lock、Atomic、Semaphore 等并发工具。合理同步可以防止竞态(Race Condition),但过度同步会降低并发性能并可能引入死锁(Deadlock)。
420. 垃圾回收(Garbage Collection)的主要目标是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: memory-management, java;标签: gc)
- 类型: technical | 难度: medium | 子类型:
- 分类: fullstack
- id: 697825d6a39c9c5c3ab5a322 | 官方: 是 | 付费: 否
答案:
答案垃圾回收(GC,Garbage Collection)的主要目标是自动释放程序运行过程中不再被引用(不可达)的对象占用的内存,防止内存泄漏并提升资源利用率。GC 通过可达性分析等方式识别“垃圾对象”,在合适的时机回收;在 JVM(Java Virtual Machine,Java虚拟机)中还会配合分代回收、压缩整理等策略,平衡吞吐与暂停时间。
421. What is the Karat Coding Screen like for Atlassian?
Atlassian 的 Karat 编程筛选是怎样的?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: interviewing;标签: Interview Process)
- 类型: behavioral | 难度: medium | 子类型: scenario
- 分类: general
- 公司: Atlassian
- id: 6979de4fc8f1f94b6462c731 | 官方: 是 | 付费: 否
答案:
通常 60 分钟线上面试,由第三方工程师按 Atlassian rubric 评估。一般包含两道中等算法题 + 调试/小型设计题。重点不仅是做对,还要代码可读、可测试、效率合理,并能清晰讲出取舍与边界情况。
422. What is included in the Virtual Loop at Atlassian?
Atlassian 的 Virtual Loop 包含哪些内容?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: interviewing;标签: Interview Process)
- 类型: behavioral | 难度: medium | 子类型: scenario
- 分类: general
- 公司: Atlassian
- id: 6979de4fc8f1f94b6462c734 | 官方: 是 | 付费: 否
答案:
通常包含多轮:2 轮 Coding、1 轮 System Design、1 轮 Values。Coding 可能要求实现数据结构或解决更贴近业务的场景题;System Design 强调扩展性、可靠性、监控与取舍。
423. How does the Hiring Bar Review work at Atlassian?
Atlassian 的招聘标准审查是如何运作的?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: interviewing;标签: Interview Process)
- 类型: behavioral | 难度: medium | 子类型: scenario
- 分类: general
- 公司: Atlassian
- id: 6979de4fc8f1f94b6462c737 | 官方: 是 | 付费: 否
答案:
面试官会提交校准后的反馈与 P-level 评估信号;独立的 hiring committee 汇总评审后决定最终级别与 offer 结果。根据你展示的影响范围与技术深度,可能出现上/下调级别的情况。
424. Name the file that is used to automatically mount file systems.
命名用于自动挂载文件系统的文件。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1aed | 官方: 否 | 付费: 否
答案:
File that is used to automatically mount file systems is a Fstab file.
用于自动挂载文件系统的文件是 fstab 文件。
425. What is BASH?
什么是 BASH?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1af0 | 官方: 否 | 付费: 否
答案:
BASH (Bourne Again Shell) is basically a command language interpreter. It was written by Brian Fox for GNU OS and can be used in place of Bourne Shell. It is similar to Bourne Shell but includes some additional features such as command-line editing that make it easier and more convenient to use. It is the default user shell on most Linux installations. It is basically an interpreted and non-compiled process that can also run in the terminal window. It is also capable of reading commands from shell scripts.
BASH(Bourne Again Shell)基本上是一种命令语言解释器。它由 Brian Fox 为 GNU 操作系统编写,可用于替代 Bourne Shell。它与 Bourne Shell 类似,但包含一些额外功能(如命令行编辑),使其更易用、更方便。它是大多数 Linux 安装中的默认用户 shell。它基本上是一个解释型、非编译的过程,也可以在终端窗口中运行。它还能从 shell 脚本中读取命令。
426. What is Kernel? Explain its functions.
什么是内核?解释其功能。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: coding
- 分类: fullstack
- id: 69b37b8858d557c902bb1af3 | 官方: 否 | 付费: 否
答案:
A kernel is considered the main component of Linux OS. It is simply a resource manager that acts as a bridge between hardware and software. Its main role is to manage hardware resources for users and is generally used to provide an interface for user-level interaction. A kernel is the first program that is loaded whenever a computer system starts. It is also referred to as low-level system software.
内核被认为是 Linux 操作系统的主要组件。它本质上是一个资源管理器,充当硬件和软件之间的桥梁。其主要作用是为用户管理硬件资源,通常用于提供用户级交互的接口。内核是计算机系统启动时加载的第一个程序。它也被称为低级系统软件。
Its other main functions include: - Memory Management
它的其他主要功能包括: - 内存管理
- Process Management
- Device Management
- Storage Management
- Manage access, and use of various peripherals that are connected to the computer.
427. What are two types of Linux User Mode?
Linux 用户模式有哪两种类型?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1af6 | 官方: 否 | 付费: 否
答案:
There are two types of Linux user mode as given below: - Command Line
Linux 用户模式有两种类型,如下所示:- 命令行
- GUI
428. What is LILO?
什么是 LILO?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1af9 | 官方: 否 | 付费: 否
答案:
LILO (Linux Loader) is basically a bootloader for Linux that is used to load Linux into memory and start the OS. It is also known as a boot manager that facilitates a dual boot of a computer. It can function as either a master boot program or secondary boot program and performs various functions such as locating kernel, identifying other supporting programs, loading memory, and starting the kernel. If you want to use Linux OS, then you need to install a special bootloader i.e., LILO for it as it allows fast boot of Linux OS.
LILO(Linux 加载器)基本上是 Linux 的引导加载程序,用于将 Linux 加载到内存中并启动操作系统。它也被称为引导管理器,便于计算机进行双启动。它既可作为主引导程序,也可作为次引导程序,并执行各种功能,如定位内核、识别其他支持程序、加载内存和启动内核。如果你想使用 Linux 操作系统,则需要为其安装一个特殊的引导加载程序,即 LILO,因为它能实现 Linux 操作系统的快速启动。
- Data Science
- All Events
- My Events
429. What is swap space?
什么是交换空间?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1afc | 官方: 否 | 付费: 否
答案:
Swap space, as the name suggests, is basically a space on a hard disk that is used when the amount of physical memory or RAM is full. It is considered a substitute for physical memory. Its main function is to substitute disk space for RAM memory when real RAM does not have enough space to hold all programs that are executing, and more space is required. In simple words, it can be used as an extension of RAM by Linux.
交换空间,顾名思义,基本上是硬盘上的一块空间,当物理内存或 RAM 已满时使用。它被视为物理内存的替代品。其主要功能是当实际 RAM 没有足够空间容纳所有正在执行的程序且需要更多空间时,用磁盘空间替代 RAM 内存。简单来说,Linux 可将其用作 RAM 的扩展。
430. What do you mean by a Process States in Linux?
在 Linux 中,进程状态指什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1aff | 官方: 否 | 付费: 否
答案:
Linux Process is a type of process that can be in a number of different states. The process enters these states from start till end. Process states in Linux are as follows:
Linux 进程是一种可以处于多种不同状态的进程类型。进程从开始到结束会进入这些状态。Linux 中的进程状态如下:
- New/Ready: In this state, a new process is created and is ready to run.
- Running: In this state, the process is being executed.
- Blocked/Wait: In this state, the process is waiting for input from the user and if doesn't have resources to run such as memory, file locks, input, then it can remain in a waiting or blocked state.
- Terminated/Completed: In this state, the process has completed the execution or terminated by the OS.
- Zombie: In this state, the process is terminated but information regarding the process still exists and is available in the process table.
431. What is Linux Shell? What types of Shells are there in Linux?
什么是 Linux Shell?Linux 中有哪些类型的 Shell?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b02 | 官方: 否 | 付费: 否
答案:
Linux shell is a user interface present between user and kernel. It is used for executing commands and communication with Linux OS. Linux shell is basically a program used by users for executing commands. It accepts human-readable commands as input and converts them into kernel understandable language.
Linux shell 是用户与内核之间的用户界面。它用于执行命令和与 Linux 操作系统通信。Linux shell 基本上是用户用来执行命令的程序。它接受人类可读的命令作为输入,并将其转换为内核可理解的语言。
Different types of shells are commonly used on typical Linux system as listed below: - CSH (C Shell)
典型 Linux 系统上常用的不同 Shell 类型如下所列:- CSH(C Shell)
- KSH (Korn Shell)
- BASH (Bourne Again Shell)
- TCSH
- ZSH
- Bourne Shell
432. Name different types of modes used in VI editor.
说出 VI 编辑器中使用的不同模式类型。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b05 | 官方: 否 | 付费: 否
答案:
VI editor (Visual Editor) is basically a default text editor that usually comes with most of the Linux OS. There are basically three types of modes used in VI editor as given below:
VI 编辑器(可视化编辑器)基本上是大多数 Linux 操作系统自带的默认文本编辑器。VI 编辑器中使用的模式主要有三种,如下所示:
- Command Mode/Regular Mode: It is the default mode for the vi editors. It is generally used to type commands that usually perform particular or specific vi functions. To enter this mode from another mode (Insert mode), one must press [esc]. In simple words, it lets you view the content.
- Insertion Mode/Edit Mode: This mode allows you to do text editing, or type text into a file. To enter this mode from another mode (command mode), one must press [esc]. In simple words, it lets you delete or insert text or content.
- Ex Mode/Replacement Mode: This mode is generally used to save the files and execution of the commands. It basically executes files with different parameters. To enter this mode, one must press [:]. In simple words, it lets you overwrite content or text.
433. What is a maximum length for a filename under Linux?
Linux 下文件名的最大长度是多少?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b08 | 官方: 否 | 付费: 否
答案:
The maximum length for a filename under Linux is 255 bytes.
Linux 下文件名的最大长度是 255 字节。
434. Name the Linux that is specially designed by Sun micro system.
说出由 Sun Microsystems 特别设计的那个 Linux 系统名称。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: system-design
- 分类: fullstack
- id: 69b37b8858d557c902bb1b0b | 官方: 否 | 付费: 否
答案:
Linux that is specially designed by Sun micro system is Solaris.
由 Sun 微系统公司特别设计的 Linux 是 Solaris。
435. Under the Linux system, what is the typical size for swap partitions?
在 Linux 系统下,交换分区的典型大小是多少?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b0f | 官方: 否 | 付费: 否
答案:
The typical size for a swap partition under a Linux system should be twice the amount of physical memory or RAM available on the system.
Linux 系统下交换分区的典型大小应为系统可用物理内存或 RAM 的两倍。
Successful Tech Career for FREE!
免费开启成功的科技职业生涯!
Successful Tech Career!
成功的技术职业生涯!
Interview Process
面试流程
CTC & Designation
CTC与职位级别
Projects on the Job
工作项目
Referral System
推荐系统
Try It Out
试试看
2 Lakh+ Roadmaps Created
已生成20万+职业规划
436. What are file permissions in Linux? Name different types of file systems in Linux.
Linux 中的文件权限是什么?列举 Linux 中不同类型的文件系统。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b12 | 官方: 否 | 付费: 否
答案:
There are three owners in the Linux System i.e., user, group, and others. These owners have three types of permissions defined as listed below: - Read (r): It allows the user to open and read the file or list the directory.
Linux 系统中有三种所有者,即用户、组和其他人。这些所有者拥有三种权限类型,如下所列:- 读(r):它允许用户打开并读取文件或列出目录。
- Write (w): It allows the user to open and modify the file. One can also add new files to the directory.
- Execute (x): It allows the user to execute or run the file. One can also lookup a specific file within a directory.
437. What are basic elements or components of Linux?
Linux 的基本元素或组件是什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b15 | 官方: 否 | 付费: 否
答案:
Linux generally consists of five basic elements or components as given below:
Linux 通常由五个基本元素或组件组成,如下所示:
- Kernel: It is considered a core or main part of Linux and is generally responsible for all major activities of OS such as process management, device management, etc.
- System Library: These are special functions or programs with the help of which application programs or system utilities can access features of the kernel without any requirement of code. It is simply used to implement the functionality of the OS.
- System Utility: These are utility programs that are responsible to perform specialized and individual-level tasks. They are considered more liable and allow users to manage the computer.
- Hardware: It is physical hardware that includes items such as a mouse, keyboard, display, CPU, etc.
- Shell: It is an environment in which we can run our commands, shell scripts, and programs. It is an interface between user and kernel that hides all complexities of functions of the kernel from the user. It is used to execute commands.
438. What is LVM and why is it required?
什么是LVM,为什么需要它?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b18 | 官方: 否 | 付费: 否
答案:
LVM (Logical Volume Management) is basically a tool that provides logical volume management for the Linux kernel. It is being introduced simply to make physical storage device management easier. It also includes allocating disks, striping, mirroring, resizing logical volumes. Its main advantages are increased abstraction, flexibility, and control. It simply allows for flexible disk space management. It is especially required to resize the size of the file system online. In Linux, the size of the LVM partition can be extended using “lvextend” command and can be reduced using “lvreduce” commands, respectively.
LVM(逻辑卷管理)基本上是一种为 Linux 内核提供逻辑卷管理的工具。引入它主要是为了使物理存储设备的管理更简单。它还包括磁盘分配、条带化、镜像和调整逻辑卷大小。其主要优点是提高了抽象性、灵活性和控制力。它仅允许灵活地管理磁盘空间。它尤其需要用于在线调整文件系统大小。在 Linux 中,LVM 分区的大小可以分别使用“lvextend”命令扩展,以及使用“lvreduce”命令缩减。
439. What is a “/proc” file system?
“/proc” 文件系统是什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b1b | 官方: 否 | 付费: 否
答案:
Proc file system is a pseudo or virtual file system that provides an interface to the kernel data structure. It generally includes useful information about processes that are running currently. It can also be used to change some kernel parameters at runtime or during execution. It is also regarded as a control and information center for the kernel. All files under this directory are named virtual files.
Proc 文件系统是一个伪文件系统或虚拟文件系统,它为内核数据结构提供了接口。它通常包含有关当前正在运行的进程的有用信息。它还可以在运行时或执行期间用于更改某些内核参数。它也被视为内核的控制和信息中心。此目录下的所有文件都被命名为虚拟文件。
440. What do you mean by the daemons?
守护进程是什么意思?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b1e | 官方: 否 | 付费: 否
答案:
Daemons also referred to as the background process, is a long-running Linux program that runs in the background. They do not have any controlling terminal, therefore, they run in the background. These are the processes that are generally started when the system is bootstrapped and terminate or end only when the system is shut down. It is simply the way of extending the functionality of the base OS. It provides and offers several functions that are not available in OS. Its main purpose is to handle periodic requests and then forward the requests to the appropriate programs for execution.
守护进程,也称为后台进程,是一个长时间运行并在后台运行的 Linux 程序。它们没有控制终端,因此它们在后台运行。这些进程通常在系统引导时启动,并仅当系统关闭时才终止或结束。它只是扩展基础操作系统功能的一种方式。它提供和提供了操作系统中不可用的几种功能。其主要目的是处理周期性请求,然后将请求转发给适当的程序以执行。
441. Name daemon that controls the print spooling process.
说出控制打印假脱机进程的守护进程名称。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b21 | 官方: 否 | 付费: 否
答案:
The daemon that controls that print spooling process is the Line printing daemon.
控制打印假脱机进程的守护进程是行式打印守护进程。
442. What is a Zombie Process?
什么是僵尸进程?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b24 | 官方: 否 | 付费: 否
答案:
Zombie Process, also referred to as a defunct or dead process in Linux, is a process that has finished the execution, but its entry remains in the process table. It usually happens due to a lack of correspondence between parent and child processes. This process occurs for the child process because the parent process needs to read the status of the child process. Once it is completed using the wait system call, this process is removed from the process table.
僵尸进程,在Linux中也被称为已终止或死亡进程,是指已完成执行但其条目仍保留在进程表中的进程。这通常是由于父子进程之间缺乏对应关系而发生的。该进程针对子进程发生,因为父进程需要读取子进程的状态。一旦使用wait系统调用完成,该进程就会从进程表中移除。
443. What is the difference between cron and anacron?
cron和anacron有什么区别?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b27 | 官方: 否 | 付费: 否
答案:
Cron: It is a program in Linux that is used to execute tasks at a scheduled time. It works effectively on machines that run continuously. Anacron: It is a program in Linux that is used to execute tasks at certain intervals. It works effectively on machines that are powered off in a day or week.
Cron:它是Linux中用于在预定时间执行任务的程序。它在持续运行的机器上有效工作。Anacron:它是Linux中用于在特定时间间隔执行任务的程序。它在一天或一周内关机的机器上有效工作。
| Cron | Anacron |
|---|---|
| It is a daemon. 它是一个守护进程。 | It is not a daemon. 它不是守护进程。 |
| It can be scheduled by any normal user. 任何普通用户都可以调度它。 | It can only be used by super users. 它只能由超级用户使用。 |
| It is considered ideal for servers. 它被认为是服务器的理想选择。 | It is considered ideal for desktops and laptops. 它被认为是台式机和笔记本电脑的理想选择。 |
| It expects the system to run 247 它期望系统全天候运行247 | It does not expect the system to run 247 它不期望系统全天候运行247 |
| Its minimum granularity is in minutes. 它的最小粒度为分钟。 | Its minimum granularity is only in days 它的最小粒度仅为天。 |
| It is used to execute scheduled commands. 它用于执行计划任务。 | It is used to execute commands periodically. 它用于定期执行命令。 |
444. What is load average in Linux?
Linux中的负载平均值是什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b2a | 官方: 否 | 付费: 否
答案:
Load average, as the name suggests, is the average system load on Linux servers being calculated over a given period of time. The load average of Linux servers can be found using “top” and “uptime” commands. It is simply used to keep track of system resources. It is represented by a decimal number starting at 0.00. It tells you the load that the system has been under.
负载平均值,顾名思义,是在给定时间段内计算的Linux服务器上的平均系统负载。可以使用“top”和“uptime”命令找到Linux服务器的负载平均值。它仅用于跟踪系统资源。它以从0.00开始的十进制数表示。它告诉你系统所承受的负载。
445. What do you mean by Shell Script?
你所说的Shell脚本是什么意思?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b2d | 官方: 否 | 付费: 否
答案:
Shell Script, as name suggests, is a script especially written for shell. Here, script means programming language that is being used to control applications. It simply allows the execution of different commands that are entered in the shell. It generally helps you to create complex programs containing conditional statements, loops, and functions. It is very easy to debug, can simplify everyday automation processes, and is much quicker as compared to writing big programs.
Shell脚本,顾名思义,是一种专门为shell编写的脚本。这里,脚本意味着用于控制应用程序的编程语言。它仅允许执行在shell中输入的不同命令。它通常帮助你创建包含条件语句、循环和函数的复杂程序。它非常容易调试,可以简化日常自动化流程,并且比编写大型程序要快得多。
446. What is INODE and Process Id?
什么是INODE和进程ID?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b30 | 官方: 否 | 付费: 否
答案:
INODE: It is a unique name given to each file by OS. Each inode has a unique inode number within a file system. It stores various information about files in Linux such as ownership, file size, file type, access mode, number of links, etc. Process Id (Identifier): It is a unique Id given to each process. It is simply used to uniquely identify an active process throughout the system until the process terminates.
INODE:它是操作系统为每个文件给定的唯一名称。每个inode在文件系统内都有唯一的inode号。它存储Linux中文件的各种信息,如所有权、文件大小、文件类型、访问模式、链接数等。进程ID(标识符):它是分配给每个进程的唯一ID。它仅用于在系统范围内唯一标识活动进程,直到进程终止。
447. Name the first process that is started by the kernel in Linux and what is its process id?
在Linux中,内核启动的第一个进程是什么,它的进程ID是多少?
- 知识点: 操作系统与网络 / 系统设计/架构 / 行为与软技能 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: behavioral | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b33 | 官方: 否 | 付费: 否
答案:
The first process started by the kernel in Linux is “init” and its process id is 1.
Linux中内核启动的第一个进程是“init”,其进程ID为1。
448. What is CLI and GUI?
什么是CLI和GUI?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b36 | 官方: 否 | 付费: 否
答案:
CLI (Command Line Interface): It is basically a command-line program that usually accepts text as input to execute or run functions of the operating system. It allows users to type declarative commands simply to give instructions to the computer to perform or execute operations. It usually requires less memory to use as compared to other interfaces as well as it does not require Windows and a low-resolution monitor can be used. It usually provides greater flexibility of use and can also be used to perform things easily that are most difficult to do with GUI. GUI (Graphical User Interface): It is basically a human-computer interface that allows users to interact with electronic devices through graphical icons and visual indicators. The use of these graphical elements or icons makes it easier for users to interact with the system. It is visually intuitive and allows higher productivity. It is usually a combination of graphical and textual interaction that uses menus, buttons, message boxes, etc.
CLI(命令行界面):它基本上是一个命令行程序,通常接受文本作为输入来执行或运行操作系统的功能。它允许用户简单地输入声明性命令来指示计算机执行操作。与其他界面相比,它通常需要更少的内存,并且不需要Windows,可使用低分辨率显示器。它通常提供更大的使用灵活性,也可以轻松执行用GUI最难以完成的事情。GUI(图形用户界面):它基本上是一种人机界面,允许用户通过图形图标和视觉指示器与电子设备交互。使用这些图形元素或图标使用户更容易与系统交互。它直观易懂,允许更高的生产力。它通常是图形和文本交互的组合,使用菜单、按钮、消息框等。
Linux Networking
449. What are the advantages of using NIC teaming?
使用NIC组合有哪些优点?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b39 | 官方: 否 | 付费: 否
答案:
NIC (Network Interface Card) teaming has several advantages as given below: - Load Balancing
NIC(网络接口卡)组合具有以下几个优点,如下所示: - 负载均衡
- Failover
- Increases uptime
450. What do you mean by Network bonding?
网络绑定是什么意思?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b3c | 官方: 否 | 付费: 否
答案:
Network Bonding, also known as NIC Teaming, is a type of bonding that is used to connect multiple network interfaces into a single interface. It usually improves performance and redundancy simply by increasing network throughput and bandwidth.
网络绑定(也称NIC组合)是一种将多个网络接口连接成单个接口的绑定类型。它通常通过提高网络吞吐量和带宽来改善性能并增加冗余。
451. What are different network bonding modes used in Linux?
Linux中使用哪些不同的网络绑定模式?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8858d557c902bb1b3f | 官方: 否 | 付费: 否
答案:
Different network bonding modes used in Linux are listed below: - Mode-0 (balance-rr): It is the default mode and is based on round-robin policy. It offers features like fault tolerance and load balancing.
Linux中使用的不同网络绑定模式如下:- 模式-0(balance-rr):这是默认模式,基于轮询策略。它提供故障转移和负载均衡等功能。
- Mode-1 (active-backup): It is based on an active-backup policy. In this, only one node responds or works at the time of failure of other nodes.
- Mode-2 (balance-xor): It sets an XOR (exclusive-or) mode for providing load balancing and fault tolerance.
- Mode-3 (broadcast): It is based on broadcast policy. It sets a broadcast mode for providing fault tolerance and can be used only for specific purposes.
- Mode-4 (802.3ad): It is based on IEEE 802.3ad standard also known as Dynamic Link Aggregation mode. It sets an IEEE 802.3ad dynamic link aggregation mode and creates aggregation groups that share the same speed and duplex settings.
- Mode-5 (balance-tlb): It is also known as Adaptive TLB (Transmit Load Balancing). It sets TLB mode for fault tolerance and load balancing. In this mode, traffic will be loaded based on each slave of the network.
- Mode-6 (balance-alb): It is also known as Adaptive Load Balancing. It sets ALB mode for fault tolerance and load balancing. It doesn’t need any special switch support.
452. Name default ports used for DNS, SMTP, FTP, SSH, DHCP and squid.
说出DNS、SMTP、FTP、SSH、DHCP和squid的默认端口。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b42 | 官方: 否 | 付费: 否
答案:
Default ports used for various services are as follows:
各种服务的默认端口如下:
| Service 服务 | Port 端口 |
|---|---|
| DNS | 53 |
| SMTP | 25 |
| FTP | 20 (Data transfer), 21 (Connection established) 20(数据传输),21(建立连接) |
| SSH | 22 |
| DHCP | 67/UDP (dhcp server), 68/UDP (dhcp client) 67/UDP(DHCP服务器),68/UDP(DHCP客户端) |
| squid | 3128 |
453. What is SSH? How we can connect to a remote server via SSH.
什么是SSH?我们如何通过SSH连接到远程服务器。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b45 | 官方: 否 | 付费: 否
答案:
SSH (Secure Shell), as the name suggests, is basically a protocol that is being used to securely connect to remote servers or systems and enables two systems to communicate. It is considered the most common way to have access to remote Linux servers. It generally transmits data over encrypted channels therefore security is considered at a high level. To connect to a remote server via SSH, you need to own a domain name and IP address.
SSH(安全外壳),顾名思义,基本上是一种用于安全连接到远程服务器或系统并使两个系统能够通信的协议。它被认为是访问远程Linux服务器的最常用方式。它通常通过加密通道传输数据,因此安全性被认为是高水平的。要通过SSH连接到远程服务器,你需要拥有一个域名和IP地址。
454. Write the difference between Soft and Hard links?
写出硬链接和软链接之间的区别?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b48 | 官方: 否 | 付费: 否
答案:
Hard Links: It is a special kind of file that points to the same underlying inode as another file. It can be referred to as an additional name for an existing file on Linux OS. Total number of hard links for a file can be displayed using the “ls -l” command. Such links cannot be used across file systems. Hard links can be created using the following command: $ ln [original filename] [link name] Soft Links: It is also termed a symbolic Link. Soft links are kinds of files that usually point to another file. It does not include any amount of data in the target file and simply points to another entry anywhere in the file system. Such links can be used across file systems. Soft links can be created using the following command: $ ln -s [original filename] [link name]
硬链接:这是一种特殊类型的文件,指向与另一个文件相同的底层索引节点。它可以被看作是Linux操作系统中现有文件的额外名称。可以使用“ls -l”命令显示文件的硬链接总数。这种链接不能跨文件系统使用。可以使用以下命令创建硬链接:$ ln [原文件名] [链接名] 软链接:它也称为符号链接。软链接是通常指向另一个文件的文件类型。它不包含目标文件中的任何数据,只是指向文件系统其他位置的另一个条目。这种链接可以跨文件系统使用。可以使用以下命令创建软链接:$ ln -s [原文件名] [链接名]
| Hard Links 硬链接 | Soft Links 软链接 |
|---|---|
| It is considered a mirror copy of the original file. 它被认为是原文件的镜像副本。 | It is considered a symbolic link to the original file. 它被认为是原文件的符号链接。 |
| It usually shares the same inode number. 它通常共享相同的索引节点号。 | It usually shares different inode numbers. 它通常共享不同的索引节点号。 |
| It contains the original contents of the files. 它包含文件的原始内容。 | It does not contain the actual contents but contains the location of the original file. 它不包含实际内容,但包含原文件的地址。 |
| Any changes made to the original file will directly reflect other files. 对原文件所做的任何更改都会直接反映到其他文件。 | Any changes or modifications made to the soft link will directly reflect the original file and its hard links. 对软链接所做的任何更改或修改都会直接反映到原文件及其硬链接。 |
| It cannot be used for linking directories. 它不能用于链接目录。 | It can be used for linking directories. 它可以用于链接目录。 |
| Such links are faster as compared to soft links. 与软链接相比,这种链接更快。 | Such links are slower as compared to hard links. 与硬链接相比,这种链接更慢。 |
455. Name three standard streams in Linux.
说出Linux中的三个标准流。
- 知识点: 操作系统与网络 / 系统设计/架构 / 行为与软技能 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: behavioral | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b4b | 官方: 否 | 付费: 否
答案:
Standard streams are basically I/O (Input and Output) communication channels between a program and its environment in Linux. Input and output in the Linux environment are distributed across three standard streams. Three standard streams in Linux are as follows:
标准流基本上是Linux中程序与其环境之间的I/O(输入和输出)通信通道。Linux环境中的输入和输出分布在三个标准流中。Linux中的三个标准流如下:
Standard Input (stdin) 2. Standard Output (stdout) 3. Standard Error (stderr)
- 标准输入(stdin) 2. 标准输出(stdout) 3. 标准错误(stderr)
456. Why /etc/resolv.conf and /etc/hosts files are used?
为什么使用/etc/resolv.conf和/etc/hosts文件?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b4e | 官方: 否 | 付费: 否
答案:
/etc/resolv.conf: It is used to configure DNS name servers as it contains the details of the nameserver i.e., details of your DNS server. The DNS server is then used to resolve the hostname of the IP address. /etc/hosts: It is used to map or translate any hostname or domain name to its relevant IP address.
/etc/resolv.conf:它用于配置DNS名称服务器,因为它包含名称服务器的详细信息,即DNS服务器的详细信息。随后,DNS服务器用于解析IP地址的主机名。/etc/hosts:它用于将任何主机名或域名映射或转换为其相关的IP地址。
Linux Commands
457. What is the function of grep command?
grep命令的功能是什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: coding
- 分类: fullstack
- id: 69b37b8958d557c902bb1b51 | 官方: 否 | 付费: 否
答案:
Grep (Global regular expression print) is a command that is used to the global search for a string of characters in a specified file. The text search pattern is generally known as a regular expression. It simply makes use of pattern-based searching. Syntax: grep [options] pattern [files] Example: $ grep -c "linux" interview.txt The above command will usually print the total count of the word “Linux” in the file “interview.txt”.
Grep(全局正则表达式打印)是一个命令,用于在指定文件中全局搜索字符串。文本搜索模式通常称为正则表达式。它主要利用基于模式的搜索。语法:grep [选项] 模式 [文件] 示例:$ grep -c "linux" interview.txt 上述命令通常会打印文件“interview.txt”中单词“Linux”的总数。
458. What is netstat command?
netstat命令是什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b54 | 官方: 否 | 付费: 否
答案:
netstat (Network statics) command is generally a networking tool being used for troubleshooting and configuration and used to display all network connections on a system. It simply provides a way to check whether various aspects of TCP/IP are working and what connections are present.
netstat(网络统计)命令通常是一个用于故障排除和配置的网络工具,用于显示系统上所有网络连接。它主要提供一种方法来检查TCP/IP的各个方面是否正常工作以及存在哪些连接。
459. What is the ping command?
ping命令是什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b57 | 官方: 否 | 付费: 否
答案:
Linux ping (Packet Internet Groper) command is a command that is used to check connection status between source and destination. In simple words, this command is used to check whether a network is available and if the host is reachable. It can also be used to troubleshoot different connectivity issues, verify connectivity at an IP -level to a second TCP/IP device, and name resolution. One can use this command to test both the computer name and IP address of the computer.
Linux ping(包互联网探测器)命令是一个用于检查源和目标之间连接状态的命令。简单来说,该命令用于检查网络是否可用以及主机是否可达。它还可以用于排除各种连接问题,验证到第二个TCP/IP设备的IP级别连接性,以及名称解析。可以使用此命令测试计算机名称和计算机的IP地址。
460. Which command is used to check the default run level?
哪个命令用于检查默认运行级别?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b5a | 官方: 否 | 付费: 否
答案:
The command used to check the default run level is “/etc/inittab”.
用于检查默认运行级别的命令是“/etc/inittab”。
461. Which command is used to check the size of file or directory?
哪个命令用于检查文件或目录的大小?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b5d | 官方: 否 | 付费: 否
答案:
The command used to check the size of the file or directory is “du”. Here “du” stands for disk usage that is used to check information of disk usage of files and directories on a machine. It is also used to display files and directory sizes in a recursive manner. Example: $ du -sh /var/log/* 1.8M /var/log/anaconda 384K /var/log/audit 4.0K /var/log/boot.log 0 /var/log/chrony 4.0K /var/log/cron 4.0K /var/log/maillog 64K /var/log/messages
用于检查文件或目录大小的命令是“du”。这里的“du”代表磁盘使用量,用于检查机器上文件和目录的磁盘使用信息。它还用于以递归方式显示文件和目录的大小。示例:$ du -sh /var/log/* 1.8M /var/log/anaconda 384K /var/log/audit 4.0K /var/log/boot.log 0 /var/log/chrony 4.0K /var/log/cron 4.0K /var/log/maillog 64K /var/log/messages
462. Which command is used to count the number of characters in a file?
哪个命令用于计算文件中的字符数?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b60 | 官方: 否 | 付费: 否
答案:
The command that is used to count the number of characters in a file in Linux is “wc”. Here “wc” stands for word count. It is used to count the number of lines, words, and characters in a text file.
在Linux中用于计算文件中字符数的命令是“wc”。这里的“wc”代表单词计数。它用于计算文本文件中的行数、单词数和字符数。
463. Explain working of env command.
解释env命令的工作方式。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b63 | 官方: 否 | 付费: 否
答案:
“env” command is basically a shell command that is used to print a list of current environmental variables. Here, “env” stands for the environment. It can also run another process in another environment without any modification of the current environment. It allows you to run programs in a modified environment. It is generally used by shell scripts to launch the correct interpreter. It can also be useful for checking if wrong environment variables prevent the application from starting during troubleshooting. Example: $env PHYTHON_PIP_VERSION=9.0L1 HOME=/root DB_NAME=test PATH=/usr/local/bin:/usr/local/sbin LAND=C.UTF=8 PYTHON_VERSION=3.4.6 PWD=/ DB_URI=mongodb://database:27017/test
“env”命令基本上是一个shell命令,用于打印当前环境变量的列表。这里的“env”代表环境。它还可以在另一个环境中运行另一个进程,而无需修改当前环境。它允许你在修改后的环境中运行程序。它通常被shell脚本用来启动正确的解释器。在故障排除时,它也有助于检查错误的环境变量是否阻止应用程序启动。示例:$env PHYTHON_PIP_VERSION=9.0L1 HOME=/root DB_NAME=test PATH=/usr/local/bin:/usr/local/sbin LAND=C.UTF=8 PYTHON_VERSION=3.4.6 PWD=/ DB_URI=mongodb://database:27017/test
464. What is the pwd command?
pwd命令是什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b66 | 官方: 否 | 付费: 否
答案:
“pwd” command is basically a command that is used to print the complete path of the current working directory starting from the root (/). Here, “pwd” stands for Print Working Directory. It is considered one of the most basic and most used commands in Linux. This command is usually a built-in shell command and is also available in different shells such as bash, ksh, zsh, bourne shell, etc.
“pwd”命令基本上是一个用于打印当前工作目录从根目录(/)开始的完整路径的命令。这里,“pwd”代表打印工作目录。它被认为是Linux中最基本和最常用的命令之一。此命令通常是shell的内置命令,也可在不同shell中使用,如bash、ksh、zsh、bourne shell等。
465. Name the command that is used to check all the listening ports and services of your machine.
说出用于检查机器上所有监听端口和服务的命令名称。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b69 | 官方: 否 | 付费: 否
答案:
netstat -ntlp
466. Which command is used to check the memory status?
哪个命令用于检查内存状态?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b6c | 官方: 否 | 付费: 否
答案:
The command used mostly to check memory status in Linux is “free”. Other commands that can be used are given below: - “cat” command: It can be used to show or display Linux memory information. (cat/proc/meminfo)
在Linux中主要用于检查内存状态的命令是“free”。其他可以使用的命令如下:- “cat”命令:可用于显示或展示Linux内存信息。(cat/proc/meminfo)
- “vmstat” command: It can be used to report statistics of virtual memory.
- “top” command: It can be used to check the usage of memory.
- “htop” command: It can be used to find the memory load of each process.
467. What is pipe?
什么是管道?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b6f | 官方: 否 | 付费: 否
答案:
In Linux, a pipe is basically a form of redirection that is used to send the output of one command to another command for further processing. It simply takes the output from one command and uses it as an input for another. It provides asynchronous execution of commands with help of buffered I/O routines.
在Linux中,管道基本上是一种重定向形式,用于将一个命令的输出发送到另一个命令以进行进一步处理。它简单地将一个命令的输出作为另一个命令的输入。它借助缓冲I/O例程提供命令的异步执行。
468. What are Linux directory commands?
什么是Linux目录命令?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b72 | 官方: 否 | 付费: 否
答案:
There are basically five Linux directory commands that are used to work with files and directories as given below: - pwd: It stands for “print working directory”. This command is generally used to display the path of the present or current working directory. Syntax: $ pwd
基本上有五个用于处理文件和目录的Linux目录命令,如下所示:- pwd:代表“打印工作目录”。该命令通常用于显示当前工作目录的路径。语法:$ pwd
- cd: It stands for “change directory”. This command is generally used to change the present working directory to the directory that we want to work on. Syntax: $ cd
- Is: It stands for “list”. This command is generally used to show the full list of content of files and directories in the present working directory. Syntax: $ ls
- mkdir: It stands for “make directory”. This command generally allows users to create directories in Linux. Syntax: $ mkdir
- rmdir: It stands for “remove directory”. This command is used to remove/delete each directory that is specified on the command line. Syntax: $ rmdir
469. What do you mean by unmask?
unmask是什么意思?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b7a | 官方: 否 | 付费: 否
答案:
Umask, also known as user file-creation mask, is a Linux command that allows you to set up default permissions for new files and folders that you create. In Linux OS, umask command is used to set default file and folder permission. It is also used by other commands in Linux like mkdir, tee, touch, etc. that create files and directories. Syntax: umask [-p] [-S] [mask]
Umask,也称为用户文件创建掩码,是一个Linux命令,允许你为创建的新文件和文件夹设置默认权限。在Linux操作系统中,umask命令用于设置默认的文件和文件夹权限。它也被Linux中其他创建文件和目录的命令使用,如mkdir、tee、touch等。语法:umask [-p] [-S] [mask]
Where, [mask]: It represents the permission masks that you are applying. [-S]: It displays the current mask as a symbolic value. [-p]: It displays the current mask along with umask command thus allowing it to be copied and pasted as a future input.
其中,[mask]:表示你正在应用权限掩码。[-S]:以符号值显示当前掩码。[-p]:显示当前掩码以及umask命令,从而允许将其复制粘贴作为未来输入。
470. Name the command used to review boot messages.
说出用于查看启动消息的命令名称。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b7e | 官方: 否 | 付费: 否
答案:
The command that is used to review boot messages is the “dmesg” command.
用于查看启动消息的命令是“dmesg”命令。
Linux vs Other OS
471. Write difference between Linux and Unix.
写出Linux和Unix之间的区别。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b81 | 官方: 否 | 付费: 否
答案:
Linux: It is an open-source and free-to-use Operating system that was first developed in 1991 by Linus Torvalds. It is specially designed to offer free and low-cost OS for personal computer users. It has very low hardware requirements and facilitates powerful support for networking. Different versions of Linux are known as variants. Example: Red Hat, Android, etc. Unix: It is a closed source OS derived from the original AT&T Unix and was first developed in the 1960s. It is not open source and is not free to use. It is generally capable of handling activities from multiple users at the same time. Furthermore, it is specially designed to be more portable, multi-user, and multitasking in a time-sharing configuration. Different versions of Unix are known as distros. Example: HP-UX, Solaris, etc.
Linux:它是一个开源且免费使用的操作系统,由Linus Torvalds于1991年首次开发。它专门设计为个人电脑用户提供免费且低成本的OS。它对硬件要求很低,并为网络提供强大的支持。Linux的不同版本被称为变体。例如:Red Hat、Android等。Unix:它是一个源自原始AT&T Unix的闭源操作系统,首次开发于1960年代。它不是开源的,也不是免费使用的。它通常能够同时处理多个用户的活动。此外,它专门设计为在分时配置中更便携、多用户和多任务。Unix的不同版本被称为发行版。例如:HP-UX、Solaris等。
| Linux | Unix |
|---|---|
| It is mostly used for computer software and hardware, tablet PCS, mainframes, etc. 它主要用于计算机软件和硬件、平板电脑、大型机等。 | It is mostly used on web servers, workstations, mainframes, and PCs but Intel, HP, etc. 它主要用于Web服务器、工作站、大型机和PC,但Intel、HP等除外。 |
| It can be used by everyone as it is freely available. 因为它免费可用,每个人都可以使用。 | It can be used only by its copywriters who have access to it. 只有拥有访问权的版权所有者可以使用它。 |
| It is considered just the kernel. 它被认为只是内核。 | It is considered a complete package of OS. 它被认为是完整的OS包。 |
| It supports more file systems than Unix and its file support system includes Ext2, Ext3, Xfs, FAT, etc. 它比Unix支持更多文件系统,其文件支持系统包括Ext2、Ext3、Xfs、FAT等。 | It supports a lesser file system as compared to Linux and its file support system includes gpfs, hfs, jfs, etc. 与Linux相比,它支持较少的文件系统,其文件支持系统包括gpfs、hfs、jfs等。 |
| Its source code is available to the general public. 其源代码对公众开放。 | Its source code is not available to the general public. 其源代码不对公众开放。 |
| It is freely distributed and is free of cost. 它自由分发且免费。 | It is not freely distributed and comes with a customized cost. 它不自由分发,并带有定制成本。 |
| It is portable and can be executed on different hard drives. 它是可移植的,可以在不同硬盘上执行。 | It is non-portable. 它是不可移植的。 |
| Its installation does not require any specific hardware components. 其安装不需要任何特定的硬件组件。 | Its installations require specific hardware components. 其安装需要特定的硬件组件。 |
| It is more compatible and flexible with different hardware systems available. 它与可用的不同硬件系统更兼容和灵活。 | It is less compatible and flexible with different hardware systems as compared to Linux. 与Linux相比,它与不同硬件系统的兼容性和灵活性较低。 |
| Its default shell is BASH. 其默认shell是BASH。 | Its default shell is Bourne Shell. 其默认shell是Bourne Shell。 |
472. What is the difference between BASH and DOS?
BASH(Bourne Again Shell)和DOS(磁盘操作系统)有什么区别?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b84 | 官方: 否 | 付费: 否
答案:
BASH (Bourne Again Shell) : It is basically a powerful command shell and scripting language that is being developed from the Bourne shell used on UNIX systems. It runs on multiple OS and new features are added regularly. It can read and execute commands from a file known as a shell script. DOS (Disk Operating System) : It is basically an OS that runs from a hard disk drive. It was the first OS system used by IBM-compatible computers. It basically provides a command-line in which users are allowed to give instructions in the form of commands.
BASH(Bourne Again Shell):它基本上是一个强大的命令壳和脚本语言,是从UNIX系统上使用的Bourne shell开发而来的。它可在多种操作系统上运行,并且定期添加新功能。它可以读取并执行来自称为shell脚本的文件中的命令。DOS(磁盘操作系统):它基本上是一种从硬盘驱动器运行的操作系统。它是IBM兼容计算机使用的第一个操作系统。它主要提供一个命令行,用户可以在其中以命令形式给出指令。
| BASH | DOS |
|---|---|
| In BASH, commands are case-sensitive. 在BASH中,命令区分大小写。 | In DOS, commands are not case-sensitive. 在DOS中,命令不区分大小写。 |
| In this, / character are directory separator and \ acts as an escape character. 在BASH中,/字符是目录分隔符,而\充当转义字符。 | In this, \ is a directory separator and / acts as a command argument delimiter. 在DOS中,\是目录分隔符,而/充当命令参数分隔符。 |
| It can take input with its built-in “read” command. 它可以使用内置的“read”命令获取输入。 | It cannot take input during run time and one can only pass “/argument” during execution from the command line. 它在运行时无法获取输入,只能在执行期间从命令行传递“/argument”。 |
473. What is samba? Why is it required?
什么是samba?为什么需要它?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: linux, systems;标签: interviewbit, linux, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37b8958d557c902bb1b87 | 官方: 否 | 付费: 否
答案:
Samba is basically an open-source software suite. It runs a number of different Operating systems such as OpenVMS, IBM , etc. It is generally used to connect Linux machines to Microsoft network resources simply by providing Microsoft SMB support. It provides more secure, stable, fast file and print services for every client or user using SMB (Server Message Block) or CIFS (Central Server Message Block) protocol.
Samba基本上是一个开源软件套件。它可运行在多种不同的操作系统上,如OpenVMS、IBM等。它通常用于通过提供Microsoft SMB支持来将Linux机器连接到Microsoft网络资源。它为使用SMB(服务器消息块)或CIFS(中央服务器消息块)协议的每个客户端或用户提供更安全、稳定、快速的文件和打印服务。
474. What is the SMTP protocol?
什么是SMTP协议?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb627d | 官方: 否 | 付费: 否
答案:
SMTP is the Simple Mail Transfer Protocol. SMTP sets the rule for communication between servers. This set of rules helps the software to transmit emails over the internet. It supports both End-to-End and Store-and-Forward methods. It is in always-listening mode on port 25.
SMTP是简单邮件传输协议。SMTP为服务器之间的通信制定规则。这套规则帮助软件通过互联网传输电子邮件。它支持端到端和存储转发两种方法。它始终在端口25上处于监听模式。
SMTP Protocol
SMTP协议
475. What are the HTTP and the HTTPS protocol?
HTTP 和 HTTPS 协议是什么?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6280 | 官方: 否 | 付费: 否
答案:
HTTP is the HyperText Transfer Protocol which defines the set of rules and standards on how the information can be transmitted on the World Wide Web (WWW). It helps the web browsers and web servers for communication. It is a ‘stateless protocol’ where each command is independent with respect to the previous command. HTTP is an application layer protocol built upon the TCP. It uses port 80 by default.
HTTP是超文本传输协议,它定义了在万维网(WWW)上如何传输信息的规则和标准。它帮助Web浏览器和Web服务器进行通信。它是一种“无状态协议”,其中每个命令相对于前一个命令是独立的。HTTP是建立在TCP之上的应用层协议。它默认使用端口80。
HTTPS is the HyperText Transfer Protocol Secure or Secure HTTP. It is an advanced and secured version of HTTP. On top of HTTP, SSL/TLS protocol is used to provide security. It enables secure transactions by encrypting the communication and also helps identify network servers securely. It uses port 443 by default.
HTTPS是超文本传输协议安全版或安全HTTP。它是HTTP的高级和安全版本。在HTTP之上,使用SSL/TLS协议来提供安全性。它通过加密通信实现安全事务,并帮助安全地识别网络服务器。它默认使用端口443。
476. Differentiate OSI Reference Model with TCP/IP Reference Model
区分OSI参考模型与TCP/IP参考模型
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6283 | 官方: 否 | 付费: 否
答案:
OSI Vs TCP/IP
OSI与TCP/IP
| OSI Reference Model OSI参考模型 | TCP/IP Reference Model TCP/IP参考模型 |
|---|---|
| 7 layered architecture 7层架构 | 4 layered architecture 4层架构 |
| Fixed boundaries and functionality for each layer 每层具有固定边界和功能 | Flexible architecture with no strict boundaries between layers 灵活架构,层间无严格边界 |
| Low Reliability 低可靠性 | High Reliability 高可靠性 |
| Vertical Layer Approach 垂直分层方法 | Horizontal Layer Approach 水平分层方法 |
477. Define the 4 different layers of the TCP/IP Reference Model
定义TCP/IP参考模型的4个不同层
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6286 | 官方: 否 | 付费: 否
答案:
Layers of TCP/IP
TCP/IP的层
| Layer 层 | Description 描述 |
|---|---|
| Link 链路层 | Decides which links such as serial lines or classic Ethernet must be used to meet the needs of the connectionless internet layer. 决定必须使用哪些链路(如串行线路或经典以太网)来满足无连接互联网层的需求。 |
| Internet 互联网层 | The internet layer is the most important layer which holds the whole architecture together. It delivers the IP packets where they are supposed to be delivered. 互联网层是最重要的层,它将整个架构紧密相连。它将IP数据包传送到它们应被送达的位置。 |
| Transport 传输层 | Its functionality is almost the same as the OSI transport layer. It enables peer entities on the network to carry on a conversation. 其功能与OSI传输层几乎相同。它使网络上的对等实体能够进行对话。 |
| Application 应用层 | It contains all the higher-level protocols. 它包含所有更高层的协议。 |
478. Describe the TCP/IP Reference Model
描述 TCP/IP 参考模型
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6289 | 官方: 否 | 付费: 否
答案:
It is a compressed version of the OSI model with only 4 layers. It was developed by the US Department of Defence (DoD) in the 1980s. The name of this model is based on 2 standard protocols used i.e. TCP (Transmission Control Protocol) and IP (Internet Protocol).
它是 OSI 模型的压缩版本,仅包含 4 层。它由美国国防部(DoD)在 20 世纪 80 年代开发。该模型的名称基于所使用的两种标准协议,即 TCP(传输控制协议)和 IP(网际协议)。
479. Define the 7 different layers of the OSI Reference Model
定义 OSI 参考模型的 7 个不同层
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb628c | 官方: 否 | 付费: 否
答案:
Here the 7 layers of the OSI reference model:
以下是 OSI 参考模型的 7 层:
Layers of OSI Model
OSI 模型各层
| Layer 层 | Unit Exchanged 交换单元 | Description 描述 |
|---|---|---|
| Physical 物理层 | Bit 比特 | It is concerned with transmitting raw bits over a communication channel. Chooses which type of transmission mode is to be selected for the transmission. The available transmission modes are Simplex, Half Duplex and Full Duplex., 它关注通过通信信道传输原始比特。选择传输中要使用的传输模式类型。可用的传输模式有单工、半双工和全双工。 |
| Data Link 数据链路层 | Frame 帧 | The main task of this layer is to transform a raw transmission facility into a line that appears free of undetected transmission errors. It also allows detecting damaged packets using the CRC (Cyclic Redundancy Check) error-detecting, code. When more than one node is connected to a shared link, Data Link Layer protocols are required to determine which device has control over the link at a given time. It is implemented by protocols like CSMA/CD, CSMA/CA, ALOHA, and Token Passing. 该层的主要任务是将原始传输设施转换为看起来没有未检测到的传输错误的线路。它还允许使用 CRC(循环冗余校验)错误检测代码检测损坏的数据包。当多个节点连接到共享链路时,需要数据链路层协议来确定在给定时间内哪个设备控制链路。它通过 CSMA/CD、CSMA/CA、ALOHA 和令牌传递等协议实现。 |
| Network 网络层 | Packet 数据包 | It controls the operation of the subnet. The network layer takes care of feedback messaging through ICMP messages. 它控制子网的操作。网络层通过 ICMP 消息处理反馈消息。 |
| Transport 传输层 | TPDU - Transaction Protocol Data Unit TPDU - 事务协议数据单元 | The basic functionality of this layer is to accept data from the above layers, split it up into smaller units if needed, pass these to the network layer, and ensure that all the pieces arrive correctly at the other end. The Transport Layer takes care of Segmentation and Reassembly. 该层的基本功能是从上层接受数据,如果需要则将其拆分为更小的单元,将这些单元传递给网络层,并确保所有部分正确到达另一端。传输层负责分段和重组。 |
| Session 会话层 | SPDU - Session Protocol Data Unit SPDU - 会话协议数据单元 | The session layer allows users on different machines to establish sessions between them. Dialogue control is using the full-duplex link as half-duplex. It sends out dummy packets from the client to the server when the client is ideal. 会话层允许不同机器上的用户之间建立会话。对话控制使用全双工链路作为半双工。当客户端空闲时,它会从客户端向服务器发送虚拟数据包。 |
| Presentation 表示层 | PPDU - Presentation Protocol Data Unit PPDU - 表示协议数据单元 | The presentation layer is concerned with the syntax and semantics of the information transmitted. It translates a message from a common form to the encoded format which will be understood by the receiver. 表示层关注传输信息的语法和语义。它将消息从通用形式转换为接收方能够理解的编码格式。 |
| Application 应用层 | APDU - Application Protocol Data Unit APDU - 应用协议数据单元 | It contains a variety of protocols that are commonly needed by users. The application layer sends data of any size to the transport layer. 它包含用户通常需要的各种协议。应用层将任意大小的数据发送到传输层。 |
480. Describe the OSI Reference Model
描述 OSI 参考模型
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6291 | 官方: 否 | 付费: 否
答案:
Open System Interconnections (OSI) is a network architecture model based on the ISO standards. It is called the OSI model as it deals with connecting the systems that are open for communication with other systems.
开放系统互连(OSI)是基于 ISO 标准的网络架构模型。它被称为 OSI 模型,因为它涉及连接对其他系统开放通信的系统。
The OSI model has seven layers. The principles used to arrive at the seven layers can be summarized briefly as below: - Create a new layer if a different abstraction is needed.
OSI 模型有七层。用于得出这七层的原则可以简要概括如下:- 如果需要不同的抽象,则创建新层。
- Each layer should have a well-defined function.
- The function of each layer is chosen based on internationally standardized protocols.
481. What is the DNS?
什么是 DNS?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6294 | 官方: 否 | 付费: 否
答案:
DNS is the Domain Name System. It is considered as the devices/services directory of the Internet. It is a decentralized and hierarchical naming system for devices/services connected to the Internet. It translates the domain names to their corresponding IPs. For e.g. interviewbit.com to 172.217.166.36. It uses port 53 by default.
DNS 是域名系统。它被认为是互联网的设备/服务目录。它是为连接到互联网的设备/服务设计的去中心化和层次化的命名系统。它将域名转换为相应的 IP 地址。例如,将 interviewbit.com 转换为 172.217.166.36。它默认使用端口 53。
482. What is the use of a router and how is it different from a gateway?
路由器的用途是什么?它与网关有何不同?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6297 | 官方: 否 | 付费: 否
答案:
The router is a networking device used for connecting two or more network segments. It directs the traffic in the network. It transfers information and data like web pages, emails, images, videos, etc. from source to destination in the form of packets. It operates at the network layer. The gateways are also used to route and regulate the network traffic but, they can also send data between two dissimilar networks while a router can only send data to similar networks.
路由器是一种用于连接两个或多个网络段的网络设备。它引导网络中的流量。它以数据包的形式将信息(如网页、电子邮件、图像、视频等)从源传输到目的地。它工作在网络层。网关也用于路由和调节网络流量,但它们还可以在不同类型的网络之间发送数据,而路由器只能向相似网络发送数据。
483. What is tcpdump and how do you capture traffic for a specific host or port?
什么是 tcpdump,如何捕获特定主机或端口的流量?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb629a | 官方: 否 | 付费: 否
答案:
tcpdump is a command-line packet capture tool used to inspect network traffic at the packet level. It is commonly used for debugging connectivity issues, protocol behavior, and unexpected network traffic.
tcpdump 是一个命令行数据包捕获工具,用于在数据包级别检查网络流量。它通常用于调试连接问题、协议行为和意外网络流量。
Capture traffic for a specific host: tcpdump host 192.168.1.10
捕获特定主机的流量:tcpdump host 192.168.1.10
Capture traffic for a specific port: tcpdump port 443
捕获特定端口的流量:tcpdump port 443
Capture traffic for both host and port: tcpdump host example.com and port 443
同时捕获主机和端口的流量:tcpdump host example.com and port 443
tcpdump captures packets in real time and displays header-level details. It is often used alongside tools like Wireshark for deeper packet analysis.
tcpdump 实时捕获数据包并显示头部详细信息。它常与 Wireshark 等工具一起使用,以进行更深入的数据包分析。
484. What are common TCP flags (SYN, ACK, FIN, RST) and how do they appear in packet captures?
常见的 TCP 标志(SYN、ACK、FIN、RST)有哪些,它们如何在数据包捕获中显示?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb629d | 官方: 否 | 付费: 否
答案:
TCP flags control the state of a TCP connection and are visible in packet captures such as tcpdump . - SYN: Used to initiate a connection
TCP 标志控制 TCP 连接的状态,并可在 tcpdump 等数据包捕获中看到。- SYN:用于发起连接
- ACK: Acknowledges received data
- FIN: Gracefully closes a connection
RST: Immediately resets a connection due to an error or refusal
How they appear in packet captures: - A normal connection starts with SYN -> SYN-ACK -> ACK在数据包捕获中如何显示:- 正常连接以 SYN -> SYN-ACK -> ACK 开始
- Connection termination uses FIN/ACK exchanges
RST packets indicate connection refusal, crashes, or policy blocks
In tcpdump, flags appear in shorthand, for example:在 tcpdump 中,标志以简写形式出现,例如:
S (SYN), S . (SYN-ACK), . (ACK), F (FIN), R (RST)
S(SYN)、S.(SYN-ACK)、.(ACK)、F(FIN)、R(RST)
485. What logs or paths help in Linux networking debugging?
哪些日志或路径有助于 Linux 网络调试?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62a0 | 官方: 否 | 付费: 否
答案:
Several logs and system paths are useful when diagnosing Linux networking issues.
诊断 Linux 网络问题时,有多个日志和系统路径很有用。
Common places to check include: - System logs (/var/log/syslog or /var/log/messages) for general network errors
常检查的地方包括:- 系统日志(/var/log/syslog 或 /var/log/messages)用于查看一般网络错误
NetworkManager logs for interface and connection issues
Kernel logs using: dmesg使用内核日志:dmesg
to identify driver, interface, or hardware-related problems
以识别驱动、接口或硬件相关问题
These logs help correlate network failures with configuration changes, driver issues, or system events.
这些日志有助于将网络故障与配置更改、驱动问题或系统事件相关联。
486. What is the Linux routing table and how do you add a static route temporarily?
什么是 Linux 路由表,如何临时添加静态路由?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62a3 | 官方: 否 | 付费: 否
答案:
The routing table defines how network traffic is forwarded from the system to different networks. It determines which gateway or interface is used to reach a destination.
路由表定义了网络流量如何从系统转发到不同网络。它决定了用于到达目的地的网关或接口。
View the routing table: ip route
查看路由表:ip route
Add a temporary static route: ip route add 10.0.0.0/24 via 192.168.1.1
添加临时静态路由:ip route add 10.0.0.0/24 via 192.168.1.1
This route remains active until reboot or network restart.
此路由在重启或网络重启之前保持有效。
Temporary static routes are often added for testing connectivity or debugging routing issues before making permanent configuration change
在进行永久配置更改之前,通常添加临时静态路由以测试连通性或调试路由问题。
487. Where do you check established connections and socket states?
在哪里检查已建立的连接和套接字状态?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62a8 | 官方: 否 | 付费: 否
答案:
Established connections and socket states can be checked using the ss command, which provides detailed and real-time socket information.
可以使用ss命令检查已建立的连接和套接字状态,该命令提供详细且实时的套接字信息。
Check summary of socket states: ss -s
检查套接字状态摘要:ss -s
This shows counts of: - Established connections
这将显示以下计数:- 已建立的连接
- Listening sockets
Time-wait, closed, and other TCP states
Check detailed active connections:检查详细的活跃连接:
ss -ant - -a -> all sockets
ss -ant - -a -> 所有套接字
- -n -> numeric output
-t -> TCP sockets
This is commonly used to inspect active connections, ports in use, and connection states during troubleshooting.这在故障排除中常用于检查活跃连接、使用中的端口和连接状态。
488. What is MTU and how do you debug MTU-related issues?
什么是MTU,如何调试与MTU相关的问题?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62ab | 官方: 否 | 付费: 否
答案:
MTU (Maximum Transmission Unit) defines the largest packet size that can be transmitted over a network interface without fragmentation. The standard Ethernet MTU is 1500 bytes .
MTU(最大传输单元)定义了无需分片即可通过网络接口传输的最大数据包大小。标准以太网MTU为1500字节。
MTU-related issues typically cause: - Slow connections
与MTU相关的问题通常导致:- 连接缓慢
- Hanging requests
Connections that work for small packets but fail for larger ones
Common checks include: - Verifying MTU size on interfaces常见检查包括:- 验证接口上的MTU大小
- Testing packet fragmentation using ping with the “do not fragment” option
Checking for mismatched MTU values across the network path
MTU problems often appear in VPNs, tunnels, or cloud networks where packet overhead reduces the effective MTU.MTU问题常出现在VPN、隧道或云网络中,其中数据包开销降低了有效MTU。
489. Explain bridging vs bonding vs VLANs in Linux.
解释 Linux 中的桥接(bridging)、绑定(bonding)和 VLAN 的区别。
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62ae | 官方: 否 | 付费: 否
答案:
These are Linux networking techniques used for connectivity, redundancy, and network segmentation, but they solve different problems. - Bridging connects multiple network interfaces at Layer 2, making them behave like a single network. It is commonly used to connect virtual machines or containers to the host network.
这些是 Linux 中用于连接、冗余和网络分段的网络技术,但解决不同的问题。- 桥接在二层连接多个网络接口,使其像单个网络一样工作。它常用于将虚拟机或容器连接到主机网络。
- Bonding combines multiple network interfaces into one logical interface to provide high availability or increased bandwidth. It is used for redundancy (failover) or load balancing.
VLANs (Virtual LANs) logically split a physical network into multiple isolated networks using VLAN IDs. This allows traffic separation without additional physical interfaces.
In short: - Bridging connects networks简而言之:- 桥接连接网络。
- Bonding combines interfaces
- VLANs segment traffic
490. What is a Linux network namespace and why is it useful?
什么是 Linux 网络命名空间?它的用途是什么?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62b1 | 官方: 否 | 付费: 否
答案:
A Linux network namespace provides isolation for networking resources such as interfaces, IP addresses, routing tables, and firewall rules. Each namespace has its own independent network stack.
Linux 网络命名空间为接口、IP 地址、路由表和防火墙规则等网络资源提供隔离。每个命名空间拥有独立的网络栈。
Network namespaces are useful because they allow multiple isolated network environments to exist on the same system.
网络命名空间很有用,因为它允许在同一系统上存在多个隔离的网络环境。
Common use cases include: - Containers (Docker, Kubernetes)
常见用例包括:- 容器(Docker、Kubernetes)
- Network isolation for testing
Running multiple services with separate network configurations
In containerized environments, each container typically runs inside its own network namespace, ensuring that its networking setup does not interfere with others.在容器化环境中,每个容器通常运行在自己的网络命名空间内,确保其网络配置不会干扰其他容器。
491. How do you list and interpret firewall rules on Linux?
如何在 Linux 上列出并解释防火墙规则?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62b4 | 官方: 否 | 付费: 否
答案:
Firewall rules on Linux can be listed using either iptables or nftables , depending on which framework is in use.
Linux 上的防火墙规则可以使用 iptables 或 nftables 列出,具体取决于使用的是哪个框架。
Using iptables: iptables -S
使用 iptables:iptables -S
This shows: - All rules in a readable, rule-by-rule format
这显示:- 所有规则,以可读的逐条规则格式呈现。
- Default policies (ACCEPT, DROP)
Rule order, which is important because rules are evaluated sequentially
Using nftables: nft list ruleset使用 nftables:nft list ruleset
This displays: - Tables, chains, and rules in a unified view
这显示:- 表、链和规则,以统一视图呈现。
Rules for IPv4, IPv6, and other families together
When interpreting firewall rules, key things to check are: - Default policy of chains解释防火墙规则时,关键检查项包括:- 链的默认策略。
- Rule order (first match wins)
- Which ports, protocols, or IP ranges are allowed or blocked
492. What is the difference between iptables and nftables?
iptables 和 nftables 有什么区别?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62b7 | 官方: 否 | 付费: 否
答案:
iptables and nftables are Linux firewall frameworks used to filter and control network traffic. - iptables is the older, legacy firewall system. It uses multiple tables and chains and can become complex and inefficient for large rule sets.
iptables和nftables是用于过滤和控制网络流量的Linux防火墙框架。- iptables是较旧的、传统的防火墙系统。它使用多个表和链,对于大量规则集可能变得复杂且效率低下。
nftables is the modern replacement that unifies IPv4, IPv6, ARP, and bridge filtering under a single framework with simpler syntax and better performance.
Key differences: - nftables has a cleaner, more consistent rule syntax主要区别:- nftables具有更简洁、更一致的规则语法
- nftables performs better with large rule sets
iptables is still widely used and supported but is gradually being replaced
On modern Linux systems, nftables is preferred, while iptables knowledge remains important for legacy environments.在现代Linux系统上,nftables更受青睐,而iptables知识对于遗留环境仍然重要。
493. What is the difference between traceroute and mtr? When do you use each?
traceroute和mtr有什么区别?您何时使用它们?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62ba | 官方: 否 | 付费: 否
答案:
traceroute and mtr are both used to analyze the network path between a source and a destination. - traceroute shows the path packets take hop by hop, displaying each router along the route. It provides a static snapshot of the path at a point in time.
traceroute和mtr都用于分析源和目标之间的网络路径。- traceroute逐跳显示数据包经过的路径,显示沿途的每个路由器。它提供路径在某一时间点的静态快照。
mtr combines the functionality of traceroute and ping. It continuously sends probes and shows live statistics such as latency and packet loss for each hop.
When to use which: - Use traceroute for a quick, one-time path check何时使用哪种:- 对于快速、一次性的路径检查,使用traceroute
- Use mtr when diagnosing intermittent latency or packet loss, as it provides ongoing measurements
494. How do you troubleshoot “can resolve domain but cannot connect to service”?
如何排查“可以解析域名但无法连接到服务”的问题?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62bd | 官方: 否 | 付费: 否
答案:
If a domain resolves correctly but the service cannot be reached, DNS is working and the issue is usually related to ports, service availability, or network access controls.
如果域名解析正确但服务无法访问,则DNS工作正常,问题通常与端口、服务可用性或网络访问控制有关。
Common checks include: - Verifying the service is listening on the expected port using tools like ss or netstat
常见检查包括:- 使用ss或netstat等工具验证服务是否在预期端口上监听
- Testing port reachability with utilities such as nc or curl
- Checking firewall rules on the host and along the network path
- Confirming NAT or port-forwarding rules if the service is accessed externally
- Ensuring the service is bound to the correct address (for example, 0.0.0.0 instead of 127.0.0.1)
Verifying whether a proxy configuration is required or interfering with the connection
Since name resolution succeeds, troubleshooting should focus on transport-level connectivity and service configuration, rather than DNS.由于名称解析成功,故障排查应侧重于传输级连接和服务配置,而非DNS。
495. How do you troubleshoot “can ping IP but not domain”?
如何排查“可以ping通IP但无法ping通域名”的问题?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62c0 | 官方: 否 | 付费: 否
答案:
If a system can ping an IP address but not a domain name, the issue usually lies with DNS resolution , not basic network connectivity.
如果系统可以ping通IP地址但无法ping通域名,则问题通常出在DNS解析,而非基本网络连接性。
Common checks include: - Verifying DNS resolution using tools like dig or nslookup
常见检查包括:- 使用dig或nslookup等工具验证DNS解析
- Checking that valid DNS servers are configured in /etc/resolv.conf
- Ensuring /etc/hosts does not contain incorrect overrides
Confirming DNS traffic is not blocked by firewall rules
Since IP connectivity is working, routing is typically correct, and the focus should remain on the DNS resolver path.由于IP连接正常,路由通常正确,排查重点应保持在DNS解析器路径上。
496. What is /etc/resolv.conf and what can override it?
什么是/etc/resolv.conf,什么可以覆盖它?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62c3 | 官方: 否 | 付费: 否
答案:
/etc/resolv.conf is a configuration file that specifies the DNS servers used by the system for hostname resolution. It typically contains one or more nameserver entries along with optional search domains.
/etc/resolv.conf是一个配置文件,用于指定系统进行主机名解析所使用的DNS服务器。它通常包含一个或多个nameserver条目以及可选的search域。
On modern Linux systems, /etc/resolv.conf is often auto-generated and should not be edited directly. It can be managed or overwritten by services such as: - systemd-resolved
在现代 Linux 系统上,/etc/resolv.conf 通常是由系统自动生成的,不应直接编辑。它可能由以下服务管理或覆盖:- systemd-resolved
- NetworkManager
DHCP clients
In many cases, /etc/resolv.conf is a symbolic link to another file maintained by these services. As a result, manual changes may be lost after a network restart.在许多情况下,/etc/resolv.conf 是指向这些服务维护的另一个文件的符号链接。因此,手动更改可能在网络重启后丢失。
497. What is the purpose of /etc/hosts and how does it interact with DNS?
/etc/hosts 的用途是什么,它如何与 DNS 交互?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62c6 | 官方: 否 | 付费: 否
答案:
/etc/hosts is a local file used for static hostname-to-IP mapping. It allows a Linux system to resolve hostnames without querying a DNS server.
/etc/hosts 是一个用于静态主机名到 IP 地址映射的本地文件。它允许 Linux 系统在不查询 DNS 服务器的情况下解析主机名。
Each entry maps an IP address to one or more hostnames,
每个条目将一个 IP 地址映射到一个或多个主机名,
for example:
例如:
127.0.0.1 localhost
127.0.0.1 localhost
192.168.1.10 app.internal.local
192.168.1.10 app.internal.local
How it interacts with DNS
它如何与 DNS 交互
The order in which /etc/hosts and DNS are consulted is controlled by /etc/nsswitch.conf . A common configuration looks like this: hosts: files dns
查询 /etc/hosts 和 DNS 的顺序由 /etc/nsswitch.conf 控制。常见配置如下:hosts: files dns
This means:
这意味着:
The system checks /etc/hosts first 2. If no match is found, it queries DNS
- 系统先检查 /etc/hosts 2. 如果未找到匹配项,则查询 DNS
Because of this order, entries in /etc/hosts can override DNS results.
由于此顺序,/etc/hosts 中的条目可以覆盖 DNS 结果。
When /etc/hosts is commonly used - Testing services locally before DNS changes
何时通常使用 /etc/hosts - 在 DNS 更改前本地测试服务
- Overriding DNS temporarily for debugging
Defining internal hostnames in small setups
So, If a domain resolves differently in dig and getent hosts, it often indicates an entry in /etc/hosts or a resolver order issue. Checking /etc/hosts is a standard first step in DNS troubleshooting.因此,如果某个域名在 dig 和 getent hosts 中的解析结果不同,通常表明 /etc/hosts 中存在条目或解析器顺序问题。检查 /etc/hosts 是 DNS 故障排查的标准第一步。
498. How do you test DNS resolution from a Linux machine?
如何从 Linux 机器测试 DNS 解析?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62c9 | 官方: 否 | 付费: 否
答案:
DNS resolution on Linux can be tested using tools like dig , nslookup , and getent hosts . These commands help verify whether a domain name is resolving correctly and where the resolution might be failing.
在 Linux 上可以使用 dig 、 nslookup 和 getent hosts 等工具来测试 DNS 解析。这些命令有助于验证域名是否正确解析,以及解析可能在何处失败。
Using dig (preferred for detailed DNS checks) : dig example.com
使用 dig (更适用于详细的 DNS 检查): dig example.com
This shows: - Resolved IP addresses
这会显示: - 解析出的 IP 地址
- DNS server used
Query time and response status
To check a specific DNS server: dig @8.8.8.8 example.com要检查特定的 DNS 服务器: dig @8.8.8.8 example.com
Using nslookup: nslookup example.com
使用 nslookup : nslookup example.com
This provides basic DNS resolution details and is useful for quick checks, though it is considered less powerful than dig .
这提供基本的 DNS 解析信息,并有助于快速检查,尽管它被认为不如 dig 强大。
Using getent hosts :getent hosts example.com
使用 getent hosts :getent hosts example.com
This command checks name resolution using the system’s configured resolver, including: - /etc/hosts
此命令使用系统的配置解析器来检查名称解析,包括: - /etc/hosts
- DNS
Other name service sources (as defined in /etc/nsswitch.conf)
During Interview: - Use dig to debug DNS issues in detail面试时: - 使用 dig 来详细调试 DNS 问题
- Use getent hosts to confirm what the system itself resolves
- Differences between dig and getent results often indicate resolver or /etc/hosts issues
499. What is the difference between netstat and ss?
netstat 和 ss 有什么区别?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62cc | 官方: 否 | 付费: 否
答案:
netstat and ss are both used to inspect network connections, listening ports, and socket statistics. The key difference is that ss is the modern replacement for netstat.
netstat 和 ss 都用于检查网络连接、监听端口和套接字统计信息。关键区别在于 ss 是 netstat 的现代替代品。
netstat is part of the legacy net-tools package, which is deprecated on many Linux distributions. ss is part of the iproute2 suite and is actively maintained.
netstat 是传统 net-tools 软件包的一部分,该软件包在许多 Linux 发行版上已被弃用。ss 是 iproute2 套件的一部分,并得到积极维护。
Key differences: - ss is faster because it reads socket information directly from the kernel
关键区别: - ss 更快,因为它直接从内核读取套接字信息
- netstat relies on older interfaces and can be slower on busy systems
- ss provides more detailed socket and TCP state information
netstat may not be installed by default on modern Linux systems
Example commands:示例命令:
ss -lntp # modern way to view listening TCP ports with process info
ss -lntp # 查看监听 TCP 端口及进程信息的现代方式
netstat -lntp # legacy equivalent
netstat -lntp # 传统等效方式
In interviews, it’s best to use ss as the primary tool, while mentioning netstat to show awareness of legacy commands that are still referenced in older systems.
在面试中,最好将ss作为主要工具,同时提及netstat以展示对旧系统中仍会引用的传统命令的了解。
500. How do you find which process is using a port?
如何找出哪个进程正在使用某个端口?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62cf | 官方: 否 | 付费: 否
答案:
To identify which process is using a specific port on Linux, tools like ss, lsof, and fuser are commonly used. These commands help map ports to processes , which is essential when a service fails to start or a port is already in use.
要识别Linux上哪个进程正在使用特定端口,通常使用ss、lsof和fuser等工具。这些命令有助于将端口映射到进程,当服务无法启动或端口已被占用时,这一点至关重要。
Using ss (which is preferred on modern systems):
使用ss(在现代系统上更受推荐):
ss -lntp - -l = listening sockets
ss -lntp - -l = 监听套接字
- -n = numeric addresses (no DNS lookup)
- -t = TCP ports
-p = process information
This shows the port, protocol, and the process (PID and name) listening on it.这会显示正在监听的端口、协议以及对应进程(PID和名称)。
To check a specific port: ss -lntp | grep :80
要检查特定端口:ss -lntp | grep :80
Using lsof: lsof -i :80
使用lsof:lsof -i :80
This lists the process using port 80 along with the PID and command. It works for both TCP and UDP and is widely available.
这会列出使用端口80的进程及其PID和命令。它适用于TCP和UDP,且被广泛使用。
Using fuser: fuser 80/tcp
使用fuser:fuser 80/tcp
This shows the PID of the process using the port. It is useful for quick checks and can also terminate the process if needed.
这会显示使用该端口的进程的PID。它适合快速检查,如有需要还可终止进程。
Remember during the interview: ss is the modern replacement for netstat and is faster and more informative. Mentioning lsof as an alternative shows familiarity with multiple debugging tools.
面试时记住:ss是netstat的现代替代品,速度更快且信息更丰富。提及lsof作为替代工具,可展示你对多种调试工具的熟悉程度。
501. How do you check the IP address, routes, and interfaces on Linux?
如何检查Linux上的IP地址、路由和网络接口?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62d2 | 官方: 否 | 付费: 否
答案:
Linux provides the ip command to inspect IP addresses, network interfaces, and routing information. These are usually the first commands run during network troubleshooting.
Linux提供ip命令来检查IP地址、网络接口和路由信息。这些通常是网络故障排查时首先运行的命令。
Check IP addresses assigned to interfaces:
检查分配给接口的IP地址:
ip a
ip a
or
ip addr show
ip addr show
This shows: - Interface names (eth0, ens33, wlan0, etc.)
这会显示:- 接口名称(eth0、ens33、wlan0 等)
- Assigned IPv4 and IPv6 addresses
Interface state (UP/DOWN)
Check network interfaces and their state:检查网络接口及其状态:
ip link
ip link
This command helps verify whether an interface is: - UP or DOWN
此命令有助于验证接口是否处于以下状态:- 启用(UP)或禁用(DOWN)
- Administratively enabled
Experiencing errors or drops
Check the routing table:检查路由表:
ip r
ip r
or
ip route show
ip route show
This displays: - Default gateway
这会显示:- 默认网关
- Network routes
- Which interface traffic is routed through
502. What is the difference between ip and ifconfig? Which one is preferred and why?
ip 和 ifconfig 有什么区别?哪一个更受推荐,为什么?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62d5 | 官方: 否 | 付费: 否
答案:
ifconfig is an older, legacy tool used to configure and display network interfaces, while ip is a modern utility from the iproute2 suite that replaces ifconfig , route , and arp .
ifconfig 是旧版的传统工具,用于配置和显示网络接口,而 ip 是来自 iproute2 套件的现代实用工具,取代了 ifconfig、route 和 arp。
The ip command is preferred today because it provides better functionality, supports newer networking features, and is actively maintained.
如今更推荐使用 ip 命令,因为它提供了更好的功能,支持更新的网络特性,并且得到积极维护。
Common commands:
常用命令:
ip addr # show IP addresses
ip addr # 显示 IP 地址
ip link # show interface state
ip link # 显示接口状态
ip route # show routing table
ip route # 显示路由表
Legacy equivalent: ifconfig
传统等价命令:ifconfig
Key differences: - ip supports advanced features like network namespaces, policy routing, and traffic control
主要区别:- ip 支持高级功能,如网络命名空间、策略路由和流量控制
- ifconfig is deprecated on many modern distributions and may not be installed by default
ip offers a consistent and extensible syntax for managing networking
In interviews, it is best to use ip commands first, while briefly acknowledging ifconfig, since many interviewers still reference it.在面试中,最好优先使用 ip 命令,同时简要提及 ifconfig,因为许多面试官仍会引用它。
503. You can ping an IP but cannot open the website by domain. What do you check?
你可以 ping 通一个 IP,但无法通过域名打开网站。你会检查什么?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6309 | 官方: 否 | 付费: 否
答案:
If an IP address is reachable but the domain name is not, basic network connectivity is working and the issue is usually related to DNS resolution.
如果 IP 地址可达但域名不通,说明基本网络连接正常,问题通常与 DNS 解析有关。
Key checks:
关键检查:
Test DNS resolution using: dig example.com
使用以下命令测试 DNS 解析:dig example.com
nslookup example.com
nslookup example.com
getent hosts example.com
getent hosts example.com
Verify DNS servers configured in:
验证配置的 DNS 服务器:
cat /etc/resolv.conf
cat /etc/resolv.conf
Check for incorrect hostname overrides in:
检查 /etc/hosts 中是否有错误的主机名覆盖:
cat /etc/hosts
cat /etc/hosts
Confirm DNS server reachability:
确认 DNS 服务器可达性:
dig @8.8.8.8 example.com
dig @8.8.8.8 example.com
Ensure DNS traffic (port 53) is not blocked by firewall rules
确保防火墙规则未阻止 DNS 流量(端口 53)
Handling Troubleshooting (DNS issue): - IP ping works - routing and interface are fine
故障排查处理(DNS问题):- IP ping通 - 路由和接口正常
- Domain lookup fails - DNS resolver path issue
- dig works but applications fail - resolver configuration (/etc/nsswitch.conf)
No DNS server reachable - firewall or network policy blocking DNS
This scenario is commonly used to test whether a candidate can separate DNS issues from general network connectivity problems.此场景通常用于测试候选人能否将DNS问题与一般网络连接问题区分开来。
504. Clients receive IP addresses but have no internet access. What’s broken?
客户端获得IP地址但无法访问互联网。哪里出了问题?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb630c | 官方: 否 | 付费: 否
答案:
If clients successfully obtain IP addresses but cannot access the internet, DHCP is working, and the issue is typically downstream.
如果客户端成功获得IP地址但无法访问互联网,说明DHCP正常工作,问题通常出在下游。
For troubleshooting, common checks include: - Verifying DHCP options such as default gateway and DNS servers
排查时,常见检查包括:- 验证DHCP选项,如默认网关和DNS服务器
- Checking routing and NAT configuration on the gateway
- Confirming DNS resolution is functioning
- Inspecting firewall rules blocking outbound traffic
Checking for captive portal or restricted network policies
This scenario helps interviewers assess whether a candidate can distinguish address assignment issues from routing, NAT, or policy problems.此场景有助于面试官评估候选人能否区分地址分配问题与路由、NAT或策略问题。
505. In Kubernetes or Docker, container-to-container networking fails. How do you debug?
在Kubernetes或Docker中,容器间网络通信失败。如何调试?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb630f | 官方: 否 | 付费: 否
答案:
When containers cannot communicate with each other, the issue is usually related to the container networking layer, not the application itself.
当容器之间无法通信时,问题通常出在容器网络层,而非应用本身。
Common checks include: - Verifying the CNI plugin or bridge configuration
常见检查包括:- 验证CNI插件或桥接配置
- Inspecting iptables or nftables rules created for container networking
- Checking the container’s network namespace
- Validating service discovery and DNS inside the cluster
Ensuring node-level routing between container subnets is correct
Interviewers use this scenario to assess whether the candidate understands how container networking is implemented on Linux, instead of treating it as a black box面试官使用此场景来评估候选人是否理解容器网络在Linux上的实现方式,而不是将其视为黑盒
506. High latency only during peak hours. What do you look at?
仅在高峰时段出现高延迟。你会检查什么?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6316 | 官方: 否 | 付费: 否
答案:
Latency that appears only during peak hours usually points to capacity or congestion-related issues, not configuration problems.
仅在高峰时段出现的延迟通常指向容量或拥塞相关问题,而非配置问题。
Common areas to check include: - Network congestion and bandwidth saturation during high traffic periods
常见检查领域包括:- 高流量时段网络拥塞和带宽饱和情况
- Queue drops or bufferbloat, where excessive buffering increases latency
- Interface or gateway statistics for errors and drops
- ISP or peering congestion, especially for external traffic
QoS policies that may deprioritize certain traffic under load
This scenario tests whether the candidate can associate time-based performance degradation with traffic patterns and capacity limits.此场景测试候选人能否将基于时间的性能下降与流量模式和容量限制联系起来。
507. TLS handshake fails but TCP connects. What does that indicate?
TLS握手失败但TCP连接成功。这说明什么?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb632b | 官方: 否 | 付费: 否
答案:
If a TCP connection is established but the TLS handshake fails, network connectivity is intact and the problem lies at the TLS or application layer.
如果TCP连接建立但TLS握手失败,网络连接仍然完好,问题出在TLS或应用层。
Common causes include: - Certificate issues, such as invalid or expired certificates
常见原因包括:- 证书问题,例如无效或过期的证书
- SNI mismatch, where the server expects a different hostname
- TLS version or cipher mismatch between client and server
- Middlebox inspection (firewall or proxy interfering with TLS)
System time skew, causing certificate validation to fail
This scenario is used to check whether a candidate can distinguish transport-level success from encryption or application-level failures.此场景用于检查候选人能否区分传输层成功与加密或应用层失败。
508. A host can reach external IPs but not a specific subnet. Why?
主机可以访问外部IP,但无法访问特定子网。为什么?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb6332 | 官方: 否 | 付费: 否
答案:
If a host can reach the internet but not a particular subnet, general connectivity is working and the issue is usually routing or policy-related.
如果主机可以访问互联网但无法访问特定子网,通常说明一般连通性正常,问题通常出在路由或策略方面。
Common causes checked during troubleshooting include:
排障期间检查的常见原因包括:
A missing route to the specific subnet: ip route - Overlapping CIDRs causing traffic to be routed incorrectly
缺少到特定子网的路由:ip route - CIDR重叠导致流量被错误路由
- Policy-based routing rules affecting only certain destinations
- ACLs or firewall rules blocking traffic to that subnet
An incorrect default gateway or next-hop configuration
This scenario tests whether the candidate can identify selective routing failures rather than global network issues.此场景测试候选人能否识别选择性路由故障,而非全局网络问题。
509. After enabling IPv6, some users can’t reach the application. What checks do you do?
启用IPv6后,部分用户无法访问应用程序。你会进行哪些检查?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb6335 | 官方: 否 | 付费: 否
答案:
If IPv6 is enabled and only some users experience failures, the issue is often related to incomplete or inconsistent IPv6 support.
如果已启用IPv6且只有部分用户遇到故障,问题通常与IPv6支持不完整或不一致有关。
For troubleshooting, common checks include: - Verifying AAAA DNS records resolve correctly
排障时,常见检查包括:- 验证AAAA DNS记录是否正确解析
- Ensuring firewall rules allow IPv6 traffic
- Confirming the application is listening in dual-stack mode (IPv4 and IPv6)
- Checking for path MTU issues, which are more common with IPv6
Validating IPv6 routing configuration on the host and network
This scenario tests whether the candidate understands that enabling IPv6 requires end-to-end readiness.此场景测试候选人是否理解启用IPv6需要端到端的就绪状态。
510. You suspect a routing loop. What symptoms and tools confirm it?
你怀疑存在路由环路。哪些症状和工具能确认这一点?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb6338 | 官方: 否 | 付费: 否
答案:
A routing loop occurs when packets circulate between routers without reaching the destination.
路由环路发生在数据包在路由器之间循环传输而无法到达目的地时。
Common symptoms and checks include:
常见症状和检查包括:
TTL exceeded errors, indicating packets are looping until TTL runs out
TTL超时错误,表明数据包在循环直到TTL耗尽
Running : traceroute destination_ip
运行:traceroute destination_ip
and observing repeating hops in the output
并在输出中观察到重复的跳数
Verifying the routing table for incorrect or overlapping routes: ip route
检查路由表是否存在不正确或重叠路由:ip route
Checking for dynamic routing misconfigurations (incorrect metrics, missing routes, or redistribution issues)
检查动态路由配置错误(指标不正确、路由缺失或重分发问题)
This scenario is used to test whether a candidate can recognize path-level routing problems rather than host or service issues.
此场景用于测试候选人能否识别路径级路由问题,而非主机或服务问题。
511. One region works, another region fails for the same application. How do you troubleshoot?
同一应用在一个区域正常,另一个区域失败。如何排查?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb633b | 官方: 否 | 付费: 否
答案:
When an application works in one region but fails in another, the issue is usually related to regional configuration differences, not application logic.
当应用在一个区域正常但在另一个区域失败时,问题通常与区域配置差异相关,而非应用逻辑。
For troubleshooting, common checks include: - Comparing DNS records, especially geo-based routing or region-specific endpoints
排查时,常见检查包括:- 比较DNS记录,尤其是基于地理位置的路由或区域特定端点
- Verifying routing and peering differences between regions
- Checking firewall rules, security groups, or NACLs applied per region
- Inspecting load balancer configuration and health checks in the failing region
Confirming backend instances in the affected region are healthy and reachable
This scenario tests whether a candidate can systematically compare environments instead of assuming a global failure.此场景测试候选人能否系统性地比较环境,而不是假设全局性故障。
512. “Connection refused” vs “Connection timed out” - what’s the difference in diagnosis?
“连接被拒绝”与“连接超时”——在诊断中有何区别?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb633e | 官方: 否 | 付费: 否
答案:
Both errors indicate connection failure, but they point to different problem areas.
两种错误均表示连接失败,但它们指向不同的问题区域。
Connection refused means the request reached the destination host, but no service is listening on the target port, or the port is explicitly rejected. - Common causes: service down, wrong port, service bound to localhost only
连接被拒绝表示请求已到达目标主机,但目标端口上没有服务在监听,或端口被明确拒绝。- 常见原因:服务已关闭、端口错误、服务仅绑定到本地主机
Typical checks: ss -lntp
Connection timed out means the request never received a response, usually due to the network path blocking or dropping packets. - Common causes: firewall rules, routing issues, security groups, network ACLs连接超时表示请求从未收到响应,通常是由于网络路径阻塞或丢弃数据包。- 常见原因:防火墙规则、路由问题、安全组、网络ACL
Typical checks: firewall rules, routing table, path connectivity
Interviewers expect candidates to clearly separate service-level failures from network-path failures .面试官期望候选人能清晰区分服务级故障与网络路径级故障。
513. Two servers in different VLANs can’t communicate. Where can it break?
位于不同VLAN中的两台服务器无法通信。哪里可能出问题?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb6341 | 官方: 否 | 付费: 否
答案:
When servers in different VLANs cannot communicate with each other, the issue typically lies in inter-VLAN connectivity or configuration, rather than basic host networking.
当不同VLAN中的服务器无法相互通信时,问题通常出在VLAN间连接或配置上,而非基本的主机网络。
For troubleshooting, common checks include: - Verifying inter-VLAN routing is configured on a router or Layer 3 switch
排查时,常见检查包括:- 确认在路由器或三层交换机上配置了VLAN间路由
- Checking ACLs or firewall rules between VLANs
- Confirming trunk ports are correctly tagged with the required VLANs
- Ensuring each server has the correct subnet mask
- Verifying the default gateway points to the VLAN’s router interface
Checking switch port VLAN assignment (access vs trunk mode)
This scenario tests whether the candidate understands how traffic moves between VLANs, not just within one.此场景测试候选人是否理解VLAN间流量的流动方式,而不仅仅是在单个VLAN内的流动。
514. A new firewall rule was deployed and now production traffic fails. How do you rollback or verify safely?
部署了新的防火墙规则,现在生产流量失败。如何安全回滚或验证?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb6347 | 官方: 否 | 付费: 否
答案:
When traffic breaks after a firewall change, the issue is often caused by rule order, default policies, or overly restrictive rules.
防火墙更改后流量中断时,问题通常由规则顺序、默认策略或过于严格的规则引起。
For troubleshooting and safe rollback, typical checks include: - Reviewing the rule order, since firewall rules are evaluated sequentially
故障排除和安全回滚的典型检查包括:- 检查规则顺序,因为防火墙规则是按顺序评估的
- Checking default policies (ACCEPT vs DROP)
- Inspecting rule hit counters or logs to see which rule is blocking traffic
- Temporarily reverting to the previous known-good rule set
Applying changes in a staged manner and allowing only the minimal required paths first
Interviewers use this scenario to assess whether a candidate can handle production incidents carefully without causing further impact.面试官使用此场景评估候选人是否能谨慎处理生产事故,而不造成进一步影响。
515. A service is reachable internally but not externally. What do you check?
服务在内部可达但外部不可达。需要检查什么?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb634e | 官方: 否 | 付费: 否
答案:
If a service works from inside the network but not from outside, the issue is usually related to exposure or access controls, not the service itself.
如果服务在内部网络可用但从外部不可用,问题通常与暴露或访问控制有关,而非服务本身。
For troubleshooting, common checks include: - Verifying NAT or port-forwarding rules are configured correctly
故障排除的常见检查包括:- 验证NAT或端口转发规则配置是否正确
Checking public firewall rules and cloud security groups/NACLs
Ensuring the service is listening on the correct port: ss -lntp - Confirming the service is bound to 0.0.0.0 (all interfaces) and not 127.0.0.1确保服务在正确端口上监听:ss -lntp - 确认服务绑定到0.0.0.0(所有接口)而非127.0.0.1
Validating that the external IP or load balancer forwards traffic to the correct backend
This scenario tests whether the candidate understands the difference between internal reachability and external exposure.此场景测试候选人是否理解内部可达性与外部暴露之间的区别。
516. SSH works, but file download over HTTP is very slow. Why might that happen?
SSH工作正常,但通过HTTP下载文件非常慢。可能是什么原因?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb6351 | 官方: 否 | 付费: 否
答案:
If SSH connections are responsive but HTTP downloads are slow, basic connectivity is working and the issue is usually related to packet size, congestion, or traffic handling.
如果SSH连接响应正常但HTTP下载缓慢,基本连通性正常,问题通常与数据包大小、拥塞或流量处理有关。
Common causes checked during troubleshooting include: - MTU or MSS mismatches are causing packet fragmentation or drops
故障排除中检查的常见原因包括:- MTU或MSS不匹配导致数据包分片或丢弃
- Asymmetric routing, where return traffic follows a different path
- Network congestion is affecting bulk data transfers
- TCP window size or high RTT impacting throughput
Proxy or firewall traffic shaping applied to HTTP/HTTPS traffic
This scenario tests whether the candidate understands that different protocols behave differently under the same network conditions.此场景测试候选人是否理解在相同网络条件下不同协议的表现不同。
517. Intermittent packet loss to a remote server. How do you isolate where the loss happens?
远程服务器出现间歇性数据包丢失。如何隔离丢失发生的位置?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb6354 | 官方: 否 | 付费: 否
答案:
Intermittent packet loss is usually diagnosed by checking where along the network path the loss starts.
间歇性数据包丢失通常通过检查网络路径上丢失开始的位置来诊断。
For troubleshooting, common steps include:
常见故障排查步骤包括:
Run a hop-by-hop path test: mtr remote_server_ip - Look for packet loss or high latency at specific hops
运行逐跳路径测试:mtr remote_server_ip - 寻找特定跳数上的丢包或高延迟
- Distinguish between last-mile issues (close to the source or destination) and middle-mile issues (ISP or transit networks)
Be cautious with ICMP loss, as some routers rate-limit ICMP responses
Check for TCP retransmissions on the affected connection: ss -ti检查受影响连接的TCP重传:ss -ti
This approach helps identify whether packet loss is local, network-path related, or destination-specific.
这种方法有助于识别丢包是本地问题、网络路径相关还是目的地特定。
518. Users report “internet is slow,” but only for one application. What do you do?
用户报告“互联网缓慢”,但仅针对一个应用程序。你会怎么做?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb6357 | 官方: 否 | 付费: 否
答案:
If slowness is limited to a single application, general network connectivity is usually fine, and the issue is often application-specific or protocol-specific.
如果缓慢仅限于单个应用程序,通常网络连接一般是正常的,问题往往是应用程序特定或协议特定的。
For troubleshooting, common checks include: - Identifying which ports and protocols the application uses
故障排查时,常见检查包括:- 确定应用程序使用的端口和协议
- Comparing DNS resolution behavior for the application
- Checking for MTU-related issues that affect larger packets
- Verifying proxy settings used by the application
- Looking for TCP retransmissions or high latency on the application’s connections
- Checking server-side health or rate limits
Reviewing QoS or traffic shaping rules that may prioritize or limit traffic
Interviewers use this scenario to assess whether a candidate can isolate application-layer issues from overall network performance.面试官使用此场景来评估候选人是否能将应用层问题与整体网络性能隔离。
519. One host in a subnet can’t reach the gateway, but others can. How do you debug?
子网中的一台主机无法到达网关,但其他主机可以。你如何调试?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb635a | 官方: 否 | 付费: 否
答案:
When only one host in a subnet has connectivity issues, the problem is usually local to that machine, not the network itself.
当子网中仅有一台主机连接有问题时,问题通常出在这台机器本身,而不是网络本身。
For troubleshooting, the following checks are typically done:
故障排查时,通常会进行以下检查:
Verify the network interface is up: ip link
验证网络接口是否启用:ip link
Check IP address and subnet mask: ip a
检查IP地址和子网掩码:ip a
Confirm the default gateway: ip route
确认默认网关:ip route
Inspect the ARP table for incomplete entries or conflicts: ip neigh - Check for duplicate IP addresses on the network
检查ARP表是否存在不完整条目或冲突:ip neigh - 检查网络上是否有重复的IP地址
- Verify VLAN configuration if the network uses VLANs
- Rule out physical issues such as cable, Wi-Fi signal, or adapter problems
Ensure local firewall rules are not blocking outbound traffic
This scenario tests whether the candidate can differentiate host-level issues from subnet-level problems.此场景测试候选人能否区分主机级别问题与子网级别问题。
520. 2. DNS resolves fine, but curl https://domain fails with a timeout. What do you check next?
- DNS 解析正常,但 curl https://domain 因超时失败。接下来应检查什么?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37bfc58d557c902bb635d | 官方: 否 | 付费: 否
答案:
If DNS resolution works but an HTTPS request times out, the issue is usually beyond name resolution and related to port connectivity, firewall rules, or service availability.
如果 DNS 解析正常但 HTTPS 请求超时,问题通常不在名称解析,而是与端口连通性、防火墙规则或服务可用性相关。
Key checks:
关键检查:
Test port reachability: nc -vz domain 443
测试端口可达性:nc -vz domain 443
Verify the service is listening on the server: ss -lntp | grep :443 - Check host and network firewall or security group rules allowing port 443
验证服务是否在服务器上监听:ss -lntp | grep :443 - 检查主机和网络防火墙或安全组规则是否允许端口 443
- Confirm routing to the destination network is correct
Check whether a proxy is required or misconfigured for outbound HTTPS traffic
For troubleshooting: - DNS works - name resolution is fine故障排查方面:- DNS 正常 - 名称解析没问题
- Port test fails - firewall, security group, or routing issue
- Port open, but no response - service not listening or bound incorrectly
Works internally but not externally - NAT, firewall, or proxy configuration
Interviewers use this scenario to assess whether a candidate can move from DNS checks to transport-level debugging in a logical way.面试官用这种场景来评估候选人是否能有逻辑地从事先的 DNS 检查转向传输层调试。
521. What is Reentrancy?
什么是可重入性?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69b6 | 官方: 否 | 付费: 否
答案:
Reentrant is simply a function in which various clients can use and shares a single copy of a program during a similar period. This concept is generally associated with OS code and does not deal with concurrency. It has two major functions: - Program code cannot change or modify itself.
可重入是一个简单的函数,各种客户端可以在相似时间段内使用并共享程序的单一副本。这一概念通常与操作系统代码相关,并不涉及并发性。它有两个主要功能:- 程序代码不能更改或修改自身。
- Local data for every client process needs to be stored in different disks.
522. What is a Scheduling Algorithm? Name different types of scheduling algorithms.
什么是调度算法?列出不同类型的调度算法。
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: coding
- 分类: fullstack
- id: 69b37c0558d557c902bb69b9 | 官方: 否 | 付费: 否
答案:
A scheduling algorithm is a process that is used to improve efficiency by utilizing maximum CPU and providing minimum waiting time to tasks. It simply deals with the problem of deciding which of outstanding requests is to be allocated resources. Its main aim is to reduce resource starvation and to ensure fairness amongst parties that are utilizing the resources. In simple words, it is used to allocate resources among various competing tasks. Types of Scheduling Algorithm There are different types of scheduling algorithms as given below:
调度算法是一种通过最大化利用CPU并为任务提供最短等待时间来提升效率的进程。它主要处理决定哪个未完成的请求应分配资源的问题。其主要目标是减少资源饥饿,并确保利用资源的各方之间的公平性。简而言之,它用于在各种竞争任务之间分配资源。调度算法的类型如下所示:
523. What is the difference between paging and segmentation?
分页和分段有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69bc | 官方: 否 | 付费: 否
答案:
Paging: It is generally a memory management technique that allows OS to retrieve processes from secondary storage into main memory. It is a non-contiguous allocation technique that divides each process in the form of pages. Segmentation: It is generally a memory management technique that divides processes into modules and parts of different sizes. These parts and modules are known as segments that can be allocated to process.
分页:通常是一种内存管理技术,允许操作系统从辅助存储中检索进程到主内存。它是一种非连续分配技术,将每个进程以页的形式划分。分段:通常是一种内存管理技术,将进程划分为不同大小的模块和部分。这些部分和模块被称为段,可以分配给进程。
| Paging 分页 | Segmentation 分段 |
|---|---|
| It is invisible to a programmer. 对程序员不可见。 | It is visible to a programmer. 对程序员可见。 |
| In this, the size of pages is fixed. 页的大小是固定的。 | In this, the size of segments is not fixed. 段的大小不固定。 |
| Procedures and data cannot be separated in paging. 分页中过程和数据不能分离。 | Procedures and data can be separated in segmentation. 分段中过程和数据可以分离。 |
| It allows a cumulative total of virtual address spaces to cross physical main memory. 它允许虚拟地址空间的累计总数跨越物理主内存。 | It allows all programs, data, and codes to break up into independent address spaces. 它允许所有程序、数据和代码分解成独立的地址空间。 |
| It is mostly available on CPUs and MMU chips. 它主要可用于CPU和MMU芯片。 | It is mostly available on Windows servers that may support backward compatibility, while Linux has limited support. 它主要用于支持向后兼容的Windows服务器,而Linux支持有限。 |
| It is faster for memory access as compared to segmentation. 与分段相比,内存访问更快。 | It is slower as compared to paging. 与分页相比,速度较慢。 |
| In this, OS needs to maintain a free frame. 操作系统需要维护一个空闲帧。 | In this, OS needs to maintain a list of holes in the main memory. 操作系统需要维护主内存中的空洞列表。 |
| In paging, the type of fragmentation is internal. 分页中,碎片类型是内部的。 | In segmentation, the type of fragmentation is external. 分段中,碎片类型是外部的。 |
| The size of the page is determined by available memory. 页的大小由可用内存决定。 | The size of the page is determined by the user. 段的大小由用户决定。 |
524. What is thrashing in OS?
操作系统中的抖动是什么?
- 知识点: 操作系统与网络 / 算法与数据结构 / 行为与软技能 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: behavioral | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69bf | 官方: 否 | 付费: 否
答案:
It is generally a situation where the CPU performs less productive work and more swapping or paging work. It spends more time swapping or paging activities rather than its execution. By evaluating the level of CPU utilization, a system can detect thrashing. It occurs when the process does not have enough pages due to which the page-fault rate is increased. It inhibits much application-level processing that causes computer performance to degrade or collapse.
通常是指CPU执行较少生产性工作而进行更多交换或分页活动的情况。它花费更多时间在交换或分页活动上,而不是执行本身。通过评估CPU利用率水平,系统可以检测抖动。当进程没有足够的页导致缺页率增加时会发生。它抑制了许多应用程序级处理,导致计算机性能下降或崩溃。
525. What is the main objective of multiprogramming?
多道程序设计的主要目标是什么?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: coding
- 分类: fullstack
- id: 69b37c0558d557c902bb69c2 | 官方: 否 | 付费: 否
答案:
It refers to the ability to execute or perform more than one program on a single processor machine. This technique was introduced to overcome the problem of underutilization of CPU and main memory. In simple words, it is the coordination of execution of various programs simultaneously on a single processor (CPU). The main objective of multiprogramming is to have at least some processes running at all times. It simply improves the utilization of the CPU as it organizes many jobs where the CPU always has one to execute.
它指的是在单处理器机器上执行或运行多个程序的能力。引入此技术是为了克服CPU和主内存利用率不足的问题。简而言之,它是在单个处理器(CPU)上同时协调执行各种程序。多道程序设计的主要目标是始终保持至少一些进程在运行。它通过组织多个作业,使CPU始终有一个可执行,从而改善CPU的利用率。
526. What do you mean by asymmetric clustering?
不对称集群是什么意思?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69c5 | 官方: 否 | 付费: 否
答案:
Asymmetric Clustering is generally a system in which one of the nodes among all nodes is in hot standby mode whereas the rest of all nodes run different applications. It simply uses whole or entire hardware resources therefore it is considered a more reliable system as compared to others.
不对称集群是一种系统,其中所有节点中的一个节点处于热备用模式,而其余节点运行不同的应用程序。它使用全部或整个硬件资源,因此被认为比其他系统更可靠。
527. What is the difference between multitasking and multiprocessing OS?
多任务操作系统和多处理操作系统有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69c8 | 官方: 否 | 付费: 否
答案:
Multitasking: It is a system that allows more efficient use of computer hardware. This system works on more than one task at one time by rapidly switching between various tasks. These systems are also known as time-sharing systems.
多任务:它是一种允许更高效使用计算机硬件的系统。该系统通过快速切换各种任务,在一个时间同时处理多个任务。这些系统也称为分时系统。
Multiprocessing: It is a system that allows multiple or various processors in a computer to process two or more different portions of the same program simultaneously. It is used to complete more work in a shorter period of time.
多处理:这是一种允许计算机中的多个或不同处理器同时处理同一程序的两个或更多不同部分的系统。它用于在更短的时间内完成更多工作。
| Multitasking 多任务处理 | Multiprocessing 多处理 |
|---|---|
| It performs more than one task at a time using a single processor. 它使用单个处理器同时执行多个任务。 | It performs more than one task at a time using multiple processors. 它使用多个处理器同时执行多个任务。 |
| In this, the number of CPUs is only one. 在这种情况下,CPU数量只有一个。 | In this, the number of CPUs is more than one. 在这种情况下,CPU数量多于一个。 |
| It is more economical. 它更经济。 | It is less economical. 它不太经济。 |
| It is less efficient than multiprocessing. 它比多处理效率低。 | It is more efficient than multitasking. 它比多任务处理效率更高。 |
| It allows fast switching among various tasks. 它允许在各种任务之间快速切换。 | It allows smooth processing of multiple tasks at once. 它允许同时平滑处理多个任务。 |
| It requires more time to execute tasks as compared to multiprocessing. 与多处理相比,它执行任务需要更多时间。 | It requires less time for job processing as compared to multitasking. 与多任务处理相比,它处理作业所需时间更少。 |
528. What do you mean by Sockets in OS?
在操作系统中,套接字是什么意思?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69cb | 官方: 否 | 付费: 否
答案:
The socket in OS is generally referred to as an endpoint for IPC (Interprocess Communication). Here, the endpoint is referred to as a combination of an IP address and port number. Sockets are used to make it easy for software developers to create network-enabled programs. It also allows communication or exchange of information between two different processes on the same or different machines. It is mostly used in client-server-based systems. Types of Sockets There are basically four types of sockets as given below: - Stream Sockets
操作系统中的套接字通常被称为IPC(进程间通信)的端点。这里,端点指的是IP地址和端口号的组合。套接字用于使软件开发者更容易创建支持网络的程序。它还允许在同一或不同机器上的两个不同进程之间进行通信或信息交换。它主要用于基于客户端-服务器的系统中。套接字类型:基本上有四种类型的套接字,如下所示:- 流套接字
- Datagram Sockets
- Sequenced Packet Sockets
- Raw Sockets
529. Explain zombie process?
解释僵尸进程?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69cf | 官方: 否 | 付费: 否
答案:
Zombie process, referred to as a defunct process, is basically a process that is terminated or completed but the whole process control block is not cleaned up from the main memory because it still has an entry in the process table to report to its parent process. It does not consume any of the resources and is dead, but it still exists. It also shows that resources are held by process and are not free.
僵尸进程,也被称为失效进程,基本上是一个已终止或完成但整个进程控制块未从主内存中清理的进程,因为它仍在进程表中有一个条目以向其父进程报告。它不消耗任何资源并且已死亡,但它仍然存在。它还表明资源被进程持有且未释放。
530. What do you mean by cascading termination?
级联终止是什么意思?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69d3 | 官方: 否 | 付费: 否
答案:
Cascading termination is a process termination in which if the parent process is exiting or terminating then the children process will also get terminated. It does not allow the child to continue processing as its parent process terminates. It is generally initiated by OS.
级联终止是一种进程终止方式,其中如果父进程退出或终止,则子进程也将被终止。它不允许子进程在父进程终止后继续处理。它通常由操作系统发起。
531. What is starvation and aging in OS?
在操作系统中,什么是饥饿和老化?
- 知识点: 操作系统与网络 / 算法与数据结构 / 行为与软技能 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: behavioral | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69d6 | 官方: 否 | 付费: 否
答案:
When we use Priority Scheduling or Shortest Job First Scheduling, Starvation can happen, This algorithm is mostly used in CPU schedulers
当我们使用优先级调度或最短作业优先调度时,可能会发生饥饿,这种算法主要用于CPU调度器
Starvation: It is generally a problem that usually occurs when a process has not been able to get the required resources it needs for progress with its execution for a long period of time. In this condition, low priority processes get blocked and only high priority processes proceed towards completion because of which low priority processes suffer from lack of resources. Aging: It is a technique that is used to overcome the situation or problem of starvation. It simply increases the priority of processes that wait in the system for resources for a long period of time. It is considered the best technique to resolve the problem of starvation as it adds an aging factor to the priority of each and every request by various processes for resources. It also ensures that low-level queue jobs or processes complete their execution.
饥饿:这通常是一个问题,当进程长时间无法获得其执行进度所需的资源时就会发生。在这种情况下,低优先级进程被阻塞,只有高优先级进程继续走向完成,因此低优先级进程遭受资源匮乏。老化:这是一种用于克服饥饿情况或问题的技术。它简单地增加在系统中长时间等待资源的进程的优先级。它被认为是解决饥饿问题的最佳技术,因为它为各个进程对资源的每个请求的优先级添加了老化因子。它还确保低层级队列作业或进程完成其执行。
532. What is a process? What are the different states of a process?
什么是进程?进程的不同状态有哪些?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69d9 | 官方: 否 | 付费: 否
答案:
The process is basically a program that is currently under execution. The main function of an OS is to manage and handle all of these processes. When a program is loaded into the memory and it becomes a process, it can be divided into four sections ─ stack, heap, text, and data. There are two types of processes:
进程基本上是一个当前正在执行的程序。操作系统的主要功能是管理和处理所有这些进程。当程序被加载到内存中并成为进程时,它可以分为四个部分——堆栈、堆、文本和数据。有两种类型的进程:
Operating System Processes 2. User Processes
- 操作系统进程 2. 用户进程
States of Process: Different states of the process through which process goes are given below: - New State: In this state, a process is just created.
进程状态:进程经历的不同状态如下:- 新状态:在这种状态下,进程刚刚被创建。
- Running: In this state, the CPU starts working on the process’s instructions.
- Waiting: In this state, the process cannot run because it just waits for some event to occur
- Ready: In this state, the process has all resources available that are required to run but it waits to get assigned to a processor because CPUs are not working currently on instructions passed by the process.
- Terminate: In this state, the process is completed I.e., the process has finished execution.
533. What do you mean by FCFS?
FCFS是什么意思?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69dc | 官方: 否 | 付费: 否
答案:
FCFS (First Come First Serve) is a type of OS scheduling algorithm that executes processes in the same order in which processes arrive. In simple words, the process that arrives first will be executed first. It is non-preemptive in nature. FCFS scheduling may cause the problem of starvation if the burst time of the first process is the longest among all the jobs. Burst time here means the time that is required in milliseconds by the process for its execution. It is also considered the easiest and simplest OS scheduling algorithm as compared to others. Implementation of FCFS is generally managed with help of the FIFO (First In First Out) queue.
FCFS(先来先服务)是一种操作系统调度算法,按照进程到达的先后顺序执行进程。简而言之,先到达的进程将先被执行。它本质上是非抢占式的。如果第一个进程的突发时间在所有作业中最长,FCFS 调度可能会导致饥饿问题。这里的突发时间是指进程执行所需的时间,以毫秒为单位。与其他算法相比,它也被认为是最简单、最基础的操作系统调度算法。FCFS 的实现通常借助 FIFO(先进先出)队列进行管理。
534. What is thread in OS?
操作系统中的线程是什么?
- 知识点: 操作系统与网络 / 算法与数据结构 / 行为与软技能 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: behavioral | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69df | 官方: 否 | 付费: 否
答案:
Thread is a path of execution that is composed of a program counter, thread id, stack, and set of registers within the process. It is a basic unit of CPU utilization that makes communication more effective and efficient, enables utilization of multiprocessor architectures to a greater scale and greater efficiency, and reduces the time required in context switching. It simply provides a way to improve and increase the performance of applications through parallelism. Threads are sometimes called lightweight processes because they have their own stack but can access shared data. Multiple threads running in a process share: Address space, Heap, Static data, Code segments, File descriptors, Global variables, Child processes, Pending alarms, Signals, and signal handlers. Each thread has its own: Program counter, Registers, Stack, and State.
线程是一条执行路径,由进程内的程序计数器、线程 ID、堆栈和一组寄存器组成。它是 CPU 利用的基本单元,使通信更加有效和高效,能够更大规模和更高效地利用多处理器架构,并减少上下文切换所需的时间。它只是提供了一种通过并行性来改进和提升应用程序性能的方法。线程有时被称为轻量级进程,因为它们拥有自己的堆栈,但可以访问共享数据。进程内运行的多个线程共享:地址空间、堆、静态数据、代码段、文件描述符、全局变量、子进程、待处理警报、信号和信号处理器。每个线程拥有自己的:程序计数器、寄存器、堆栈和状态。
535. What is virtual memory?
什么是虚拟内存?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69e3 | 官方: 否 | 付费: 否
答案:
It is a memory management technique feature of OS that creates the illusion to users of a very large (main) memory. It is simply space where a greater number of programs can be stored by themselves in the form of pages. It enables us to increase the use of physical memory by using a disk and also allows us to have memory protection. It can be managed in two common ways by OS i.e., paging and segmentation . It acts as temporary storage that can be used along with RAM for computer processes.
它是操作系统的一种内存管理技术特性,向用户营造出拥有非常大(主)内存的错觉。它只是一个空间,其中更多程序可以以页的形式自行存储。它使我们能够通过使用磁盘来增加物理内存的使用,并允许我们实现内存保护。操作系统可以通过两种常见方式管理它,即分页和分段。它充当临时存储,可与 RAM 一起用于计算机进程。
536. What is Round Robin scheduling, and how does time quantum affect performance?
什么是轮询调度,时间量子如何影响性能?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69e6 | 官方: 否 | 付费: 否
答案:
Round Robin scheduling is a preemptive CPU scheduling algorithm where each process is given a fixed time slice, called the time quantum, in a cyclic order.
轮询调度是一种抢占式 CPU 调度算法,其中每个进程按循环顺序被给予一个固定的时间片,称为时间量子。
The length of the time quantum directly impacts performance: - If the time quantum is too small, the system spends more time on context switching, reducing efficiency.
时间量子的长度直接影响性能:- 如果时间量子太小,系统会在上下文切换上花费更多时间,降低效率。
- If the time quantum is too large, the algorithm starts behaving like First Come First Serve (FCFS), increasing response time.
537. What is the difference between a process context switch and a thread context switch?
进程上下文切换和线程上下文切换有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 / 行为与软技能 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: behavioral | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69e9 | 官方: 否 | 付费: 否
答案:
A process context switch occurs when the CPU switches from one process to another. This requires switching the entire process state, including memory space, page tables, and CPU registers, making it relatively expensive.
当 CPU 从一个进程切换到另一个进程时,会发生进程上下文切换。这需要切换整个进程状态,包括内存空间、页表和 CPU 寄存器,使其相对昂贵。
A thread context switch happens between threads of the same process. Since threads share the same address space and resources, only CPU registers and stack information need to be switched, making it faster than a process context switch.
线程上下文切换发生在同一进程的线程之间。由于线程共享相同的地址空间和资源,只需切换 CPU 寄存器和堆栈信息,使其比进程上下文切换更快。
538. What is preemptive vs non-preemptive scheduling?
什么是抢占式与非抢占式调度?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69ec | 官方: 否 | 付费: 否
答案:
Preemptive scheduling allows the operating system to interrupt a running process and assign the CPU to another process, usually based on priority or time slice expiration.
抢占式调度允许操作系统中断正在运行的进程,并将 CPU 分配给另一个进程,通常基于优先级或时间片到期。
Non-preemptive scheduling allows a process to run until it finishes execution or voluntarily gives up the CPU.
非抢占式调度允许进程运行直到完成执行或自愿放弃 CPU。
Preemptive scheduling improves responsiveness and fairness, while non-preemptive scheduling is simpler but can lead to poor response times.
抢占式调度提高了响应性和公平性,而非抢占式调度更简单,但可能导致较差的响应时间。
539. What is the difference between page size and frame size?
页大小和帧大小有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69ef | 官方: 否 | 付费: 否
答案:
- Page size refers to the fixed-size block of memory used by a process in virtual memory.
- Frame size refers to the fixed-size block of memory in physical memory (RAM).
In operating systems, page size and frame size are always equal. This one-to-one mapping allows pages from virtual memory to be easily loaded into frames in physical memory.
在操作系统中,页面大小和帧大小总是相等的。这种一对一的映射使得虚拟内存中的页面能够轻松加载到物理内存中的帧中。
540. What is copy-on-write, and where is it used?
什么是写时复制,它在哪些地方被使用?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0558d557c902bb69f2 | 官方: 否 | 付费: 否
答案:
Copy-on-write (COW) is a memory management technique where multiple processes initially share the same memory pages, and a copy is created only when one process tries to modify the data.
写时复制(COW)是一种内存管理技术,其中多个进程初始时共享相同的内存页面,只有当某个进程试图修改数据时才创建副本。
This approach improves performance and reduces memory usage because unnecessary copying is avoided.
这种方法提高了性能并减少了内存使用,因为避免了不必要的复制。
Copy-on-write is commonly used in: - Process creation (for example, after fork())
写时复制常用于:- 进程创建(例如,fork()之后)
- Virtual memory systems
- File systems and snapshots
541. What is internal vs external fragmentation?
什么是内部碎片和外部碎片?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb69f5 | 官方: 否 | 付费: 否
答案:
- Internal fragmentation happens when allocated memory blocks are larger than needed, leaving unused space inside the allocated block.
- External fragmentation occurs when free memory is split into small, non-contiguous blocks, making it hard to allocate a large, contiguous block.
Internal fragmentation wastes space within allocations, while external fragmentation wastes space between allocations.
内部碎片浪费了分配内部的空间,而外部碎片浪费了分配之间的空间。
542. What is priority inversion, and how can it be solved?
什么是优先级反转,如何解决它?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb69f8 | 官方: 否 | 付费: 否
答案:
Priority inversion occurs when a high-priority process is forced to wait because a low-priority process holds a resource it needs, and a medium-priority process preempts the low-priority one.
当高优先级进程因为低优先级进程持有其所需的资源而被迫等待,同时一个中优先级进程抢占低优先级进程时,就会发生优先级反转。
This situation can delay critical tasks and harm system responsiveness.
这种情况可能延迟关键任务并损害系统的响应性。
Common solutions include: - Priority inheritance, where the low-priority process temporarily inherits the higher priority while holding the resource
常见的解决方案包括:- 优先级继承,其中低优先级进程在持有资源时暂时继承更高的优先级
Priority ceiling , where resources are assigned a priority that prevents lower-priority tasks from blocking higher-priority ones
优先级上限,其中资源被分配一个优先级,以防止低优先级任务阻塞高优先级任务
543. Explain the producer-consumer problem.
解释生产者-消费者问题。
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb69ff | 官方: 否 | 付费: 否
答案:
The producer-consumer problem is a classic synchronization problem where: - A producer generates data and places it into a shared buffer
生产者-消费者问题是一个经典的同步问题,其中:- 生产者生成数据并将其放入共享缓冲区
A consumer removes and processes data from that buffer
The challenge is to ensure: - Producers do not add data when the buffer is full挑战在于确保:- 当缓冲区满时,生产者不添加数据
- Consumers do not remove data when the buffer is empty
Both operate without conflicts
This problem is commonly solved using synchronization techniques such as semaphores, mutexes, or monitors to coordinate access to the shared buffer.这个问题通常使用同步技术(如信号量、互斥锁或管程)来解决,以协调对共享缓冲区的访问。
544. What is a monitor in operating systems?
操作系统中的监视器是什么?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a02 | 官方: 否 | 付费: 否
答案:
A monitor is a high-level synchronization construct used to manage access to shared resources safely.
监视器是一种高级同步构造,用于安全地管理对共享资源的访问。
It combines: - Mutual exclusion: only one thread can execute monitor code at a time
它结合了:- 互斥:一次只能有一个线程执行监视器代码
Condition variables: to allow threads to wait and be notified
Monitors simplify synchronization by encapsulating shared data and the operations on that data in one place, reducing the chances of race conditions.监视器通过将共享数据及对数据的操作封装在一个地方来简化同步,从而减少竞争条件的可能性。
545. What is the difference between a mutex and a semaphore?
互斥锁和信号量有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a05 | 官方: 否 | 付费: 否
答案:
A mutex is a locking mechanism used to ensure mutual exclusion, meaning only one thread or process can access a critical section at a time. It is typically owned and released by the same thread.
互斥锁是一种用于确保互斥的锁定机制,意味着一次只有一个线程或进程可以访问临界区。它通常由同一线程拥有并释放。
A semaphore is a signaling mechanism that controls access to a resource using a counter. It allows multiple threads or processes to access a limited number of resources.
信号量是一种通过计数器控制资源访问的信号机制。它允许多个线程或进程访问有限数量的资源。
546. Can you enlist some commonly used network commands?
你能列举一些常用的网络命令吗?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc9298 | 官方: 否 | 付费: 否
答案:
Some commonly used networking commands in Unix are: - telnet: This is used for remote login and for communication with another hostname.
Unix中一些常用的网络命令有:- telnet:用于远程登录及与另一个主机通信。
- ping: This is used for checking network connectivity.
- hostname: This gives the IP address and domain name.
- nslookup: This performs a DNS query.
- xtraceroute: This is used to determine the number of hops and response time required to reach the network host.
- netstat: This provides information about system and ports, routing tables, interface statistics, etc.
- tcpdump: This provides info about both incoming and outgoing network traffic.
547. Explain a path in UNIX and different types of pathnames.
解释UNIX中的路径及不同类型的路径名。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc929b | 官方: 否 | 付费: 否
答案:
A Path is the unique location of a file/directory and a way to access it within the hierarchy of directories. There are basically two types of pathnames that are used in Unix. - Absolute Pathname: The complete path specifying the location of a file/ directory from the very start of the actual file system(root directory).Ex- /usr/local/Cellar/mysql/bin
路径是文件/目录在目录层次结构中的唯一位置和访问方式。Unix中主要有两种路径名。- 绝对路径名:从实际文件系统(根目录)的起始位置指定文件/目录位置的完整路径。例如:/usr/local/Cellar/mysql/bin
- Relative Pathname: The path from the current working directory where the user is i.e. the present working directory (pwd).Ex- If current directory is /usr/local/Cellar the the relative path for bin is ./mysql/bin
548. Explain Superblock in UNIX.
解释UNIX中的超级块。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc929e | 官方: 否 | 付费: 否
答案:
A SuperBlock is a program that contains records of specific file systems such as the block size, the empty and the filled blocks and their respective counts, the size of the block groups, the disk block map, the size and location of the inode tables, and usage information. There are basically two types of superblocks: - Default superblock: It is a fixed offset from the beginning of the system’s disk partition.
超级块是一个包含特定文件系统记录的程序,例如块大小、空块和已填充块及其各自计数、块组大小、磁盘块映射、inode表的大小和位置以及使用信息。超级块主要有两种类型:- 默认超级块:它位于系统磁盘分区开头固定偏移处。
- Redundant superblock: There are multiple copies of superblocks of a default one and are referenced when the default superblock is affected by a system crash or some errors.
549. Enlist some file manipulation commands in UNIX.
列举一些UNIX中的文件操作命令。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc92a1 | 官方: 否 | 付费: 否
答案:
These are few file manipulation commands: - cat filename - Displays contents of the file.
这些是几个文件操作命令:- cat filename - 显示文件内容。
- cp source destination - Copy the source file into the destination.
- mv old_name new_name - Move/rename.
- rm filename - Remove/delete filename.
- touch filename - creating/changing modification time.
- In [-s] old_name new_name - Creating a soft link on an old name.
- Is –F - Displays information about the file type.
- ls -ltr - This will display in long format sorted by modified time with oldest first.
550. Explain networking stack and protocol.
解释网络栈和协议。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc92a4 | 官方: 否 | 付费: 否
答案:
The default networking stack protocol for the UNIX kernel is TCP/IP. TCP/IP works in two parts: TCP(Transmission Control Protocol) is responsible for the virtual circuit layer that provides bidirectional data transmission, IP(Internet Protocol) is responsible for packet transmission between the user processes and the networking layer.
UNIX 内核的默认网络协议栈是TCP/IP。TCP/IP分两部分工作:TCP(传输控制协议)负责提供双向数据传输的虚拟电路层,IP(网际协议)负责用户进程与网络层之间的数据包传输。
551. Explain the alias mechanism.
解释别名机制。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc92aa | 官方: 否 | 付费: 否
答案:
To reduce the time of repeatedly typing long commands, an alias is used to assign another name to that command. Basically, it is a short form of a larger command. alias gco='git checkout -b'
为了减少重复输入长命令的时间,别名用于给该命令分配另一个名称。基本上,它是较大命令的简短形式。alias gco='git checkout -b'
Here, we added an alias for the checkout command of git which is frequently used by devs making it less painless every time typing a long command.
在这里,我们为开发人员频繁使用的git checkout命令添加了一个别名,使得每次输入长命令时不再那么痛苦。
552. What is a wildcard and how is it used?
什么是通配符,如何使用它?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc92ae | 官方: 否 | 付费: 否
答案:
A wildcard is a symbol that takes the place of an unknown character or set of characters. The asterisk(*) and question mark(?) are wildcard characters usually used. The wildcards are majorly used in searching files with unknown characters in the filename (or directory).
通配符是一种代表未知字符或一组字符的符号。星号(*)和问号(?)是通常使用的通配符。通配符主要用于在文件名(或目录)中搜索包含未知字符的文件。
553. What are system calls and library functions in terms of Unix commands?
就Unix命令而言,什么是系统调用和库函数?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: coding
- 分类: fullstack
- id: 69b37c8758d557c902bc92b1 | 官方: 否 | 付费: 否
答案:
System calls: System calls are an interface to the kernel itself that further requests the operating system to perform tasks on behalf of user programs. Whenever a system call is invoked within the operating system, the application program performs a context switch from user space to kernel space. These are not portable.
系统调用:系统调用是内核本身的接口,进一步请求操作系统代表用户程序执行任务。每当操作系统中调用系统调用时,应用程序会从用户空间切换到内核空间。这些调用不可移植。
Library functions: These are functions that are not part of the kernel but are used by the different application programs. As compared to the system call it takes less time for execution and is portable and can perform certain tasks only in ‘kernel mode’.
库函数:这些函数不属于内核,但被不同的应用程序使用。与系统调用相比,它们执行时间更短,可移植,并且只能在“内核模式”下执行某些任务。
554. In shell scripting, what is the significance of the Shebang line?
在shell脚本中,Shebang行的意义是什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc92b4 | 官方: 否 | 付费: 否
答案:
It gives information about the location of where the engine is placed. The engine is the one that executes the given script. It is placed at the top of the script.
它提供了解释器所在位置的信息。解释器是执行给定脚本的引擎。它位于脚本顶部。
555. Differentiate between swapping and paging?
区分交换和分页?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc92b8 | 官方: 否 | 付费: 否
答案:
Swapping: In the case of swapping the main memory is loaded with the complete process and thus only the process less than the main memory size is executable. This is fairly easy to implement but not very efficient.
交换:在交换的情况下,主内存加载完整的进程,因此只有小于主内存大小的进程才能执行。这相当容易实现但效率不高。
Paging: On the other hand in the case of paging instead of loading the whole process into the main memory only required memory pages are loaded. This is complex to implement but allows us to run a number of processes simultaneously.
分页:另一方面,在分页的情况下,不是将整个进程加载到主内存,而是只加载所需的内存页。这实现起来复杂,但允许我们同时运行多个进程。
556. What is a daemon?
什么是守护进程?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc92bb | 官方: 否 | 付费: 否
答案:
A daemon is a background job or process responsible for a certain task or set of tasks. This is a fundamental concept to the Unix OS. The Unix kernel consists of numerous system daemons that are responsible for memory management, file system management, printer jobs, network connections, and several other services.
守护进程是负责特定任务或一组任务的后台作业或进程。这是Unix操作系统的基本概念。Unix内核包含许多系统守护进程,负责内存管理、文件系统管理、打印作业、网络连接以及其他若干服务。
557. Can you explain the method of changing file access permission?
你能解释一下更改文件访问权限的方法吗?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc92be | 官方: 否 | 付费: 否
答案:
There are three components of a file permissions - Owner permissions − This determines what actions the owner of the file can perform.
文件权限有三个组成部分——所有者权限 — 这决定了文件所有者可以执行哪些操作。
- Group permissions − This determines what actions a group member(of the group that a file belongs to) can perform.
Other (world) permissions − This is for everyone else.
$ ls -l /home/sroy8091
-rwxr-xr-- 1 sroy8091 users 1024 Mar 23 00:10 myfile-rwxr-xr-- 1 sroy8091 users 1024 Mar 23 00:10 myfile
drwxr-xr--- 1 sroy8091 users 1024 Mar 23 00:10 mydir
drwxr-xr--- 1 sroy8091 users 1024 Mar 23 00:10 mydir
r, w, and x represent read, write and execute respectively.
r、w 和 x 分别代表读、写和执行。
To change the file permission we need to run chmod command.
要更改文件权限,我们需要运行 chmod 命令。
$ ls -l testfile
-rwxrwxr-- 1 sroy8091 users 1024 Mar 23 00:10 testfile
-rwxrwxr-- 1 sroy8091 users 1024 Mar 23 00:10 testfile
$ chmod o+wx testfile
$ ls -l testfile
-rwxrwxrwx 1 sroy8091 users 1024 Mar 23 00:10 testfile
-rwxrwxrwx 1 sroy8091 users 1024 Mar 23 00:10 testfile
Here we updated the permission for other users, from only read to read, write and execute.
这里我们更新了其他用户的权限,从只读改为读、写和执行。
558. Explain the process model of Unix?
解释 Unix 的进程模型?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc92c1 | 官方: 否 | 付费: 否
答案:
Processes are scheduled using a priority-based preemptive round-robin scheduling algorithm. This ensures that there is no CPU starvation and CPU saturation. Based on the completion of the time slice or wait by any I/O, processes can be preempted from the run queue and moved to the sleep queue. While scheduling we might face deadlock on any resources hence, user applications need to provide deadlock detection to ensure that user processes do not deadlock on resources.
进程使用基于优先级的抢占式轮转调度算法进行调度。这确保了不会出现 CPU 饥饿和 CPU 饱和。基于时间片完成或任何 I/O 等待,进程可以从运行队列中被抢占并移入睡眠队列。在调度过程中,我们可能会遇到任何资源上的死锁,因此用户应用程序需要提供死锁检测,以确保用户进程不会在资源上死锁。
559. Explain the term filter.
解释术语“过滤器”。
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc92c4 | 官方: 否 | 付费: 否
答案:
A program that takes input from the standard input, and displays results to the standard output by performing some actions on it. The most popular example of a Unix filter is the grep command. This is used to search for a pattern in files(standard input) and print them out in the output screen(standard output).
一种从标准输入接收输入,并通过对输入执行某些操作后将结果显示到标准输出的程序。Unix 过滤器最著名的例子是 grep 命令。它用于在文件(标准输入)中搜索模式,并将其打印到输出屏幕(标准输出)上。
560. What can you tell about shell variables?
关于 shell 变量,你能说明什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc92c7 | 官方: 否 | 付费: 否
答案:
The shell has a few sets of predefined internal variables with the support of creating new ones as well. Some of these are environment variables whereas others are local variables. These can be accessed by different processes. The name of a variable can contain only letters(A-z), numbers(0-9), or the underscore character ( _).
shell 有一些预定义的内部变量集合,也支持创建新变量。其中一些是环境变量,而另一些是局部变量。这些变量可以被不同的进程访问。变量名只能包含字母(A-z)、数字(0-9)或下划线字符( _)。
NAME="Sumit Roy"
NAME="Sumit Roy"
$ echo $NAME
$ unset NAME
561. What do you know about the MBR?
关于MBR你知道些什么?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc92ca | 官方: 否 | 付费: 否
答案:
It stands for Master Boot Record and is a small program that is executed when the computer is booting up in order to find the OS and load it into memory. During the first stage of the system boot-up process, the BIOS (basic input-output system) searches for the MBR and then loads it into memory, after which the MBR takes over.
它代表主引导记录,是一段在计算机启动时执行的小程序,用于查找操作系统并将其加载到内存中。在系统启动过程的第一阶段,BIOS(基本输入输出系统)搜索MBR并将其加载到内存中,之后MBR接管控制。
562. Explain the file system in UNIX
解释UNIX中的文件系统
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: unix, systems;标签: interviewbit, unix, topic-specific, systems)
- 类型: technical | 难度: medium | 子类型: concept
- 分类: fullstack
- id: 69b37c8758d557c902bc92cd | 官方: 否 | 付费: 否
答案:
These are a fundamental component of the file system: - Boot lock
这些是文件系统的基本组成部分:- 引导块
- Inode lock
- Data Block
Super Block
The UNIX file system has many different file system types such as ufs (UNIX filesystem), NFS(Network file system), vxfs(Veritas file system), and cdfs(CD-ROM filesystem). Among these, the ufs file system type is the most standard UNIX file system. Reads and writes to a ufs file system are done in blocks depending on the size of the file system block size. Block sizes can range from 1 KB to 8 KB depending on the file system type selected.UNIX文件系统有许多不同的文件系统类型,如ufs(UNIX文件系统)、NFS(网络文件系统)、vxfs(Veritas文件系统)和cdfs(CD-ROM文件系统)。其中,ufs文件系统类型是最标准的UNIX文件系统。对ufs文件系统的读写是以块为单位进行的,具体取决于文件系统块大小的大小。块大小可以从1 KB到8 KB不等,具体取决于所选的文件系统类型。
563. 如何设计一个 AI Agent(人工智能代理)的架构?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: system-design, python;标签: AI Agent, Planner, Tools, Memory, RAG)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 695cd80b1da553795626521b | 官方: 是 | 付费: 否
答案:
TL;DRAI Agent(人工智能代理)架构通常由:输入层(Input Layer)、规划与推理层(Planning and Reasoning Layer)、工具调用层(Tool Calling Layer)、记忆层(Memory Layer)、检索/RAG层(Retrieval/RAG Layer)、执行与反馈循环(Execution and Feedback Loop)组成,并且需要考虑安全(Security)、可观测性(Observability)与成本控制(Cost Control)。
核心模块- Interface(接口):用户输入、上下文管理(Context Management)(UI/API)。
- LLM Reasoner:负责推理与生成。
- Planner:把目标拆成任务步骤(可选)。
- Tool Executor:函数调用、插件、外部 API。
- Memory:短期(session)与长期(profile/DB)。
- Retriever/RAG:向量检索知识增强。
- Evaluator:判断结果质量(self-check / guardrails)。
关键设计点- 任务拆解与循环:Plan(计划)→ Act(行动)→ Observe(观察)→ Reflect(反思)。 - 工具失败重试与降级策略。
- 安全:权限控制、提示注入防护。
- 可观测:日志、trace、token 成本统计。
564. volatile(易变关键字)能使得一个非原子操作变成原子操作吗?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency, volatile;标签: volatile, atomicity, long, double)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 6965dbd4fa809e6d38860b62 | 官方: 是 | 付费: 否
答案:
答案一个典型的例子是在类中有一个 long(长整型)类型的成员变量。如果你知道该成员变量会被多个线程访问,如计数器、价格等,你最好是将其设置为 volatile(易变关键字)。为什么?因为 Java 中读取 long(长整型)类型变量不是原子的,需要分成两步,如果一个线程正在修改该 long(长整型)变量的值,另一个线程可能只能看到该值的一半(前 32 位)。但是对一个 volatile(易变关键字)型的 long(长整型)或 double(双精度浮点型)变量的读写是原子。
565. volatile(易变关键字)修饰符的有过什么实践?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency, volatile, jmm;标签: memory barrier, write barrier, read barrier, visibility)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 6965dbd4fa809e6d38860b68 | 官方: 是 | 付费: 否
答案:
答案一种实践是用 volatile(易变关键字)修饰 long(长整型)和 double(双精度浮点型)变量,使其能按原子类型来读写。double(双精度浮点型)和 long(长整型)都是64位宽,因此对这两种类型的读是分为两部分的,第一次读取第一个 32 位,然后再读剩下的 32 位,这个过程不是原子的,但 Java 中 volatile(易变关键字)型的 long(长整型)或 double(双精度浮点型)变量的读写是原子的。volatile(易变关键字)修复符的另一个作用是提供内存屏障(memory barrier),例如在分布式框架中的应用。简单的说,就是当你写一个 volatile(易变关键字)变量之前,Java 内存模型会插入一个写屏障(write barrier),读一个 volatile(易变关键字)变量之前,会插入一个读屏障(read barrier)。意思就是说,在你写一个 volatile(易变关键字)域时,能保证任何线程都能看到你写的值,同时,在写之前,也能保证任何数值的更新对所有线程是可见的,因为内存屏障会将其他所有写的值更新到缓存。
566. volatile(易变关键字)类型变量提供什么保证?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency, volatile, jmm;标签: happens-before, visibility, ordering, atomicity)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 6965dbd4fa809e6d38860b6f | 官方: 是 | 付费: 否
答案:
答案volatile(易变关键字)变量提供顺序和可见性保证,例如,JVM(Java虚拟机)或者 JIT(即时编译器)为了获得更好的性能会对语句重排序,但是 volatile(易变关键字)类型变量即使在没有同步块的情况下赋值也不会与其他语句重排序。 volatile(易变关键字)提供 happens-before(先行发生)的保证,确保一个线程的修改能对其他线程是可见的。某些情况下,volatile(易变关键字)还能提供原子性,如读 64 位数据类型,像 long(长整型)和 double(双精度浮点型)都不是原子的,但 volatile(易变关键字)类型的 double(双精度浮点型)和 long(长整型)就是原子的。
567. 什么是多线程环境下的伪共享(false sharing)?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency, performance;标签: false sharing, cache line, performance)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 6965dbd5fa809e6d38860b7b | 官方: 是 | 付费: 否
答案:
答案伪共享(false sharing)是多线程系统(每个处理器有自己的局部缓存)中一个众所周知的性能问题。伪共享(false sharing)发生在不同处理器的上的线程对变量的修改依赖于相同的缓存行(cache line),伪共享(false sharing)问题很难被发现,因为线程可能访问完全不同的全局变量,内存中却碰巧在很相近的位置上。如其他诸多的并发问题,避免伪共享(false sharing)的最基本方式是仔细审查代码,根据缓存行(cache line)来调整你的数据结构。
568. 什么是 Busy spin(忙等待)?我们为什么要使用它?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency, performance;标签: busy spin, low latency, LMAX, Disruptor)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 6965dbd5fa809e6d38860b7f | 官方: 是 | 付费: 否
答案:
答案Busy spin(忙等待)是一种在不释放 CPU 的基础上等待事件的技术。它经常用于避免丢失 CPU 缓存中的数据(如果线程先暂停,之后在其他CPU上运行就会丢失)。所以,如果你的工作要求低延迟,并且你的线程目前没有任何顺序,这样你就可以通过循环检测队列中的新消息来代替调用 sleep() 或 wait() 方法。它唯一的好处就是你只需等待很短的时间,如几微秒或几纳秒。LMAX 分布式框架是一个高性能线程间通信的库,该库有一个 BusySpinWaitStrategy(忙等待策略)类就是基于这个概念实现的,使用 busy spin(忙等待)循环 EventProcessors(事件处理器)等待屏障。
569. 什么是线程局部变量?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency, threadlocal;标签: ThreadLocal, ThreadLocalMap, memory leak)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 6965dbd5fa809e6d38860c53 | 官方: 是 | 付费: 否
答案:
答案当使用ThreadLocal(线程局部变量)维护变量时,ThreadLocal(线程局部变量)为每个使用该变量的线程提供独立的变量副本,每个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本,是线程隔离的。线程隔离的秘密在于ThreadLocalMap(线程局部变量映射表)类(ThreadLocal(线程局部变量)的静态内部类)
线程局部变量(ThreadLocal Variable)是局限于线程内部的变量,属于线程自身所有,不在多个线程间共享。Java 提供 ThreadLocal 类(ThreadLocal Class)来支持线程局部变量,是一种实现线程安全(Thread Safety)的方式。但是在管理环境下(如 web 服务器(Web Server))使用线程局部变量的时候要特别小心,在这种情况下,工作线程(Worker Thread)的生命周期比任何应用变量的生命周期都要长。任何线程局部变量一旦在工作完成后没有释放,Java 应用就存在内存泄露(Memory Leak)的风险。
ThreadLocal的方法:void set(T value)、T get()以及T initialValue()。
ThreadLocal是如何为每个线程创建变量的副本的:
首先,在每个线程Thread内部有一个ThreadLocal.ThreadLocalMap类型的成员变量threadLocals,这个threadLocals就是用来存储实际的变量副本的,键值为当前ThreadLocal变量,value为变量副本(即T类型的变量)。初始时,在Thread里面,threadLocals为空,当通过ThreadLocal变量调用get()方法或者set()方法,就会对Thread类中的threadLocals进行初始化,并且以当前ThreadLocal变量为键值,以ThreadLocal要保存的副本变量为value,存到threadLocals。然后在当前线程里面,如果要使用副本变量,就可以通过get方法在threadLocals里面查找。
总结:
a、实际的通过ThreadLocal创建的副本是存储在每个线程自己的threadLocals中的
b、为何threadLocals的类型ThreadLocalMap的键值为ThreadLocal对象,因为每个线程中可有多个threadLocal变量,就像上面代码中的longLocal和stringLocal;
c、在进行get之前,必须先set,否则会报空指针异常(NullPointerException);如果想在get之前不需要调用set就能正常访问的话,必须重写initialValue()方法
570. 用 wait-notify 写一段代码来解决生产者-消费者问题(Producer-Consumer Problem)?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency, wait-notify;标签: producer-consumer, wait, notify)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 6965dbd5fa809e6d38860c57 | 官方: 是 | 付费: 否
答案:
答案请参考答案中的示例代码。只要记住在同步块(Synchronized Block)中调用 wait() 和 notify()方法,如果阻塞,通过循环来测试等待条件。
571. 用 Java 写一个线程安全的单例模式(Singleton Pattern)?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, concurrency, design-patterns;标签: singleton, thread-safe, enum)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 6965dbd5fa809e6d38860c5b | 官方: 是 | 付费: 否
答案:
答案请参考答案中的示例代码,这里面一步一步教你创建一个线程安全的 Java 单例类。当我们说线程安全时,意思是即使初始化是在多线程环境中,仍然能保证单个实例。Java 中,使用枚举(Enum)作为单例类是最简单的方式来创建线程安全单例模式的方式。
572. JVM 选项 -XX:+UseCompressedOops 有什么作用?为什么要使用?
- 知识点: 操作系统与网络 / 算法与数据结构 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, jvm, performance;标签: UseCompressedOops, OOP, heap, memory)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 6965dcf6fa809e6d388632b8 | 官方: 是 | 付费: 否
答案:
答案当你将你的应用从 32 位的 JVM 迁移到 64 位的 JVM 时,由于对象的指针(Pointer)从 32 位增加到了 64 位,因此堆内存(Heap Memory)会突然增加,差不多要翻倍。这也会对 CPU 缓存(CPU Cache)(容量比内存小很多)的数据产生不利的影响。因为,迁移到 64 位的 JVM 主要动机在于可以指定最大堆大小,通过压缩 OOP(Compressed Ordinary Object Pointer)可以节省一定的内存。通过 -XX:+UseCompressedOops 选项,JVM 会使用 32 位的 OOP,而不是 64 位的 OOP。
573. 32 位 JVM 和 64 位 JVM 的最大堆内存(Maximum Heap Memory)分别是多少?
- 知识点: 操作系统与网络 / 算法与数据结构 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, jvm, memory;标签: heap, 32-bit, 64-bit, max heap)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 6965dcf6fa809e6d388632c0 | 官方: 是 | 付费: 否
答案:
答案理论上说上 32 位的 JVM 堆内存可以到达 2^32,即 4GB,但实际上会比这个小很多。不同操作系统之间不同,如 Windows 系统大约 1.5 GB,Solaris 大约 3GB。64 位 JVM允许指定最大的堆内存,理论上可以达到 2^64,这是一个非常大的数字,实际上你可以指定堆内存大小到 100GB。甚至有的 JVM,如 Azul,堆内存到 1000G 都是可能的。
574. Java 中的内存映射缓存区(MappedByteBuffer)是什么?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 / 编程语言基础 (主题: java, nio, io;标签: MappedByteBuffer, FileChannel.map, memory-mapped I/O)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 6965de58fa809e6d388650f4 | 官方: 是 | 付费: 否
答案:
答案在题目中没有提供答案,因此这里给出一个通用回答:内存映射缓冲区通常指通过 FileChannel.map() 得到的 MappedByteBuffer,它把文件的一段区域映射到内存中,允许像访问内存一样读写文件内容,常用于大文件的高效 I/O,但需要注意映射区域大小、文件锁/并发与资源释放等问题。
575. 说一下 tcp 粘包是怎么产生的?
- 知识点: 操作系统与网络 (主题: networking, tcp;标签: TCP, Sticky Packet, Nagle, Buffer)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 6965ee67fa809e6d3888185d | 官方: 是 | 付费: 否
答案:
答案①. 发送方产生粘包
采用TCP协议传输数据的客户端与服务器经常是保持一个长连接的状态(一次连接发一次数据不存在粘包),双方在连接不断开的情况下,可以一直传输数据;但当发送的数据包过于的小时,那么TCP协议默认的会启用Nagle算法(Nagle's algorithm),将这些较小的数据包进行合并发送(缓冲区数据发送是一个堆压的过程);这个合并过程就是在发送缓冲区中进行的,也就是说数据发送出来它已经是粘包的状态了。
②. 接收方产生粘包
接收方采用TCP协议接收数据时的过程是这样的:数据到底接收方,从网络模型(OSI model)的下方传递至传输层,传输层的TCP协议处理是将其放置接收缓冲区,然后由应用层来主动获取(C语言用recv、read等函数);这时会出现一个问题,就是我们在程序中调用的读取数据函数不能及时的把缓冲区中的数据拿出来,而下一个数据又到来并有一部分放入的缓冲区末尾,等我们读取数据时就是一个粘包。(放数据的速度 > 应用层拿数据速度)
576. 简述synchronized和java.util.concurrent.locks.Lock的异同?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: java, concurrency;标签: synchronized, Lock, java.util.concurrent.locks)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 696700d8fa809e6d389eba6d | 官方: 是 | 付费: 否
答案:
答案主要相同点:Lock能完成synchronized所实现的所有功能
主要不同点:Lock有比synchronized更精确的线程语义和更好的性能。synchronized会自动释放锁,而Lock一定要求程序员手工释放,并且必须在finally从句中释放。
577. 分布式计数器(Distributed Counter)的端到端工作流通常是什么样的?(含 WebSocket、心跳(Heartbeat)、pub-sub(Publish-Subscribe))
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: distributed-systems, websocket, crdt;标签: workflow, real-time)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 696de6ae623565038f404c45 | 官方: 是 | 付费: 否
答案:
答案典型流程是:用户先通过 HTTP GET 拉取当前计数;随后通过实时平台建立 WebSocket 订阅特定页面的计数变化。发布端或网关在用户进入/退出时触发更新,实时平台/网关用心跳(或其他机制)识别断连并触发 decrement。计数数据库(CRDT(Conflict-free Replicated Data Type))在本地写入后,通过 pub-sub 或 keyspace notification 产生“计数更新事件”,计数服务再把事件推送到实时平台,由实时平台 fan-out 给所有订阅者,实现近实时展示。
578. 跨数据中心的计数器更新是如何传播到其他机房并实时下发给订阅用户的?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: distributed-systems, crdt, websocket;标签: multi-DC, replication)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 696de6b0623565038f404ec4 | 官方: 是 | 付费: 否
答案:
答案在本地机房更新后,网关/订阅服务器会先在本地内存订阅表里找到需要推送的客户端并通过 WebSocket 下发;同时 CRDT 数据库会把本地更新异步复制到其他机房的副本。对端机房在收到复制并合并后,通过 Lua/通知机制触发计数服务,再由对端的实时平台向其本地订阅者广播。这样既保证本地低延迟体验,又能在多机房间最终收敛。
579. 如何验证 CRDT 计数器在网络分区(Network Partition)下依然能最终一致?给出一个混沌测试(Chaos Testing)思路。
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: distributed-systems, crdt, reliability;标签: chaos engineering, network partition)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 696de6b6623565038f405448 | 官方: 是 | 付费: 否
答案:
答案可做“分区-写入-恢复-验证”测试:1)人为隔离多个机房的 CRDT 副本网络;2)在每个机房独立对本地计数器做增量更新;3)在分区期间观察各机房只看到本地增量;4)恢复网络连接;5)等待复制与合并完成后,验证各机房计数均等于所有机房增量之和(或 PN-Counter 的 Σinc−Σdec)。同时监控复制延迟、冲突合并次数与资源消耗。
580. 如何在计数器系统(counter system)里做到“低延迟”?哪些部署与协议选择最关键?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: distributed-systems, websocket, crdt;标签: latency, multi-region)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 696de6bb623565038f405904 | 官方: 是 | 付费: 否
答案:
答案低延迟核心在“就近服务 + 轻量实时通道”。部署上把 CRDT 数据库(CRDT database)与网关(gateway)/实时平台(real-time platform)在多机房(multi-datacenter)多 AZ(Availability Zone)就近部署,并通过路由(routing)把客户端连到本地机房;协议上用 WebSocket/SSE(Server-Sent Events)做增量推送,减少轮询(polling);读路径可用缓存(caching)与批量请求(如 pipelining)降低 RTT(round-trip time);同时避免锁(lock)与强一致(strong consistency)写入链路,采用最终一致(eventual consistency)与异步复制(asynchronous replication)换取更高可用与更低尾延迟。
581. 为什么说 P2P 会带来更高的网络管理复杂度(network management complexity)?在工程上通常要额外解决哪些问题?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: system-design, networking;标签: Churn, NAT, Operations)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 696def25623565038f41c5b7 | 官方: 是 | 付费: 否
答案:
答案因为没有中心节点(central node)统一分配地址、路由与策略,节点又频繁上下线,导致拓扑维护(topology maintenance)、发现(discovery)、连接质量评估(connection quality evaluation)都要分布式完成。工程上常需要解决:节点发现与路由(DHT(Distributed Hash Table)/目录(directory))、NAT 穿透(NAT traversal)(STUN(Session Traversal Utilities for NAT)/TURN(Traversal Using Relays around NAT)/ICE(Interactive Connectivity Establishment))、限流与反滥用(rate limiting and anti-abuse)、版本兼容(version compatibility)、监控可观测(monitoring and observability)、以及对恶意节点的隔离与信誉体系(reputation system)。
582. P2P 在 IoT/分布式 AI 里可能带来哪些价值?需要注意哪些前提条件?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: system-design, networking;标签: IoT, Distributed AI, Edge Computing)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 696def26623565038f41c5ec | 官方: 是 | 付费: 否
答案:
答案P2P 可让设备间就近交换数据、协同计算与分发模型更新,降低中心云带宽与延迟,并提升在弱网(weak network)/断网(network outage)场景下的自治能力(autonomy)。前提条件包括:设备身份与安全(防伪装节点)、资源受限(resource-constrained)下的协议开销(protocol overhead)控制、电源与在线率(online rate)、数据隐私与合规(privacy and compliance)、以及在边缘端(edge)进行有效的任务调度与容错(task scheduling and fault tolerance)。
583. 如果你要面试系统设计(system design):设计一个 P2P 内容分发系统,你会优先问面试官哪些澄清问题?
- 知识点: 操作系统与网络 / 系统设计/架构 / UI/UX 设计 (主题: system-design, networking;标签: System Design Interview, P2P CDN, Requirements)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 696def26623565038f41c5fa | 官方: 是 | 付费: 否
答案:
答案优先澄清:内容类型与授权范围(合规)、实时性要求(直播/点播)、目标规模(DAU(daily active users)/峰值并发)、端侧能力(带宽/存储/在线率)、是否允许最终一致与内容过期策略(content expiration policy)、NAT 穿透成功率目标、是否需要激励机制(incentive mechanism)(贡献带宽)、安全策略(签名/加密/反投毒)、以及是否允许保底的中心化 CDN(Centralized CDN(Content Delivery Network))/回源。
584. 有哪些预防死锁(deadlock)的技术?
- 知识点: 操作系统与网络 / 系统设计/架构 (主题: concurrency, operating-systems;标签: Deadlock, Lock Ordering, Timeout)
- 类型: technical | 难度: hard | 子类型:
- 分类: fullstack
- id: 69773272a39c9c5c3a8d58bf | 官方: 是 | 付费: 否
答案:
答案常见手段:统一加锁顺序(lock ordering)避免循环等待;尽量缩短持锁时间、减少锁粒度;使用 try-lock/超时避免无限等待;对共享资源做分层或资源预分配;用无锁(lock-free)/并发容器或消息队列(message queue)减少锁竞争;数据库层面可用较低隔离级别(isolation level)或重试策略(retry strategy)。核心目标是破坏死锁产生条件之一,尤其是“循环等待”。
585. What command is used to list files or folders in alphabetical order in UNIX?
在UNIX中,用什么命令按字母顺序列出文件或文件夹?
- 知识点: 操作系统与网络 (主题: application-support;标签: interviewbit, application-support, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3793d58d557c902b9935f | 官方: 否 | 付费: 否
答案:
By using the ls command, you can list down the current directory’s content like files and folders. Syntax:
通过使用ls命令,你可以列出当前目录的内容,如文件和文件夹。语法:
ls [OPTIONS] [FILES]
ls [选项] [文件]
With no arguments and no options, ls displays a list of all files in the current working directory:
不带参数和选项时,ls显示当前工作目录中所有文件的列表:
Examples: - List the names of the files in your current directory alphabetically
示例:- 按字母顺序列出当前目录中的文件名
Command
gourav@localhost:~$ lsgourav@localhost:~$ ls
Output
输出
cache db empty games lock log mail opt spool tmp
cache db empty games lock log mail opt spool tmp
Files are arranged in alphabetical order across as many columns as your terminal can accommodate. - To view all information about a files/directory
文件按字母顺序排列,跨越终端所能容纳的列数。- 查看文件/目录的所有信息
Command
gourav@localhost:~$ ls -lgourav@localhost:~$ ls -l
Output
输出
drwxr-xr-x 6 linuxer users 1824 Jun 9 16:46 sabon
drwxr-xr-x 6 linuxer users 1824 Jun 9 16:46 sabon
-rw------- 1 linuxer users 1064 Oct 28 14:35 music
-rw------- 1 linuxer users 1064 Oct 28 14:35 music
-rw------- 6 linuxer users 5119 Apr 28 16:00 splus2
-rw------- 6 linuxer users 5119 Apr 28 16:00 splus2
-rw-r--r-- 3 linuxer users 9853 Dec 27 11:14 ssh_known
-rw-r--r-- 3 linuxer users 9853 Dec 27 11:14 ssh_known
-rw-r--r-- 1 linuxer users 4231 Apr 21 15:23 swlist.out
-rw-r--r-- 1 linuxer users 4231 Apr 21 15:23 swlist.out
-rw-r--r-- 1 linuxer users 94031 Sep 14 16:07 tarnti.zip
-rw-r--r-- 1 linuxer users 94031 Sep 14 16:07 tarnti.zip
586. In Unix, how do you switch from one user account to another?
在Unix中,如何从一个用户账户切换到另一个?
- 知识点: 操作系统与网络 (主题: application-support;标签: interviewbit, application-support, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3793d58d557c902b99362 | 官方: 否 | 付费: 否
答案:
Switching between user accounts is accomplished by using the SU (Substitute User or Superuser) command. With the su command, you can execute functions or commands with another user's privileges or as a different user, by default the root user. When running su, you must enter the password of the user you want to switch to.
切换用户账户是通过使用SU(替换用户或超级用户)命令完成的。使用su命令,你可以以另一个用户的权限或作为另一个用户(默认是root用户)执行功能或命令。运行su时,你必须输入要切换到的用户的密码。
Syntax :
语法:
su [OPTIONS] [USER [ARGUMENT...]]
su [选项] [用户 [参数...]]
Without any options, su will run an interactive shell as a superuser (root).
不带任何选项时,su将作为超级用户(root)运行一个交互式shell。
Example:
示例:
gourav@localhost:~$ su madhu
gourav@localhost:~$ su madhu
Password: m1234
密码:m1234
madhu@localhost:~$
madhu@localhost:~$
Upon execution of su, it will ask for the password of the target user. If authenticated, it will grant access to the target user's account, as well as any files and directories the target user has access to.
执行su后,它会要求输入目标用户的密码。如果验证通过,它将授予访问目标用户账户及其有权限访问的所有文件和目录的权限。
587. Can you explain (.) and (..) in Unix?
你能解释Unix中的(.)和(..)吗?
- 知识点: 操作系统与网络 (主题: application-support;标签: interviewbit, application-support, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3793d58d557c902b99365 | 官方: 否 | 付费: 否
答案:
- Current directory (.): In Unix, (.) denotes the current directory. Using the command "cd ." (with a space between cd and dot), you will remain where you are.
- Parent directory (..): In Unix, (..) denotes the parent of the current directory. Using the command "cd.." or "cd .." (with a space), you move the directory back to one directory. This is also known as moving to the parent directory. For instance, if you're in the /home/gourav directory, using the "cd.." command takes you back to the home directory.
gourav@scaleracademy:~$ pwd
gourav@scaleracademy:~$ pwd
/home/gourav/local
/home/gourav/local
gourav@scaleracademy:~$ cd ..
gourav@scaleracademy:~$ cd ..
/home/gourav
/home/gourav
588. In Unix, can we delete multiple files at the same time? If yes, then how?
在Unix中,我们能否同时删除多个文件?如果可以,那怎么做?
- 知识点: 操作系统与网络 (主题: application-support;标签: interviewbit, application-support, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3793d58d557c902b99368 | 官方: 否 | 付费: 否
答案:
Yes, we can delete multiple files at once in Unix. The rm command (short for remove) is a command used in Unix and Unix-like systems to delete or remove files, directories, or symbolic links from file systems. Like other commands, rm has options that specify how it should behave. Some of the options are as follows: - rm -i: It asks for confirmation before deleting a file.
是的,我们可以在Unix中一次删除多个文件。rm命令(remove的缩写)是Unix及类Unix系统中用于从文件系统删除或移除文件、目录或符号链接的命令。与其他命令一样,rm有指定其行为方式的选项。其中一些选项如下:- rm -i:在删除文件前要求确认。
- rm -f: It ignores non-existing files and overrides any confirmation prompts.
rm -r: It removes or deletes directories along with their contents recursively.
Syntax (to delete multiple files at once):语法(一次删除多个文件):
$ rm filename1 filename2 filename3
589. Explain why Unix is important in an application support job.
解释为什么Unix在应用程序支持岗位中很重要。
- 知识点: 操作系统与网络 (主题: application-support;标签: interviewbit, application-support, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3793d58d557c902b9936b | 官方: 否 | 付费: 否
答案:
Among the most commonly used and most secure operating systems in application development and deployment is Unix. 90% of applications run on UNIX servers because of their security. It is simple, stable, has better scalability, supports multi-user and multi-tasking functionality, as well as being used in all forms of computing systems such as desktops, laptops, and servers. Therefore, having a good knowledge of Unix would be helpful.
在应用程序开发与部署中,Unix是最常用且最安全的操作系统之一。由于安全性高,90%的应用程序运行在UNIX服务器上。它简单、稳定、扩展性好,支持多用户和多任务功能,同时也应用于所有形式的计算系统,如台式机、笔记本电脑和服务器。因此,对Unix有良好的了解会很有帮助。
590. What are the different types of loop prevention mechanisms in BGP?
BGP中有哪些不同类型的环路预防机制?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b989 | 官方: 否 | 付费: 否
答案:
Following are the different ways of loop prevention mechanisms in BGP : - A router does not advertise the same routes to another iBGP peer when one iBGP peer specifies routes for it.
以下是BGP中环路预防机制的不同方式:- 当一个iBGP对等体为其指定路由时,路由器不会向另一个iBGP对等体通告相同的路由。
- When you use AS PATH, you can do the following: A BGP router adds its own ASN to the AS PATH when we advertise to an eBGP peer. When a BGP router receives an update and the route announcement includes an AS PATH with its ASN, the route is ignored.
591. What do you understand about TTL Security in the context of BGP? What is the need for TTL security in BGP?
在BGP的背景下,你如何理解TTL安全?BGP中为什么需要TTL安全?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b98c | 官方: 否 | 付费: 否
答案:
When constructing an eBGP neighborship through a Service Provider Network, there is a security risk of an attack from an unprotected Internet Service Provider domain to a secured client environment. A disadvantage of eBGP multihop is that a DOS attack can be carried out by spoofing legal packets towards a BGP router in large numbers.
当通过服务提供商网络建立eBGP邻居关系时,存在从不受保护的互联网服务提供商域向受保护的客户端环境发起攻击的安全风险。eBGP多跳的一个缺点是,攻击者可以通过向BGP路由器大量伪造合法数据包来实施拒绝服务攻击。
TTL-Security is a method we employ to secure our eBGP session from DOS attacks like this. Only eBGP sessions, not iBGP sessions, can employ the BGP TTL Security check. Only one of TTL Security and eBGP multihop can be enabled to generate directly linked or multihop peering sessions. A simple command can be used to configure the TTL-Security feature against an eBGP neighbour:
TTL安全是我们用来保护eBGP会话免受此类DoS攻击的一种方法。只有eBGP会话(而非iBGP会话)才能启用BGP TTL安全检查。TTL安全和eBGP多跳只能启用其中一种,以生成直连或多跳对等会话。可以使用一条简单的命令来针对eBGP邻居配置TTL安全功能:
neighbor TTL-security hops
neighbor TTL-security hops
By default, BGP sends packets with a TTL of 1 to external neighbours and accepts packets with a TTL of 0 or higher from external neighbours (as measured after the local router has decremented the TTL of the incoming packet).
默认情况下,BGP向外部邻居发送TTL为1的数据包,并接受来自外部邻居的TTL为0或更高值的数据包(在本地路由器递减入站数据包的TTL后测量)。
By requiring BGP to originate packets with a TTL of 255, the TTL-Security modifies the default behaviour of originating.
通过要求BGP以TTL为255发出数据包,TTL安全修改了默认的源发行为。
592. Differentiate between Enhanced Interior Gateway Routing Protocol (EIGRP) and Border Gateway Protocol (BGP).
区分增强型内部网关路由协议(EIGRP)和边界网关协议(BGP)。
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b98f | 官方: 否 | 付费: 否
答案:
Enhanced Interior Gateway Routing Protocol (EIGRP): If two routers in the same area exist, EIGRP is used to share information between them. It's also a complicated protocol, but it's simple to set up and use in both small and big networks. It's also a hybrid protocol, as it combines elements of both distance vector and link-state routing protocols.
增强型内部网关路由协议(EIGRP):如果同一区域中存在两台路由器,则使用EIGRP在它们之间共享信息。它也是一种复杂的协议,但在小型和大型网络中设置和使用都很简单。它也是一种混合协议,因为它结合了距离向量和链路状态路由协议的要素。
Following table lists the differences between Enhanced Interior Gateway Routing Protocol (EIGRP) and Border Gateway Protocol (BGP):
下表列出了增强型内部网关路由协议(EIGRP)和边界网关协议(BGP)之间的区别:
| Enhanced Interior Gateway Routing Protocol (EIGRP) 增强型内部网关路由协议(EIGRP) | Border Gateway Protocol (BGP) 边界网关协议(BGP) |
|---|---|
| In EIGRP, the Dual Distance Vector Algorithm is used. 在EIGRP中,使用双距离向量算法。 | It is based on the best-path algorithm. 它基于最佳路径算法。 |
| It is primarily used by large organisations. 它主要由大型组织使用。 | In comparison to EIGRP, it is mostly used for very large organisations. 与EIGRP相比,它主要用于非常大的组织。 |
| It is a hybrid type. 它是混合类型。 | It's a type of Vector State. 它是向量状态类型。 |
| It is a protocol for intelligent routing. 它是一种智能路由协议。 | It outperforms EIGRP in terms of routing intelligence. 它在路由智能方面优于EIGRP。 |
| It is a protocol for internal gateways. 它是一种内部网关协议。 | It is a protocol for connecting to an external gateway. 它是一种用于连接外部网关的协议。 |
| It has administrative distances of 90 (internal) and 170 (external). 其管理距离为90(内部)和170(外部)。 | Its administrative distances are 20 (internal) and 200 (external). 其管理距离为20(内部)和200(外部)。 |
593. Differentiate between Border Gateway Protocol (BGP) and Routing Information Protocol (RIP).
区分边界网关协议(BGP)和路由信息协议(RIP)。
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b992 | 官方: 否 | 付费: 否
答案:
Following are the differences between Border Gateway Protocol (BGP) and Routing Information Protocol (RIP) :
以下是边界网关协议(BGP)和路由信息协议(RIP)之间的区别:
| Border Gateway Protocol (BGP) 边界网关协议(BGP) | Routing Information Protocol (RIP) 路由信息协议(RIP) |
|---|---|
| It is based on the best-path algorithm. 它基于最佳路径算法。 | The Bellman Ford algorithm is used by Routing Information Protocol. 路由信息协议使用贝尔曼-福特算法。 |
| In comparison to RIP, it is mostly utilised for very large organisations 与RIP相比,它主要用于非常大的组织。 | It is primarily utilised by companies of a smaller size. 它主要由较小规模的公司使用。 |
| It's a protocol for connecting to an external gateway. 它是一种用于连接外部网关的协议。 | It is a dynamic routing protocol that is widely used in the business. 它是一种在业界广泛使用的动态路由协议。 |
| In BGP, the networks are divided into two categories: areas and tables. 在BGP中,网络分为两类:区域和表。 | In RIP, areas, subareas, autonomous systems, and backbone areas are the different types of networks. 在RIP中,网络类型包括区域、子区域、自治系统和骨干区域。 |
| The metric is calculated in terms of Hop Count. 度量以跳数计算。 | The metric is calculated in terms of Bandwidth. 度量以带宽计算。 |
| It is a hybrid type. 它是混合类型。 | It is a Vector State type. 它是向量状态类型。 |
| There is no such limit on the number of hops. 跳数没有限制。 | It allows for a total of 15 hops. 它允许总共15跳。 |
594. Explain the Path selection criteria used in BGP.
解释BGP中使用的路径选择标准。
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b995 | 官方: 否 | 付费: 否
答案:
BGP seeks to reduce the number of paths available to only one best path; it does not load balance by default. To do so, it looks at the following path properties of any loop-free, synchronised (if synchronisation is enabled) routes with an accessible next-hop: - Pick the route that has the most weight.
BGP旨在将可用路径减少到仅一条最佳路径;默认情况下它不进行负载均衡。为此,它会检查任何无环、同步(如果启用同步)且具有可达下一跳的路由的以下路径属性: - 选择权重最大的路由。
- Choose the route with the highest local preference if weight is not specified.
- Choose routes that began with this router.
- Choose the Autonomous System path that is the shortest.
- Select the path with the lowest origin code (lowest is I next is e, and last is?).
- If the same Autonomous System advertises the available routes, choose the path with the lowest MED.
- Opt for an EBGP route rather than an IBGP route.
- Choose the route that passes through the IGP neighbour with the lowest IGP metric.
- Pick the oldest route.
- Choose the path that passes through the neighbour with the smallest router ID.
- Select the path that passes through the neighbour with the smallest IP address.
595. What do you mean by BGP Message Types? Explain the different Message Types in BGP in detail.
你所说的BGP消息类型是什么意思?详细解释BGP中的不同消息类型。
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b998 | 官方: 否 | 付费: 否
答案:
The BGP Message types are used to create a neighbour relationship and exchange parameters such as the autonomous system number and authentication values. A BGP message is made up of two parts: a BGP header and data. The header format is the same in all of the BGP messages. TCP is used to transmit BGP messages (port 179). The length of the message ranges from 19 to 4096 octets. Each BGP message's header is 19 octets long and consists of three fields.
BGP消息类型用于建立邻居关系并交换参数,如自治系统号和认证值。BGP消息由两部分组成:BGP头和数据。所有BGP消息中的头格式相同。TCP用于传输BGP消息(端口179)。消息长度范围从19到4096个八位字节。每条BGP消息的头长19个八位字节,由三个字段组成。
The types of BGP messages are listed below: - Open : A BGP adjacency is established using the OPEN message. Before a BGP peering is established, both parties negotiate session capabilities. The BGP version number, ASN of the originating router, Hold Time, BGP Identifier, and other optional characteristics that define the session capabilities are all included in the OPEN message.
BGP消息类型如下所列: - Open:使用OPEN消息建立BGP邻接关系。在建立BGP对等关系之前,双方协商会话能力。BGP版本号、发起路由器的ASN、保持时间、BGP标识符以及定义会话能力的其他可选特性都包含在OPEN消息中。
- Keepalive : To ensure that the neighbours are still alive, BGP does not rely on the TCP connection status. Every one-third of the Hold Timer agreed upon between the two BGP routers, keepalive messages are exchanged. Generally, the default Hold Time for devices is 180 seconds, so the default Keepalive interval is 60 seconds. No Keepalive messages are delivered between BGP neighbours if the Hold Time is set to zero.
- Update : The Update message can either advertise or remove previously advertised routes, or it can do both. When advertising prefixes, the Update message includes the Network Layer Reachability Information (NLRI), which includes the prefix and related BGP PAs. Only the prefix is included in NLRIs that have been withdrawn. To save needless bandwidth, a UPDATE message can be used as a Keepalive.
- Notification : When a BGP session error is discovered, such as a hold timer expiring, neighbour capabilities changing, or a BGP session reset is requested, a Notification message is sent. The BGP connection is closed as a result of this.
596. Explain the various types of communities used in BGP.
解释BGP中使用的各种社区类型。
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b99b | 官方: 否 | 付费: 否
答案:
Following are the various types of communities used in BGP: - No-Advertise Community
以下是BGP中使用的各种社区类型: - 不广告社区(No-Advertise Community)
When a route is associated with a No-Advertise community, the BGP speaker will not advertise the route to any internal or external BGP peers.
当路由与不广告社区关联时,BGP发言者不会向任何内部或外部BGP对等方广告该路由。
R1 does not advertise a No-Advertise Route (10.10.10.0/24) to peers R11, R12, and R111 in the following example.
在以下示例中,R1不向对等方R11、R12和R111广告不广告路由(10.10.10.0/24)。
- Community with No Exports
When a No-Export community is associated with a route, the router will only advertise the route to internal peers.
当路由关联了 No-Export 团体属性时,路由器只会向内部对等体通告该路由。
R1, R11, and R12 are not advertising a No-Export Route (10.10.10.0/24) to their external peer, R111, as seen in the following example.
如下例所示,R1、R11 和 R12 不会将 No-Export 路由(10.10.10.0/24)通告给它们的外部对等体 R111。
R1 will not advertise the route to R111 in this situation, just to R11 and R12, because they are internal BGP peers. As a result, because R111 is an external BGP peer, R11 and R12 will not advertise either route to it. - Local AS Community
在这种情况下,R1 只向 R11 和 R12 通告该路由,而不向 R111 通告,因为 R11 和 R12 是内部 BGP 对等体。因此,由于 R111 是外部 BGP 对等体,R11 和 R12 也不会向其通告任何路由。- 本地 AS 团体
There is an important regulation about internal BGP neighbours to avoid BGP routing loops: an IBGP neighbour cannot advertise a route to another IBGP neighbour if it obtained that route from another IBGP neighbour.
有一个关于内部 BGP 邻居的重要规定,以避免 BGP 路由环路:如果一个 IBGP 邻居从另一个 IBGP 邻居获得路由,则它不能将该路由通告给另一个 IBGP 邻居。
A Local AS Route (10.10.10.0/24) is not promoted between IBGP neighbours (R11 and R111) within the local AS in the following example.
在以下示例中,本地 AS 路由(10.10.10.0/24)不会在本地 AS 内的 IBGP 邻居(R11 和 R111)之间传播。
According to the criteria indicated above, R11 advertises the route to R22, but R22 does not advertise the path to R111. There are several options for getting the route to R111, including constructing a full mesh of IBGP sessions between AS11 routers or dividing the AS 11 into a sub-AS within a confederation.
根据上述标准,R11 将路由通告给 R22,但 R22 不会将路径通告给 R111。有几种方法可以将路由传递给 R111,包括在 AS11 路由器之间构建 IBGP 会话的全互连,或将 AS 11 划分为联盟内的子 AS。
Outside of AS11, no one knows what AS 1000 and AS1001 are. R111 can now receive the 10.10.10.0/24 route even if it does not have full mesh BGP peering. Outside of the sub-AS, the Local-AS community does not advertise routes.
在 AS11 外部,没有人知道 AS 1000 和 AS1001 是什么。即使没有全互连的 BGP 对等关系,R111 现在也能接收到 10.10.10.0/24 路由。在子 AS 外部,Local-AS 团体不会通告路由。
- Graceful Shutdown Community
When a router's peer router is about to be purposely shut down, the Graceful SHUTDOWN (65535:0) community is used to seamlessly shut down paths it could use. Consider the following scenario: R111 is utilising R11 to access the 10.10.10.0/24 network, but R11 will be rebooted to be upgraded:
当路由器的对端路由器即将被有意关闭时,Graceful SHUTDOWN(65535:0)团体用于无缝关闭它可能使用的路径。考虑以下场景:R111 正在利用 R11 访问 10.10.10.0/24 网络,但 R11 将被重启以进行升级:
R111 replies by transferring traffic to R12 with minimum disruption when R11 announces this community:
当 R11 宣布此团体时,R111 通过将流量转移到 R12 来响应,以此实现最小中断:
- Extended Community
An Extended community is an 8-byte value that is split into two parts:
扩展团体是一个 8 字节值,被分为两部分:
- The first two bytes indicate the sort of community.
- The last six bytes provide information that is specific to the type of community.
There are three fields in an extended community: kind, administrator, and assigned number (type:administrator:assigned-number). The administrator field can be an AS or an IP address, depending on the value of the high-order byte in the Type field. MPLS-VPN is the most well-known use for extended communities, as it uses two extended communities:
扩展团体中有三个字段:类型、管理者和分配编号(类型:管理者:分配编号)。管理者字段可以是 AS 或 IP 地址,具体取决于类型字段中高阶字节的值。MPLS-VPN 是扩展团体最著名的应用,因为它使用两种扩展团体:
- Route Target community: Determines which routers are capable of receiving a given set of routes.
- Route Origin community: This group of routers is responsible for injecting a specified set of routes into BGP.
A Virtual Routing and Forwarding (VRF) table is a virtual routing table that can have its own routing policies that are independent of the global routing table or other VRFs. Essentially, you can connect numerous client sites and create a distinct routing table (VRF) throughout the entire network exclusively for this customer, with routing policies that differ from those of other customers.
虚拟路由和转发(VRF)表是一种虚拟路由表,它可以拥有独立于全局路由表或其他 VRF 的自己的路由策略。本质上,您可以连接多个客户站点,并在整个网络中仅为该客户创建独特的路由表(VRF),且其路由策略与其他客户不同。
- Route Target Community
In MPLS VPN setups, the Route Target community is used to segregate two customers' routing tables, as depicted in the diagram below:
在 MPLS VPN 设置中,Route Target 团体用于隔离两个客户的路由表,如下方图表所示:
VRF Customer RED is only present on R1 and R12, and VRF Customer BLUE is only present on R11 and R22 in this scenario, but they may have been present on all four routers.
在此场景中,VRF 客户 RED 只存在于 R1 和 R12 上,VRF 客户 BLUE 只存在于 R11 和 R22 上,但它们可能存在于所有四台路由器上。
When a route is exported from VRF Red using BGP, the route-target 100:100 is assigned to the route. When the route reaches R12, the route from R1 is imported, allowing the sites connected to R1 and R12 to communicate. - Route Origin Community
当使用 BGP 从 VRF Red 导出路由时,会将 route-target 100:100 分配给该路由。当路由到达 R12 时,来自 R1 的路由会被导入,从而使连接到 R1 和 R12 的站点能够通信。- Route Origin 团体
The route origin community is used in an MPLS VPN environment to identify where routes originated from so that readvertisement back to that site is avoided.
Route origin 团体用于 MPLS VPN 环境中,以识别路由的来源,从而避免将路由重新通告回该站点。
When PE1 receives the route from CE1, it attaches the route origin community in addition to the route-target that is linked to the route (through export).
当PE1从CE1接收到路由时,它会在与路由关联的(通过导出)路由目标之外,附加路由来源社区。
The route reaches PE2, but PE2 does not inform CE2 because it is aware that it originated at the location.
该路由到达PE2,但PE2不会通知CE2,因为它知道该路由起源于其所在位置。
597. What do you understand about communities in the context of BGP?
你如何理解BGP上下文中的社区(communities)?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b99e | 官方: 否 | 付费: 否
答案:
A BGP community is a transitive, optional BGP property that is recognised and sent between BGP peers. A BGP community is a tag that is appended to the BGP routes that are exchanged between two BGP peers. A community is a 32-bit number that is divided into two 16-bit sections. The first 16 bits indicate the community's AS number, while the following 16 bits represent a unique number assigned by the AS. Because each AS number is distinct, each community on the internet is similarly distinct. This means that an AS with the ASN 9999 (or 0x270F in hex) can have communities ranging from 0x270F0000 to 0x270FFFFF.
BGP社区是一种可传递的、可选的BGP属性,可在BGP对等体之间识别和发送。BGP社区是附加在交换于两个BGP对等体之间的BGP路由上的标签。社区是一个32位数字,分为两个16位部分。前16位表示社区的AS号,后16位表示由该AS分配的唯一数字。由于每个AS号是唯一的,互联网上的每个社区同样也是唯一的。这意味着一个ASN为9999(或十六进制0x270F)的AS可以拥有从0x270F0000到0x270FFFFF的社区。
598. What do the various BGP Path Attributes mean?
各种BGP路径属性意味着什么?
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b9a1 | 官方: 否 | 付费: 否
答案:
BGP offers a variety of Path Attributes, which are used to compare competing BGP pathways (routes) in the BGP table to identify the best possible path (route).
BGP提供了多种路径属性,用于比较BGP表中的竞争BGP路径(路由),以确定最佳可能路径(路由)。
The following are some BGP Path Attributes: - Next Hop: The Next Hop Path Attributes are used to list the IP address of the prefix's next hop. It determines whether the Next Hop is achievable. The router does not use this route if no other route can reach Next Hop.
以下是一些BGP路径属性:- 下一跳:下一跳路径属性用于列出前缀的下一跳IP地址。它确定下一跳是否可达。如果没有其他路由可以到达下一跳,路由器将不使用此路由。
- Weight: When you receive updates from a router, the weight Path Attributes is a numeric value provided by the router to impact the route for a prefix. It is not publicised among BGP peers, and a heavier weight is preferred.
- Local Preference: Local Preference is a numeric value set as well. It is conveyed within a single autonomous system in order for all routers in that autonomous system to determine the optimum route to a certain network. The higher the value, the better.
- Routes injected locally: The routes injected with the network command are known as locally injected routes. These are preferable to iBGP/eBGP.
- Multi-Exit Discriminator: The Multi-Exit Discriminator (MED) allows one autonomous system to inform a neighbouring autonomous system about the optimum path to take for packet forwarding. The smaller the better.
- AS Path: The number of ASNs (Autonomous System Number) in the AS Path is specified by the AS Path. The smaller the better.
599. Differentiate between hard reset and soft reset in the context of BGP.
在BGP上下文中,区分硬重置和软重置。
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b9a4 | 官方: 否 | 付费: 否
答案:
Following are the differences between hard reset and soft reset in the context of BGP:
以下是BGP上下文中硬重置和软重置的区别:
| Basis 基础 | Hard Reset 硬重置 | Soft Reset 软重置 |
|---|---|---|
| Goal 目标 | The TCP session with the BGP neighbour is killed by Hard Reset, and it must be restarted. It terminates the TCP connection between the peers, re-establishes the connection with a BGP open message, and resumes normal peer-to-peer message exchanges. 硬重置会终止与BGP邻居的TCP会话,并且必须重新启动。它终止对等体之间的TCP连接,通过BGP打开消息重新建立连接,并恢复正常的对等体间消息交换。 | There are two types of soft resets: - Soft reset with Route refresh: A soft reset with Route refresh allows BGP peers to seek an update without destroying the neighbour relationship. 有两种类型的软重置:- 带路由刷新的软重置:带路由刷新的软重置允许BGP对等体请求更新,而不会破坏邻居关系。 |
Soft-reconfiguration: Because the route-refresh request is not issued to the BGP neighbour, soft-reconfiguration stores a copy of BGP routes sent in the BGP update from our peer. |
Direction
方向The direction of connection in hard reset can be both in and out.
硬重置中的连接方向可以是入站和出站。The direction of connection in soft reset is either in or out.
软重置中的连接方向是入站或出站。Utilization of memory
内存使用It does not necessitate any additional RAM to store another table.
它不需要额外的RAM来存储另一张表。It necessitates more RAM because the router now stores two BGP tables for each neighbour instead of one.
它需要更多RAM,因为路由器现在存储每个邻居的BGP表不是一张,而是两张。Impact
影响The hard reset has the potential to drastically impair network connectivity
硬重置可能严重影响网络连接Only those prefixes affected by the policy change will be affected by the soft reset.
只有受策略更改影响的前缀才会受到软重置的影响。Use Case
用例When a soft reset fails to resolve the problem, a hard reset should be utilised as a final resort.
当软重置无法解决问题时,应将硬重置用作最后手段。The soft technique is the most popular and widely employed.
软技术是最流行且广泛采用的。Prerequisite
前提条件There are no requirements for this activity.
此活动没有要求。In soft reset with the Route refresh functionality, both peers may be required to provide the Route Refresh capability.
在带路由刷新功能的软重置中,两个对等体都可能需要提供路由刷新能力。Rate Of Convergence
收敛速度Because processing the entire table takes a lengthy time, it necessitates an extremely long convergence time.
由于处理整个表需要很长时间,因此需要极长的收敛时间。Its convergence time is significantly less than that of a hard reset.
其收敛时间远小于硬重置。Commands Used
使用的命令clear ip bgp {* neighbor ip peer-group} clear ip bgp {neighbor ip} soft out clear ip bgp {neighbor ip} soft in
clear ip bgp {neighbor ip} soft out / clear ip bgp {neighbor ip} soft in
600. Differentiate between Open Shortest Path First (OSPF) and Border Gateway Protocol (BGP).
区分开放式最短路径优先(OSPF)和边界网关协议(BGP)。
- 知识点: 操作系统与网络 (主题: bgp, networking;标签: interviewbit, bgp, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b3796c58d557c902b9b9a7 | 官方: 否 | 付费: 否
答案:
Open Shortest Path First (OSPF): Open shortest path first (OSPF) is a link-state routing protocol that uses its own shortest path first (SPF) algorithm to discover the optimum path between the source and destination router. A link-state routing protocol employs the idea of triggered updates, in which updates are only triggered when a change in the learnt routing table is detected, as opposed to the distance-vector routing protocol, in which the routing table is exchanged over a period of time. Open shortest path first (OSPF) is an Interior Gateway Protocol (IGP) that tries to move packets within a large autonomous system or routing domain. It's a network layer protocol that uses AD value 110 and runs on protocol number 89. OSPF employs the multicast address 224.0.0.5 for routine communication and 224.0.0.6 for updates to designated routers (DRs) and backup designated routers (BDRs) (BDR).
开放式最短路径优先(OSPF):开放式最短路径优先(OSPF)是一种链路状态路由协议,它使用自己的最短路径优先(SPF)算法来发现源路由器和目标路由器之间的最佳路径。链路状态路由协议采用触发更新的概念,仅在检测到所学路由表发生变化时才触发更新,这与距离向量路由协议定期交换路由表不同。开放式最短路径优先(OSPF)是一种内部网关协议(IGP),旨在大型自治系统或路由域内移动数据包。它是一种网络层协议,使用AD值110,运行在协议号89上。OSPF使用多播地址224.0.0.5进行常规通信,并使用224.0.0.6向指定路由器(DR)和备份指定路由器(BDR)发送更新。
Following are the differences between Border Gateway Protocol (BGP) and Open Shortest Path First (OSPF):
以下是边界网关协议(BGP)和开放式最短路径优先(OSPF)之间的区别:
| Open Shortest Path First (OSPF) 开放式最短路径优先(OSPF) | Border Gateway Protocol (BGP) 边界网关协议(BGP) |
|---|---|
| Open Shortest Path First is a fast concurrency protocol. 开放式最短路径优先是一种快速收敛协议。 | BGP is a slow concurrency protocol. BGP是一种慢速收敛协议。 |
| OSPF is a network topology or design that is hierarchical. OSPF是分层网络拓扑或设计。 | It uses a sort of mesh topology or design. 它使用某种网状拓扑或设计。 |
| Internal gateway protocol is another name for it. 它也被称为内部网关协议。 | It is referred to as an external gateway protocol. 它被称为外部网关协议。 |
| OSPF is a simple protocol to set up. OSPF是一种简单的协议设置。 | BGP implementation is challenging. BGP实施具有挑战性。 |
| It connects to port 89. 它连接到端口89。 | It works with port number 179. 它使用端口号179。 |
| The internet protocol is employed in OSPF. OSPF中使用的是互联网协议。 | Transmission control protocol is employed in this. 这里使用的是传输控制协议。 |
| OSPF is a type of Link State. OSPF是一种链路状态类型。 | BGP is a Vector State type. BGP是一种向量状态类型。 |
| The Dijkstra algorithm is employed in OSPF. OSPF采用Dijkstra算法。 | The best path algorithm is employed in this case. 这里采用最佳路径算法。 |
| OSPF prioritises the quickest path over the shortest path. OSPF优先考虑最快路径而不是最短路径。 | BGP prefers the best path. BGP更喜欢最佳路径。 |
601. What do you mean by route poisoning?
路由中毒是什么意思?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b29 | 官方: 否 | 付费: 否
答案:
Route poisoning refers to a method that prevents certain networks from sending data packets to path destinations that have already become invalid. This method is being employed by distance vector routing protocols like RIPv2 whenever they see any invalid route to prevent routing loops. It is generally used to overcome large routing loops and informs all the connected routers in a network about the path that is invalid by saying that it has a hop count that exceeds the maximum allowable.
路由中毒指的是一种方法,用于防止某些网络向已失效的路径目的地发送数据包。此方法被距离向量路由协议(如RIPv2)在遇到任何无效路由时使用,以防止路由环路。它通常用于克服大型路由环路,并通过表示路径的跳数超过最大允许值,通知网络中所有相连路由器关于该无效路径的信息。
602. What do you mean by EIGRP? Mention some metrics of EIGRP Protocol.
EIGRP是什么意思?提及EIGRP协议的一些度量指标。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b2c | 官方: 否 | 付费: 否
答案:
EIGRP (Enhanced Interior Gateway Routing Protocol) is referred to as Cisco's IGP (Interior Gateway Protocol) that is used on a computer network especially for automating routing decisions and configurations. This protocol is suited for different topologies and media. It is mostly used on a router to share routes with other routers within the same autonomous system. EIGRP Protocol generally includes the following metrics: - Bandwidth
EIGRP(增强内部网关路由协议)被称为Cisco的IGP(内部网关协议),用于计算机网络,特别是在自动进行路由决策和配置方面。该协议适用于不同的拓扑和介质。它主要用于路由器上,在同一自治系统内与其他路由器共享路由。EIGRP协议通常包括以下度量指标:- 带宽
- Load
- Delay
- Reliability
- MTU
- Maximum Transmission Unit
603. What is CDP? Write its functions.
什么是CDP?写出它的功能。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: coding
- 分类: fullstack
- id: 69b37a1058d557c902ba2b2f | 官方: 否 | 付费: 否
答案:
CDP (Cisco Discovery Protocol) is a Layer 2, media-independent, and network-independent protocol that runs on all the Cisco devices that helps us to discover Cisco devices on the network. This protocol works on the basis of MAC address. It also facilitates the management of Cisco devices by discovering these devices, identifying how to configure them, and allowing systems to learn about each other using different network-layer protocols. Some of its functions include: - Collects information about directly connected neighboring devices.
CDP(思科发现协议)是一种第2层、媒体无关且网络无关的协议,运行在所有思科设备上,帮助我们在网络中发现了思科设备。该协议基于MAC地址工作。它还通过发现设备、识别如何配置设备以及允许系统使用不同网络层协议相互了解,来促进思科设备的管理。其一些功能包括:- 收集直连相邻设备的信息。
- Find adjacent Cisco devices.
- Find out port numbers, IP addresses, router models, switch models, interface details, iOS details, device ID-hostname.
- Simplifies the process of keeping an up-to-date inventory of Cisco network devices.
- Share information about other directly connected Cisco equipment like OS version, IP addresses.
604. What do you mean by VLAN? Write its main objective.
你所说的VLAN是什么意思?写出其主要目标。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b32 | 官方: 否 | 付费: 否
答案:
VLAN (Virtual Local Area Network) is basically a logical group of workstations, services, or network devices that communicate with one another on a separate physical LAN. It improves the network performance or applies some additional security features. It also allows several networks to work virtually as if they were a LAN sharing a single broadcast domain.
VLAN(虚拟局域网)基本上是一组工作站、服务或网络设备的逻辑分组,它们在独立的物理LAN上相互通信。它提高了网络性能或应用了一些额外的安全功能。它还允许多个网络在虚拟环境中像共享单一广播域的LAN一样工作。
605. What are the benefits of using VLAN?
使用VLAN有哪些好处?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b35 | 官方: 否 | 付费: 否
答案:
There are several advantages of using VLAN: - Removes latency and traffic load on the network
使用VLAN有多个优点:- 消除了网络上的延迟和流量负载
- Saves network resources and increases network efficiency
- Reduces IT cost and the incidence of collisions
- Improve network security and performance
- Ensure network flexibility and provide easier management
- Make it easier to relocate a network or a network device
- Increase the number of broadcast domains while decreasing the size of broadcast domains.
- Establish broadcast domains in switched networks.
606. What do you mean by a broadcast domain and a collision domain?
你所说的广播域和冲突域是什么意思?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b38 | 官方: 否 | 付费: 否
答案:
Broadcast Domain: As the name suggests, a Broadcast domain is a logical set of reachable computer systems without having a router. In this type of domain, traffic flows all over the network. In this scenario, when a device sends a broadcast message, then all the other devices present in its broadcast domain have to pay attention to it. Collision Domain: As the name suggests, a Collision domain is a part of a network where packet collisions can take place when being sent on a shared medium or through repeaters. In this scenario, when a device sends a message to a network, then all other devices present in its collision domain have to pay attention to it, whether or not it was destined for them.
广播域:顾名思义,广播域是一组无需路由器即可访问的计算机系统的逻辑集合。在这种类型的域中,流量在整个网络中流动。在这种情况下,当设备发送广播消息时,其广播域中的所有其他设备都必须关注该消息。冲突域:顾名思义,冲突域是网络的一部分,当数据包在共享介质或通过中继器发送时,可能会发生数据包冲突。在这种情况下,当设备向网络发送消息时,其冲突域中的所有其他设备都必须关注该消息,无论该消息是否发往它们。
607. Explain BootP.
解释BootP。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b3b | 官方: 否 | 付费: 否
答案:
BootP (Bootstrap Protocol or Boot Program) is defined as a computer networking protocol that is being used by a client for obtaining an IP address of a server PC. In a network, BootP is generally used for booting diskless workstations. These diskless workstations use BootP to get their own IP address as well as the server’s IP address. It was originally designed to replace RARP (Reverse Address Resolution Protocol), also known as RFC 903.
BootP(引导协议或启动程序)被定义为一种计算机网络协议,客户端使用它来获取服务器PC的IP地址。在网络中,BootP通常用于引导无盘工作站。这些无盘工作站使用BootP来获取自己的IP地址以及服务器的IP地址。它最初被设计为替代RARP(反向地址解析协议),也称为RFC 903。
608. Write difference between static and dynamic IP addressing.
写出静态和动态IP寻址的区别。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b3e | 官方: 否 | 付费: 否
答案:
Static IP address: Static IP address, as the name suggests, is simply an IP address that doesn’t change. It remains the same until the device is decommissioned or the network architecture is changed.
静态IP地址:静态IP地址,顾名思义,就是一个不会变化的IP地址。它保持不变,直到设备退役或网络架构改变。
Dynamic IP address: Dynamic IP address, as the name suggests, is simply an IP address that changes over time. It is mostly used because IPv4 does not provide enough static IP addresses to go around.
动态IP地址:动态IP地址,顾名思义,就是一个随时间变化的IP地址。它被广泛使用,因为IPv4没有提供足够的静态IP地址供使用。
Static vs Dynamic IP address:
静态与动态IP地址:
| Static IP address 静态IP地址 | Dynamic IP address 动态IP地址 |
|---|---|
| This IP address is generally provided by ISP (Internet Service Provider). 该IP地址通常由ISP(互联网服务提供商)提供。 | This IP address is generally provided by DHCP (Dynamic Host Configuration Protocol). 该IP地址通常由DHCP(动态主机配置协议)提供。 |
| The address does not change whenever a device is assigned a static IP address by the network administrator. 当网络管理员为设备分配静态IP地址时,该地址不会变化。 | The address changes over time whenever a device is assigned a dynamic IP address. 当设备被分配动态IP地址时,该地址随时间变化。 |
| It is less secure and more difficult to designate as compared to dynamic IP addresses. 与动态IP地址相比,它安全性较低且更难指定。 | It is more secure and easy to designate as compared to static IP addresses. 与静态IP地址相比,它更安全且易于指定。 |
| It is more appropriate for a business. 它更适合企业使用。 | It is more appropriate for a home network. 它更适合家庭网络使用。 |
| These are costlier to deploy and more difficult to manage as compared to dynamic IP addresses. 与动态IP地址相比,部署成本更高且管理更困难。 | These are cheaper to deploy and easier to manage as compared to static IP addresses. 与静态IP地址相比,部署成本更低且管理更容易。 |
| It is more suitable for dedicated services like mail, VPN and FTP servers, etc. 它更适合邮件、VPN和FTP服务器等专用服务。 | It is more suitable for a large network that requires internet access to all devices. 它更适合需要所有设备访问互联网的大型网络。 |
| It is mostly used where computational data is less confidential. 它主要用于计算数据保密性较低的情况。 | It is mostly used where data is more confidential and requires higher security. 它主要用于数据更机密且需要更高安全性的情况。 |
609. What is network congestion? When network congestion happens?
什么是网络拥塞?网络拥塞何时发生?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b41 | 官方: 否 | 付费: 否
答案:
Network congestion is a situation that occurs when a network node is overloaded with data or traffic and can cause a common problem for admins. It usually occurs when the network is carrying or exchanging more data than the network devices like routers and switches can accommodate. It is a result of an internet route becoming too full when many users try using the same bandwidth. This condition is true in big networks that do not resort to network segmentation.
网络拥塞是指网络节点因数据或流量过载而发生的一种情况,可能给管理员带来常见问题。它通常发生在网络承载或交换的数据量超过路由器、交换机等网络设备所能容纳时。当许多用户试图使用同一带宽,导致互联网路由变得过于拥挤时,就会出现这种状况。这种情况在未采用网络分段的大型网络中尤为常见。
610. What are two types of networks in CCNA?
CCNA中的两种网络类型是什么?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b44 | 官方: 否 | 付费: 否
答案:
Two types of networks in CCNA includes: Server-based network : Client-Server networks can also be referred to as Server-Based networks. A server is a node that provides services to clients. In this, a Centralized server is used to store the data because its management is centralized. Peer-to-Peer network : A peer-to-peer network is also known as a computer-to-computer network or P2P. Peers are nodes or computer systems that are connected to one another. Every node in this kind of network is connected to another node.
CCNA中的两种网络类型包括:基于服务器的网络:客户端-服务器网络也可以称为基于服务器的网络。服务器是为客户端提供服务的节点。在此模式中,使用集中式服务器存储数据,因为其管理是集中化的。对等网络:对等网络也称为计算机到计算机网络或P2P。对等节点是相互连接的节点或计算机系统。在此类网络中,每个节点都连接到另一个节点。
611. What are types of passwords that can be used in CISCO routers?
CISCO路由器中可以使用哪些类型的密码?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b47 | 官方: 否 | 付费: 否
答案:
Different types of passwords that can be used in CISCO routers include: - Enabled: This is a global command that disables privileged execution mode. The password is not encrypted. To change it, one can use "enable password password"
CISCO路由器中可使用的不同类型的密码包括:- 启用密码:这是一个全局命令,用于禁用特权执行模式。该密码未加密。要更改它,可以使用“enable password password”。
- Enable Secret: In place of an enable password, this secret password is used. To change it, one can use "enable secret password".
- AUX (Auxiliary): Passwords for auxiliary ports can be set using an auxiliary password. Through a modem, a router can be accessed via this port.
- Console: Console port passwords are set using the console password.
- VTY (Virtual Terminal): For Telnet sessions into the router, you will need the virtual terminal password. Passwords can be changed at any time. You can set it up when you configure the router from the console.
612. Write difference between public IP and private IP.
写出公共IP和私有IP之间的区别。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b4a | 官方: 否 | 付费: 否
答案:
| Public IP 公共IP | Private IP 私有IP |
|---|---|
| It is used on public networks. 用于公共网络中。 | It is mostly used within a private network or LAN to connect securely with other devices within the same network. 主要用于私有网络或局域网内,以安全地连接同一网络中的其他设备。 |
| It is usually assigned by a Service provider or IANA. 通常由服务提供商或IANA分配。 | It is usually assigned by a LAN administrator. 通常由局域网管理员分配。 |
| It is generally used to communicate outside the network. 通常用于网络外部通信。 | It is generally used to communicate within the same network. 通常用于同一网络内部通信。 |
| It can be known by searching “what is my IP” on google. 可通过在谷歌上搜索“what is my IP”得知。 | It can be known by typing “ipconfig” on the command prompt. 可通过在命令提示符中输入“ipconfig”得知。 |
| Its scope is global. 其范围是全球性的。 | Its scope is local to the present network. 其范围局限于当前网络。 |
| These come with a cost and are controlled by ISP. 有成本且由ISP控制。 | These are free of cost and are used to load network OS. 免费使用,用于加载网络操作系统。 |
| It is routable and therefore, communication among different users is possible. 可路由,因此不同用户之间可以进行通信。 | It is not routable and therefore, communication among different users is not possible. 不可路由,因此不同用户之间无法进行通信。 |
| It can be any number not included in the reserved private IP address range.Example: 202.60.23.1 可以是任何不在保留私有IP地址范围内的数字。示例:202.60.23.1 | Address ranges to be used by private networks are: Class A: 10.0.0.0 - 10.255.255.255Class B: 172.16.0.0 - 172.31.255.255Class C: 192.168.0.0 - 192.168.255.255Example: 192.168.0.3 私有网络使用的地址范围包括:A类:10.0.0.0 - 10.255.255.255;B类:172.16.0.0 - 172.31.255.255;C类:192.168.0.0 - 192.168.255.255。示例:192.168.0.3 |
613. Write the main function of the application layer in networking?
写出网络应用中应用层的主要功能是什么?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: coding
- 分类: fullstack
- id: 69b37a1058d557c902ba2b4d | 官方: 否 | 付费: 否
答案:
The application layer is the topmost layer in the OSI model that is used by end-user software such as web browsers and email clients. It is considered as the layer through which users interact. It usually consists of some protocols that are more focused on process-to-process communication across an IP Network. Some of its functions include: - Manage data exchange in a peer-to-peer or a client-server networking model.
应用层是OSI模型中的最顶层,由终端用户软件(如Web浏览器和电子邮件客户端)使用。它被认为是用户交互的层。它通常包含一些更侧重于IP网络间进程到进程通信的协议。其一些功能包括:- 管理对等或客户端-服务器网络模型中的数据交换。
- Provide firm communication interface and end-user services.
- Enables users to access the network.
- Provide the basis for email forwarding and storage facilities.
- Allows access to global information about different services.
614. Explain PoE.
解释PoE。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b50 | 官方: 否 | 付费: 否
答案:
PoE (Power on Ethernet) generally refers to a technology that allows electric power to be carried over the Ethernet cable that carries data. It passes the electric power supply to the network through the cable rather than the power cords and minimizes the number of wires required to install the network.
PoE(以太网供电)通常指一种允许通过承载数据的以太网电缆传输电力的技术。它通过电缆而非电源线将电力供应传递给网络,从而减少安装网络所需的电线数量。
615. What do you mean by OSPF?
OSPF是什么意思?
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b53 | 官方: 否 | 付费: 否
答案:
OSPF (Open Shortest Path First) is basically a popular link-state routing protocol for IP networks that are used to connect to a large number of networks without any limitation on the number of hops. It determines the best route for delivering the data packets within an IP network. It has been implemented by a wide range of network vendors such as Cisco. It works on Dijkstra Algorithm. - Firstly, a shortest-path tree is constructed.
OSPF(开放最短路径优先)本质上是一种流行的IP网络链路状态路由协议,用于连接大量网络而不受跳数限制。它确定在IP网络内传递数据包的最佳路径。它已被包括Cisco在内的众多网络供应商实现。它基于Dijkstra算法工作。- 首先,构建最短路径树。
- Secondly, the routing table is populated with the resulting best paths.
616. Write difference between RIP and IGRP.
写出RIP和IGRP之间的区别。
- 知识点: 操作系统与网络 (主题: ccna, networking;标签: interviewbit, ccna, topic-specific, networking)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37a1058d557c902ba2b56 | 官方: 否 | 付费: 否
答案:
| RIP (Routing Information Protocol) RIP(路由信息协议) | IGRP (Interior Gateway Routing Protocol) IGRP(内部网关路由协议) |
|---|---|
| It is a distance vector-based routing protocol. 它是一种基于距离向量的路由协议。 | It is a distance vector-based interior gateway routing protocol. 它是一种基于距离向量的内部网关路由协议。 |
| It is used to calculate the metric in terms of Hop count. 用于以跳数计算度量值。 | It is used to calculate the metric in terms of bandwidth, load, and delay. 用于以带宽、负载和延迟计算度量值。 |
| It is an industry-standard dynamic protocol and is mainly used for smaller-sized organizations. 它是一种行业标准的动态协议,主要用于较小规模的组织。 | It is a Cisco standard dynamic protocol and is mainly used for medium to large-sized organizations. 它是一种Cisco标准的动态协议,主要用于中到大规模的组织。 |
| It is denoted by ‘R’ in the routing table and supports 15 routers max. 在路由表中用“R”表示,最多支持15台路由器。 | It is denoted by ‘I’ in the routing tables and supports 255 routers max. 在路由表中用“I”表示,最多支持255台路由器。 |
| We cannot create a separate administrative boundary in the network in the RIP routing protocol. 在RIP路由协议中,我们无法在网络中创建单独的管理边界。 | Using autonomous System numbers, we can create a separate administrative boundary in the network in the IGRP routing protocol. 使用自治系统编号,我们可以在IGRP路由协议中创建单独的管理边界。 |
Conclusion:
结论:
CCNA is a stepping stone for getting quality jobs and career growth. It helps to get into the networking domain, especially if one wants to work with CISCO products. Before you start your career as a professional CCNA expert, you will definitely get help from these CCNA interview questions and answers. It enhances your knowledge to a great level and helps you crack a CCNA interview successfully at a fresher and experienced level.
CCNA是获得优质工作机会和职业成长的垫脚石。它有助于进入网络领域,尤其是当一个人想使用CISCO产品时。在你开始作为专业CCNA专家的职业生涯之前,这些CCNA面试问题和答案肯定会为你提供帮助。它将你的知识提升到一个很高的水平,并帮助你在初级和经验丰富级别成功通过CCNA面试。
617. Is it possible to protect a character pointer from accidentally pointing it to a different address?
是否有可能保护一个字符指针,使其不会意外指向不同的地址?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98c0 | 官方: 否 | 付费: 否
答案:
It can be done by defining it as a constant character pointer. const protects it from modifications.
通过将其定义为常量字符指针即可实现。const 保护它免受修改。
618. What are the reasons for segmentation fault in Embedded C? How do you avoid these errors?
在嵌入式C中发生段错误的原因有哪些?如何避免这些错误?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98c3 | 官方: 否 | 付费: 否
答案:
Following are the reasons for the segmentation fault to occur: - While trying to dereference NULL pointers.
以下是发生段错误的原因:- 尝试解引用NULL指针时。
- While trying to write or update the read-only memory or non-existent memory not accessible by the program such as code segment, kernel structures, etc.
- While trying to dereference an uninitialized pointer that might have been pointing to invalid memory.
- While trying to dereference a pointer that was recently freed using the free function.
While accessing the array beyond the boundary.
Some of the ways where we can avoid Segmentation fault are: - Initializing Pointer Properly: Assign addresses to the pointers properly. For instance:我们可以避免段错误的一些方法有:- 正确初始化指针:适当地为指针分配地址。例如:
We can also assign the address of the matrix, vectors or using functions like calloc, malloc etc. Only important thing is to assign value to the pointer before accessing it.
我们还可以分配矩阵、向量的地址,或使用像calloc、malloc等函数。唯一重要的是在访问指针之前为其赋值。
int varName;
int varName;
int *p = &varName;
int *p = &varName;
- Minimize using pointers: Most of the functions in Embedded C such as scanf, require that address should be sent as a parameter to them. In cases like these, as best practices, we declare a variable and send the address of that variable to that function as shown below:
int x;
int x;
scanf("%d",&x);
scanf("%d",&x);
In the same way, while sending the address of variables to custom-defined functions, we can use the & parameter instead of using pointer variables to access the address.
同样,当向自定义函数发送变量地址时,我们可以使用&参数,而不是使用指针变量来访问地址。
int x = 1;
整数 x = 1;
x = customFunction(&x);
x = customFunction(&x);
- Troubleshooting: Make sure that every component of the program like pointers, array subscripts, & operator, * operator, array accessing, etc as they can be likely candidates for segmentation error. Debug the statements line by line to identify the line that causes the error and investigate them.
619. Is it recommended to use printf() inside ISR?
在ISR内部使用printf()是否推荐?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98c6 | 官方: 否 | 付费: 否
答案:
printf() is a non-reentrant and thread-safe function which is why it is not recommended to call inside the ISR.
printf()是一个不可重入且线程安全的函数,这就是为什么不建议在ISR内部调用它的原因。
620. Is it possible to pass a parameter to ISR or return a value from it?
是否可以向ISR传递参数或从中返回值?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98c9 | 官方: 否 | 付费: 否
答案:
An ISR by nature does not allow anything to pass nor does it return anything. This is because ISR is a routine called whenever hardware or software events occur and is not in control of the code.
ISR本质上不允许传递任何内容,也不返回任何内容。这是因为ISR是在硬件或软件事件发生时被调用的例程,不受代码控制。
621. What Is a Virtual Memory in Embedded C and how can it be implemented?
在嵌入式C中,什么是虚拟内存,如何实现它?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: coding
- 分类: fullstack
- id: 69b37abd58d557c902ba98cd | 官方: 否 | 付费: 否
答案:
Virtual memory is a means of allocating memory to the processes if there is a shortage of physical memory by using an automatic allocation of storage. The main advantage of using virtual memory is that it is possible to have larger virtual memory than physical memory. It can be implemented by using the technique of paging.
虚拟内存是一种在物理内存不足时,通过自动分配存储来为进程分配内存的方法。使用虚拟内存的主要优点是虚拟内存可以大于物理内存。它可以通过分页技术来实现。
Paging works as follows: - Whenever a process needs to be executed, it would be swapped into the memory by using a lazy swapper called a pager.
分页工作方式如下:- 每当需要执行一个进程时,它会通过一个称为分页器的惰性交换器被交换到内存中。
- The pager tries to guess which page needs to get access to the memory based on a predefined algorithm and swaps that process. This ensures that the whole process is not swapped into the memory, but only the necessary parts of the process are swapped utilizing pages.
- This decreases the time taken to swap and unnecessary reading of memory pages and reduces the physical memory required.
622. What is the issue with the following piece of code?
以下代码片段有什么问题?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98d1 | 官方: 否 | 付费: 否
答案:
int square (volatile int *p){
int square (volatile int *p){
return (p) (*p) ;
return (p) (*p) ;
}
From the code given, it appears that the function intends to return the square of the values pointed by the pointer p. But, since we have the pointer point to a volatile integer, the compiler generates code as below:
从给出的代码来看,该函数意图返回指针p指向值的平方。但是,由于指针指向一个volatile整数,编译器生成的代码如下:
int square ( volatile int *p){
int square ( volatile int *p){
int x , y;
整数 x, y;
x = *p ;
x = *p ;
y = *p ;
y = *p ;
return x * y ;
return x * y ;
}
Since the pointer can be changed to point to other locations, it might be possible that the values of the x and y would be different which might not even result in the square of the numbers. Hence, the correct way for achieving the square of the number is by coding as below:
由于指针可以被修改为指向其他位置,因此x和y的值可能会不同,甚至可能无法得到数字的平方。因此,实现数字平方的正确编码方式如下:
long square (volatile int *p ){
long square (volatile int *p ){
int x ;
int x ;
x = *p ;
x = *p ;
return x*x;
return x*x;
}
623. The following piece of code uses __interrupt keyword to define an ISR. Comment on the correctness of the code.
以下代码片段使用__interrupt关键字来定义一个ISR。请评价该代码的正确性。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98d4 | 官方: 否 | 付费: 否
答案:
__interrupt double calculate_circle_area (double radius){
__interrupt double calculate_circle_area (double radius){
double circle_area = PI ∗ radius ∗ radius;
double circle_area = PI ∗ radius ∗ radius;
printf ( 'Area = %f ' , circle_area);
printf ( 'Area = %f ' , circle_area);
return circle_area;
return circle_area;
}
Following things are wrong with the given piece of code: - ISRs are not supposed to return any value. The given code returns a value of datatype double.
给定代码片段中存在以下错误:- ISR不应返回任何值。给定代码返回了一个double类型的数据。
- It is not possible to pass parameters to ISRs. Here, we are passing a parameter to the ISR which is wrong.
- It is not advisable to have printf inside the ISR as they are non-reentrant and thereby it impacts the performance.
624. What is the result of the below code?
以下代码的结果是什么?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98d7 | 官方: 否 | 付费: 否
答案:
void demo(void){
void demo(void){
unsigned int x = 10 ;
unsigned int x = 10 ;
int y = −40;
int y = −40;
if(x+y > 10) {
if(x+y > 10) {
printf("Greater than 10");
printf("Greater than 10");
} else {
} else {
printf("Less than or equals 10");
printf("Less than or equals 10");
}
}
In Embedded C, we need to know a fact that when expressions are having signed and unsigned operand types, then every operand will be promoted to an unsigned type. Herem the -40 will be promoted to unsigned type thereby making it a very large value when compared to 10. Hence, we will get the statement “Greater than 10” printed on the console.
在嵌入式C语言中,我们需要了解一个事实:当表达式包含有符号和无符号操作数类型时,每个操作数都会被提升为无符号类型。这里,-40会被提升为无符号类型,从而在与10比较时变成一个非常大的值。因此,我们会在控制台上打印出语句“Greater than 10”。
625. What are the reasons for Interrupt Latency and how to reduce it?
中断延迟的原因是什么?如何减少它?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98da | 官方: 否 | 付费: 否
答案:
Following are the various causes of Interrupt Latency: - Hardware: Whenever an interrupt occurs, the signal has to be synchronized with the CPU clock cycles. Depending on the hardware of the processor and the logic of synchronization, it can take up to 3 CPU cycles before the interrupt signal has reached the processor for processing.
以下是中断延迟的各种原因:- 硬件:每当发生中断时,信号必须与CPU时钟周期同步。根据处理器的硬件和同步逻辑,中断信号到达处理器进行处理可能需要多达3个CPU周期。
Pipeline: Most of the modern CPUs have instructions pipelined. Execution happens when the instruction has reached the last stage of the pipeline. Once the execution of an instruction is done, it would require some extra CPU cycles to refill the pipeline with instructions. This contributes to the latency.
Interrupt latency can be reduced by ensuring that the ISR routines are short. When a lower priority interrupt gets triggered while a higher priority interrupt is getting executed, then the lower priority interrupt would get delayed resulting in increased latency. In such cases, having smaller ISR routines for lower priority interrupts would help to reduce the delay.中断延迟可以通过确保ISR例程简短来减少。当较低优先级的中断在较高优先级中断执行期间被触发时,较低优先级的中断会延迟,导致延迟增加。在这种情况下,为较低优先级中断设置较小的ISR例程有助于减少延迟。
Also, better scheduling and synchronization algorithms in the processor CPU would help minimize the ISR latency.
此外,处理器CPU中更好的调度和同步算法有助于最小化ISR延迟。
626. Why is the statement ++i faster than i+1?
为什么语句++i比i+1更快?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98dd | 官方: 否 | 付费: 否
答案:
- ++i instruction uses single machine instruction like INR (Increment Register) to perform the increment.
- For the instruction i+1, it requires to load the value of the variable i and then perform the INR operation on it. Due to the additional load, ++i is faster than the i+1 instruction.
627. What do you understand by Wild Pointer? How is it different from Dangling Pointer?
你对野指针有何理解?它与悬空指针有何不同?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98e0 | 官方: 否 | 付费: 否
答案:
A pointer is said to be a wild pointer if it has not been initialized to NULL or a valid memory address. Consider the following declaration:
如果指针未初始化为NULL或有效的内存地址,则称其为野指针。考虑以下声明:
int *ptr;
int *ptr;
*ptr = 20;
*ptr = 20;
Here the pointer ptr is not initialized and in the next step, we are trying to assign a valid value to it. If the ptr has a garbage location address, then that would corrupt the upcoming instructions too.
这里指针ptr未初始化,在下一步中,我们尝试为其分配一个有效值。如果ptr具有垃圾位置地址,那么这也会破坏后续的指令。
If we are trying to de-allocate this pointer and free it as well using the free function, and again if we are not assigning the pointer as NULL or any valid address, then again chances are that the pointer would still be pointing to the garbage location and accessing from that would lead to errors. These pointers are called dangling pointers.
如果我们尝试使用free函数释放此指针并将其释放,且再次未将指针赋值为NULL或任何有效地址,那么指针仍可能指向垃圾位置,从该位置访问会导致错误。这些指针称为悬空指针。
628. What are the differences between the following 2 statements #include "..." and #include <...>?
以下两条语句#include "..."和#include <...>之间有什么区别?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98e3 | 官方: 否 | 付费: 否
答案:
Both declarations specify for the files to be included in the current source file. The difference is in how and where the preprocessor looks for including the files. For #include "..." , the preprocessor just searches for the file in the current directory as where the source file is present and if not found, it proceeds to search in the standard directories specified by the compiler. Whereas for the #include declaration, the preprocessor looks for the files in the compiler designated directories where the standard library files usually reside.
两种声明都指定将文件包含到当前源文件中。区别在于预处理器查找包含文件的方式和位置。对于#include "...",预处理器仅在当前目录中搜索文件(即源文件所在位置),如果未找到,则继续在编译器指定的标准目录中搜索。而对于#include <...>声明,预处理器在编译器指定的目录中查找文件,标准库文件通常驻留在此处。
629. When does a memory leak occur? What are the ways of avoiding it?
内存泄漏何时发生?避免它的方法有哪些?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98e6 | 官方: 否 | 付费: 否
答案:
Memory leak is a phenomenon that occurs when the developers create objects or make use of memory to help memory and then forget to free the memory before the completion of the program. This results in reduced system performance due to the reduced memory availability and if this continues, at one point, the application can crash. These are serious issues for applications involving servers, daemons, etc that should ideally never terminate.
内存泄漏是指开发人员创建对象或使用内存来帮助内存管理,但在程序完成前忘记释放内存时发生的现象。这会导致可用内存减少,从而降低系统性能,如果持续下去,应用程序可能会在某一点崩溃。对于涉及服务器、守护进程等理论上永远不应终止的应用程序来说,这些是严重的问题。
Example of Memory Leak:
内存泄漏示例:
include <stdlib.h>
void memLeakDemo()
void memLeakDemo()
{
int p = (int ) malloc(sizeof(int));
int p = (int ) malloc(sizeof(int));
/ Some set of statements /
/ 一些语句集 /
return; / Return from the function without freeing the pointer p/
return; / 从函数返回而未释放指针p /
}
In this example, we have created pointer p inside the function and we have not freed the pointer before the completion of the function. This causes pointer p to remain in the memory. Imagine 100s of pointers like these. The memory will be occupied unnecessarily and hence resulting in a memory leak.
在此示例中,我们在函数内部创建了指针p,并且在函数完成前未释放该指针。这导致指针p保留在内存中。想象有数百个这样的指针。内存将被不必要地占用,从而导致内存泄漏。
We can avoid memory leaks by always freeing the objects and pointers when no longer required. The above example can be modified as:
我们可以通过始终在不再需要时释放对象和指针来避免内存泄漏。上述示例可以修改为:
include <stdlib.h>;
void memLeakFix()
void memLeakFix()
{
int p = (int ) malloc(sizeof(int));
int p = (int ) malloc(sizeof(int));
/ Some set of statements /
/ 一些语句集 /
free(p); // Free method to free the memory allocated to the pointer p
free(p); // 使用free方法释放分配给指针p的内存
return;
return;
}
630. What kind of loop is better - Count up from zero or Count Down to zero?
哪种循环更好——从零向上计数还是从零向下计数?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98e9 | 官方: 否 | 付费: 否
答案:
Loops that involve count down to zero are better than count-up loops. This is because the compiler can optimize the comparison to zero at the time of loop termination. The processors need not have to load both the loop variable and the maximum value for comparison due to the optimization. Hence, count down to 0 loops are always better.
涉及向下计数到零的循环优于向上计数循环。这是因为编译器可以在循环终止时优化为零的比较。由于优化,处理器无需加载循环变量和最大值进行比较。因此,向下计数到0的循环总是更好。
631. What do you understand by a null pointer in Embedded C?
你如何理解嵌入式C中的空指针?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98ec | 官方: 否 | 付费: 否
答案:
A null pointer is a pointer that does not point to any valid memory location. It is defined to ensure that the pointer should not be used to modify anything as it is invalid. If no address is assigned to the pointer, it is set to NULL .
空指针是指向任何有效内存位置的指针。它被定义以确保指针不被用于修改任何内容,因为它是无效的。如果没有地址分配给指针,则将其设置为NULL。
Syntax:
语法:
data_type *pointer_name = NULL;
data_type *pointer_name = NULL;
One of the uses of the null pointer is that once the memory allocated to a pointer is freed up, we will be using NULL to assign to the pointer so that it does not point to any garbage locations.
空指针的用途之一是,一旦分配给指针的内存被释放,我们将使用 NULL 赋值给该指针,使其不再指向任何垃圾位置。
632. Following are some incomplete declarations, what do each of them mean?
以下是一些不完整的声明,它们各自表示什么意思?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98ef | 官方: 否 | 付费: 否
答案:
const int x;
- const int x;
int const x;
- int const x;
const int *x;
- const int *x;
int * const x;
- int * const x;
int const * x const;
- int const * x const;
- The first two declaration points 1 and 2 mean the same. It means that the variable x is a read-only constant integer.
- The third declaration represents that the variable a is a pointer to a constant integer. The integer value can't be modified but the pointer can be modified to point to other locations.
- The fourth declaration means that the variable x is a constant pointer to an integer value. It means that the integer value can be changed, but the pointer can't be made to point to anything else.
- The last declaration means that the variable x is a constant pointer to a constant integer which means that neither the pointer can point to a different location nor the integer value can be modified.
Embedded C Programming
633. Write an Embedded C program to multiply any number by 9 in the fastest manner.
编写一个嵌入式C程序,以最快的方式将任何数字乘以9。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: coding
- 分类: fullstack
- id: 69b37abd58d557c902ba98f2 | 官方: 否 | 付费: 否
答案:
This can be achieved by involving bit manipulation techniques - Shift left operator as shown below:
这可以通过位操作技术实现——如下所示使用左移运算符:
include<stdio.h>
void main(){
void main(){
int num;
int num;
printf(“Enter number: ”);
printf(“输入数字:”);
scanf(“%d”,&num);
scanf(“%d”,&num);
printf(“%d”, (num<<3)+num);
printf(“%d”, (num<<3)+num);
}
634. How will you swap two variables? Write different approaches for the same.
你将如何交换两个变量?写出不同方法。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37abd58d557c902ba98f5 | 官方: 否 | 付费: 否
答案:
- Using Extra Memory Space:
int num1=20, num2=30, temp;
int num1=20, num2=30, temp;
temp = num1;
temp = num1;
num1 = num2;
num1 = num2;
num2 = temp;
num2 = temp;
- Using Arithmetic Operators:
int num1=20, num2=30;
int num1=20, num2=30;
num1=num1 + num2;
num1=num1 + num2;
num2=num1 - num2;
num2=num1 - num2;
num1=num1 - num2;
num1=num1 - num2;
- Using Bit-Wise Operators:
int num1=20, num2=30;
int num1=20, num2=30;
num1=num1 ^ num2;
num1=num1 ^ num2;
num2=num2 ^ num1;
num2=num2 ^ num1;
num1=num1 ^ num2;
num1=num1 ^ num2;
- Using One-liner Bit-wise Operators:
int num1=20, num2=30;
int num1=20, num2=30;
num1^=num2^=num1^=num2;
num1^=num2^=num1^=num2;
The order of evaluation here is right to left. - Using One-liner Arithmetic Operators:
这里的求值顺序是从右到左。- 使用单行算术运算符:
int num1=20, num2=30;
int num1=20, num2=30;
num1 = (num1+num2)-(num2=num1);
num1 = (num1+num2)-(num2=num1);
Here the order of evaluation is from left to right.
这里求值顺序是从左到右。
635. Write a program to check if a number is a power of 2 or not.
编写一个程序来检查一个数是否是2的幂。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: coding
- 分类: fullstack
- id: 69b37abd58d557c902ba98f8 | 官方: 否 | 付费: 否
答案:
We can do this by using bitwise operators.
我们可以通过使用位运算符来实现这一点。
void main (){
void main (){
int num;
int num;
printf ("Enter any no:");
printf ("输入任意数字:");
scanf ("%d", &num);
scanf ("%d", &num);
if (num & & ((num & num-1) == 0))
if (num & & ((num & num-1) == 0))
printf ("Number is a power of 2");
printf ("该数是2的幂");
else
else
printf ("Number is not a power of 2");
printf ("该数不是2的幂");
}
636. Write a program to print numbers from 1 to 100 without making use of conditional operators?
编写一个程序,在不使用条件运算符的情况下打印从1到100的数字?
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: coding
- 分类: fullstack
- id: 69b37abd58d557c902ba98fb | 官方: 否 | 付费: 否
答案:
void main (){
void main (){
int i=0;
int i=0;
while (100 – i++)
while (100 – i++)
printf ("%d", i);
printf ("%d", i);
}
637. Write a MIN macro program that takes two arguments and returns the smallest of both arguments.
编写一个MIN宏程序,该宏接受两个参数并返回两者中最小的那个。
- 知识点: 操作系统与网络 / 编程语言基础 (主题: embedded, c;标签: interviewbit, embedded-c, topic-specific, embedded, c)
- 类型: technical | 难度: hard | 子类型: coding
- 分类: fullstack
- id: 69b37abd58d557c902ba98fe | 官方: 否 | 付费: 否
答案:
define MIN(NUM1,NUM2) ( (NUM1) <= (NUM2) ? (NUM1) : (NUM2) )
Useful Resource
有用资源
C Interview Questions
C语言面试问题
C++ Interview Questions
C++语言面试题
Practice Coding
实践编码
InterviewBit Blog
InterviewBit博客
Online C++ Compiler
在线C++编译器
638. What is ConcurrentHashMap and Hashtable? In java, why is ConcurrentHashMap considered faster than Hashtable?
什么是ConcurrentHashMap和Hashtable?在Java中,为什么ConcurrentHashMap被认为比Hashtable更快?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4ed9 | 官方: 否 | 付费: 否
答案:
ConcurrentHashMap : It was introduced in Java 1.5 to store data using multiple buckets. As the name suggests, it allows concurrent read and writes operations to the map. It only locks a certain portion of the map while doing iteration to provide thread safety so that other readers can still have access to the map without waiting for iteration to complete. Hashtable : It is a thread-safe legacy class that was introduced in old versions of java to store key or value pairs using a hash table. It does not provide any lock-free read, unlike ConcurrentHashMap. It just locks the entire map while doing iteration. ConcurrentHashMap and Hashtable, both are thread-safe but ConcurrentHashMap generally avoids read locks and improves performance, unlike Hashtable. ConcurrentHashMap also provides lock-free reads, unlike Hashtable. Therefore, ConcurrentHashMap is considered faster than Hashtable especially when the number of readers is more as compared to the number of writers.
ConcurrentHashMap:它是在Java 1.5中引入的,用于通过多个桶来存储数据。顾名思义,它允许对映射进行并发读写操作。在进行迭代时,它只锁定映射的某一部分以提供线程安全性,这样其他读取者仍然可以访问映射,而无需等待迭代完成。Hashtable:它是一个线程安全的遗留类,在Java的旧版本中引入,用于通过哈希表存储键值对。与ConcurrentHashMap不同,它不提供无锁读取。在迭代时,它只会锁定整个映射。ConcurrentHashMap和Hashtable都是线程安全的,但与Hashtable不同,ConcurrentHashMap通常避免读锁并提高性能。ConcurrentHashMap还提供了无锁读取,而这在Hashtable中是不存在的。因此,ConcurrentHashMap被认为比Hashtable更快,特别是当读取者数量多于写入者数量时。
639. What is thread starvation?
什么是线程饥饿?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4edc | 官方: 否 | 付费: 否
答案:
Thread starvation is basically a situation or condition where a thread won’t be able to have regular access to shared resources and therefore is unable to proceed or make progress. This is because other threads have high priority and occupy the resources for too long. This usually happens with low-priority threads that do not get CPU for its execution to carry on.
线程饥饿基本上是一种情况或条件,其中线程无法定期访问共享资源,因此无法继续或取得进展。这是因为其他线程具有高优先级并长时间占用资源。这种情况通常发生在低优先级线程上,它们无法获得CPU来继续执行。
640. What is Livelock? What happens when it occurs?
什么是活锁?它发生时会发生什么?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4edf | 官方: 否 | 付费: 否
答案:
Similar to deadlock, livelock is also another concurrency problem. In this case, the state of threads changes between one another without making any progress. Threads are not blocked but their execution is stopped due to the unavailability of resources.
与死锁类似,活锁也是另一种并发问题。在这种情况下,线程的状态在彼此之间变化,但没有取得任何进展。线程没有被阻塞,但由于资源不可用,它们的执行停止了。
641. What is BlockingQueue?
什么是阻塞队列?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4ee2 | 官方: 否 | 付费: 否
答案:
BlockingQueue basically represents a queue that is thread-safe. Producer thread inserts resource/element into the queue using put() method unless it gets full and consumer thread takes resources from the queue using take() method until it gets empty. But if a thread tries to dequeue from an empty queue, then a particular thread will be blocked until some other thread inserts an item into the queue, or if a thread tries to insert an item into a queue that is already full, then a particular thread will be blocked until some threads take away an item from the queue.
阻塞队列基本上表示一个线程安全的队列。生产者线程使用put()方法将资源/元素插入队列,直到队列满为止,而消费者线程使用take()方法从队列中取出资源,直到队列为空。但如果一个线程试图从空队列中出队,则该特定线程将被阻塞,直到其他线程将项目插入队列;或者如果一个线程试图向已满的队列中插入项目,则该特定线程将被阻塞,直到某些线程从队列中取出项目。
Example :
示例:
package org.arpit.java2blog;
package org.arpit.java2blog;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.BlockingQueue;
public class BlockingQueuePCExample {
public class BlockingQueuePCExample {
public static void main(String[] args) {
public static void main(String[] args) {
BlockingQueue
BlockingQueuequeue=new ArrayBlockingQueue<>(5);
Producer producer=new Producer(queue);
Producer producer=new Producer(queue);
Consumer consumer=new Consumer(queue);
Consumer consumer=new Consumer(queue);
Thread producerThread = new Thread(producer);
Thread producerThread = new Thread(producer);
Thread consumerThread = new Thread(consumer);
Thread consumerThread = new Thread(consumer);
producerThread.start();
producerThread.start();
consumerThread.start();
consumerThread.start();
}
static class Producer implements Runnable {
static class Producer implements Runnable {
BlockingQueue
BlockingQueuequeue=null;
public Producer(BlockingQueue queue) {
public Producer(BlockingQueue queue) {
super();
super();
this.queue = queue;
this.queue = queue;
}
@Override
@Override
public void run() {
public void run() {
try {
try {
System.out.println("Producing element 1");
System.out.println("Producing element 1");
queue.put("Element 1");
queue.put("Element 1");
Thread.sleep(1000);
Thread.sleep(1000);
System.out.println("Producing element 2");
System.out.println("Producing element 2");
queue.put("Element 2");
queue.put("Element 2");
Thread.sleep(1000);
Thread.sleep(1000);
System.out.println("Producing element 3");
System.out.println("Producing element 3");
queue.put("Element 3");
queue.put("Element 3");
} catch (InterruptedException e) {
} catch (InterruptedException e) {
e.printStackTrace();
e.printStackTrace();
}
}
}
static class Consumer implements Runnable {
static class Consumer implements Runnable {
BlockingQueue
BlockingQueuequeue=null;
public Consumer(BlockingQueue queue) {
public Consumer(BlockingQueue queue) {
super();
super();
this.queue = queue;
this.queue = queue;
}
@Override
@Override
public void run() {
public void run() {
while(true)
while(true)
{
try {
try {
System.out.println("Consumed "+queue.take());
System.out.println("Consumed "+queue.take());
} catch (InterruptedException e) {
} catch (InterruptedException e) {
e.printStackTrace();
e.printStackTrace();
}
}
}
}
}
Output :
输出:
Producing element 1
正在生成元素 1
Consumed Element 1
已消费元素 1
Producing element 2
正在生成元素 2
Consumed Element 2
已消费元素 2
Producing element 3
正在生成元素 3
Consumed Element 3
已消费元素 3
642. Can you start a thread twice?
你能两次启动一个线程吗?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4ee5 | 官方: 否 | 付费: 否
答案:
No, it's not at all possible to restart a thread once a thread gets started and completes its execution. Thread only runs once and if you try to run it for a second time, then it will throw a runtime exception i.e., java.lang.IllegalThreadStateException. Example :
不,一旦线程启动并完成执行,就完全不可能重新启动它。线程只运行一次,如果你尝试第二次运行它,那么它会抛出一个运行时异常,即 java.lang.IllegalThreadStateException。示例:
public class TestThreadTwice1 extends Thread{
public class TestThreadTwice1 extends Thread{
public void run(){
public void run(){
System.out.println(" thread is executing now........");
System.out.println("线程正在执行中........");
}
public static void main(String args[]){
public static void main(String args[]){
TestThreadTwice1 t1=new TestThreadTwice1();
TestThreadTwice1 t1=new TestThreadTwice1();
t1.start();
t1.start();
t1.start();
t1.start();
}
}
Output:
输出:
thread is executing now........
线程正在执行中........
Exception in thread "main" java.lang.IllegalThreadStateException
线程“main”中出现异常 java.lang.IllegalThreadStateException
643. Explain context switching.
解释上下文切换。
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4ee8 | 官方: 否 | 付费: 否
答案:
Context switching is basically an important feature of multithreading. It is referred to as switching of CPU from one thread or process to another one. It allows multiple processes to share the same CPU. In context switching, the state of thread or process is stored so that the execution of the thread can be resumed later if required.
上下文切换基本上是多线程的一个重要特性。它指的是CPU从一个线程或进程切换到另一个线程或进程。它允许多个进程共享同一个CPU。在上下文切换中,线程或进程的状态被存储,以便在需要时可以在稍后恢复该线程的执行。
644. What is CyclicBarrier and CountDownLatch?
什么是CyclicBarrier和CountDownLatch?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4eeb | 官方: 否 | 付费: 否
答案:
CyclicBarrier and CountDownLatch, both are required for managing multithreaded programming. But there is some difference between them as given below:
CyclicBarrier和CountDownLatch都是管理多线程编程所必需的。但它们之间存在一些差异,如下所示:
CyclicBarrier: It is a tool to synchronize threads processing using some algorithm. It enables a set of threads to wait for each other till they reach a common execution point or common barrier points, and then let them further continue execution. One can reuse the same CyclicBarrier even if the barrier is broken by setting it.
CyclicBarrier:它是一种通过某种算法来同步线程处理的工具。它使一组线程能够相互等待,直到它们到达一个共同的执行点或共同的屏障点,然后让它们继续执行。即使屏障被打破,也可以通过重置来重用同一个CyclicBarrier。
CountDownLatch: It is a tool that enables main threads to wait until mandatory operations are performed and completed by other threads. In simple words, it makes sure that a thread waits until the execution in another thread completes before it starts its execution. One cannot reuse the same CountDownLatch once the count reaches 0.
CountDownLatch:它是一种工具,使主线程能够等待直到其他线程执行并完成必要的操作。简单来说,它确保一个线程在另一个线程执行完成之前等待,然后才开始自己的执行。一旦计数达到0,就不能重用同一个CountDownLatch。
645. What do you mean by inter-thread communication?
你所说的线程间通信是什么意思?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4ef0 | 官方: 否 | 付费: 否
答案:
Inter-thread communication, as the name suggests, is a process or mechanism using which multiple threads can communicate with each other. It is especially used to avoid thread polling in java and can be obtained using wait(), notify(), and notifyAll() methods.
线程间通信,顾名思义,是一种多个线程可以相互通信的过程或机制。它特别用于避免Java中的线程轮询,并可以通过wait()、notify()和notifyAll()方法来实现。
646. What is Thread Scheduler and Time Slicing?
什么是线程调度器和时间切片?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4ef3 | 官方: 否 | 付费: 否
答案:
Thread Scheduler : It is a component of JVM that is used to decide which thread will execute next if multiple threads are waiting to get the chance of execution. By looking at the priority assigned to each thread that is READY, the thread scheduler selects the next run to execute. To schedule the threads, it mainly uses two mechanisms: Preemptive Scheduling and Time slicing scheduling. Time Slicing : It is especially used to divide CPU time and allocate them to active threads. In this, each thread will get a predefined slice of time to execute. When the time expires, a particular thread has to wait till other threads get their chances to use their time in a round-robin fashion. Every running thread will get executed for a fixed time period.
线程调度器:它是JVM的一个组件,用于决定当多个线程等待执行机会时哪个线程将先执行。通过查看每个处于就绪状态的线程所分配的优先级,线程调度器选择下一个要执行的线程。为了调度线程,它主要使用两种机制:抢占式调度和时间切片调度。时间切片:它特别用于划分CPU时间并将其分配给活动线程。在这种机制中,每个线程将获得预定义的时间片来执行。当时间到期时,特定的线程必须等待,直到其他线程以轮询方式获得使用其时间的机会。每个正在运行的线程将在固定的时间周期内执行。
647. What is a shutdown hook?
什么是关闭钩子(shutdown hook)?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4ef8 | 官方: 否 | 付费: 否
答案:
A shutdown hook is simply a thread that is invoked implicitly before JVM shuts down. It is one of the most important features of JVM because it provides the capacity to do resource cleanup or save application state JVM shuts down. By calling the halt(int) method of the Runtime class, the shutdown hook can be stopped. Using the following method, one can add a shutdown hook.
关闭钩子简单来说就是在JVM关闭之前被隐式调用的一个线程。它是JVM最重要的特性之一,因为它提供了在JVM关闭时进行资源清理或保存应用程序状态的能力。通过调用 Runtime 类的 halt(int) 方法,可以停止关闭钩子。使用以下方法,可以添加一个关闭钩子。
public void addShutdownHook(Thread hook){}
public void addShutdownHook(Thread hook){}
Runtime r=Runtime.getRuntime();
Runtime r=Runtime.getRuntime();
r.addShutdownHook(new MyThread());
r.addShutdownHook(new MyThread());
648. What is busy spinning?
什么是忙等待(busy spinning)?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4efb | 官方: 否 | 付费: 否
答案:
Busy Spinning, also known as Busy-waiting, is a technique in which one thread waits for some condition to happen, without calling wait or sleep methods and releasing the CPU. In this condition, one can pause a thread by making it run an empty loop for a certain time period, and it does not even give CPY control. Therefore, it is used to preserve CPU caches and avoid the cost of rebuilding cache.
忙等待(Busy Spinning),也称为忙循环(Busy-waiting),是一种一个线程等待某个条件发生而不调用 wait 或 sleep 方法,也不释放CPU的技术。在这种状态下,可以通过让线程运行一个空循环一段时间来暂停它,而且它甚至不交出CPU控制权。因此,它被用来保留CPU缓存并避免重建缓存的开销。
649. What is synchronized method and synchronized block? Which one should be preferred?
什么是同步方法和同步块?应该优先选择哪一个?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4efe | 官方: 否 | 付费: 否
答案:
Synchronized Method : In this method, the thread acquires a lock on the object when they enter the synchronized method and releases the lock either normally or by throwing an exception when they leave the method. No other thread can use the whole method unless and until the current thread finishes its execution and release the lock. It can be used when one wants to lock on the entire functionality of a particular method. Synchronized Block : In this method, the thread acquires a lock on the object between parentheses after the synchronized keyword, and releases the lock when they leave the block. No other thread can acquire a lock on the locked object unless and until the synchronized block exists. It can be used when one wants to keep other parts of the programs accessible to other threads. Synchronized blocks should be preferred more as it boosts the performance of a particular program. It only locks a certain part of the program (critical section) rather than the entire method and therefore leads to less contention.
同步方法:在这种方法中,线程进入同步方法时获取对象上的锁,并在离开方法时正常或通过抛出异常释放锁。除非当前线程完成执行并释放锁,否则其他线程无法使用整个方法。当想在特定方法的整个功能上加锁时,可以使用该方法。同步块:在这种方法中,线程在 synchronized 关键字后的括号内获取对象上的锁,并在离开块时释放锁。除非同步块存在,否则其他线程无法获取被锁定对象的锁。当想让程序的其他部分对其他线程可访问时,可以使用该方法。同步块应该更受青睐,因为它能提升特定程序的性能。它只锁定程序的某个部分(临界区),而不是整个方法,因此导致更少的争用。
650. Explain thread priority.
解释线程优先级。
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4f01 | 官方: 否 | 付费: 否
答案:
Thread priority simply means that threads with the highest priority will get a chance for execution prior to low-priority threads. One can specify the priority but it's not necessary that the highest priority thread will get executed before the lower-priority thread. Thread scheduler assigns processor to thread on the basis of thread priority. The range of priority changes between 1-10 from lowest priority to highest priority.
线程优先级简单来说意味着优先级最高的线程将比低优先级线程更早获得执行机会。可以指定优先级,但并不一定保证最高优先级的线程会在低优先级线程之前执行。线程调度器根据线程优先级将处理器分配给线程。优先级范围从最低的1到最高的10。
651. What do you mean by the ThreadLocal variable in Java?
Java中的 ThreadLocal 变量是什么意思?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4f04 | 官方: 否 | 付费: 否
答案:
ThreadLocal variables are special kinds of variables created and provided by the Java ThreadLocal class. These variables are only allowed to be read and written by the same thread. Two threads cannot be able to see each other’s ThreadLocal variable, so even if they will execute the same code, then there won't be any race condition and the code will be thread-safe. Example :
ThreadLocal 变量是由 Java ThreadLocal 类创建和提供的特殊类型的变量。这些变量只允许同一线程进行读写。两个线程无法看到彼此的 ThreadLocal 变量,因此即使它们执行相同的代码,也不会出现竞态条件,代码将是线程安全的。示例:
public class ThreadLocalExp
public class ThreadLocalExp
{
public static class MyRunnable implements Runnable
public static class MyRunnable implements Runnable
{
private ThreadLocalthreadLocal =
private ThreadLocalthreadLocal =
new ThreadLocal();
new ThreadLocal();
@Override
@Override
public void run() {
public void run() {
threadLocal.set( (int) (Math.random() * 50D) );
threadLocal.set( (int) (Math.random() * 50D) );
try
try
{
Thread.sleep(1000);
Thread.sleep(1000);
} catch (InterruptedException e) {
} catch (InterruptedException e) {
}
System.out.println(threadLocal.get());
System.out.println(threadLocal.get());
}
}
public static void main(String[] args)
public static void main(String[] args)
{
MyRunnable runnableInstance = new MyRunnable();
MyRunnable runnableInstance = new MyRunnable();
Thread t1 = new Thread(runnableInstance);
Thread t1 = new Thread(runnableInstance);
Thread t2 = new Thread(runnableInstance);
Thread t2 = new Thread(runnableInstance);
// this will call run() method
// 这将调用 run() 方法
t1.start();
t1.start();
t2.start();
t2.start();
}
}
Output :
输出:
10
33
10 33
652. What is semaphore?
什么是信号量?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4f07 | 官方: 否 | 付费: 否
答案:
Semaphore is regarded as a thread synchronization construct that is usually required to control and manage the access to the shared resource using counters. It simply sets the limit of the thread. The semaphore class is defined within the package java.util.concurrent and can be used to send signals between threads to avoid missed signals or to guard critical sections. It can also be used to implement resource pools or bounded collection.
信号量被视为一种线程同步构造,通常需要使用计数器来控制和管理对共享资源的访问。它简单地设置线程的限制。信号量类定义在java.util.concurrent包内,可用于在线程之间发送信号以避免丢失信号,或保护临界区。它也可用于实现资源池或有界集合。
653. Explain Thread Group. Why should we not use it?
解释线程组。为什么我们不应该使用它?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4f0a | 官方: 否 | 付费: 否
答案:
ThreadGroup is a class that is used to create multiple groups of threads in a single object. This group of threads is present in the form of three structures in which every thread group has a parent except the initial thread. Thread groups can contain other thread groups also. A thread is only allowed to have access to information about its own thread group, not other thread groups. Previously in the old version of Java, the only functionality that did not work without a thread group was uncaughtException( Thread t, Throwable e). But now in Java 5 versions, there is Thread.setUncaughtExceptionHandler(UncaughtExceptionHandler). So now even that works without thread groups and therefore, there is no need to use thread groups.
ThreadGroup是一个类,用于在单个对象中创建多个线程组。这组线程以三种结构的形式存在,其中每个线程组都有一个父组,除了初始线程外。线程组也可以包含其他线程组。线程只被允许访问有关自己线程组的信息,而不能访问其他线程组。在旧版Java中,唯一没有线程组就无法工作的功能是uncaughtException(Thread t, Throwable e)。但现在在Java 5版本中,有Thread.setUncaughtExceptionHandler(UncaughtExceptionHandler)。所以现在即使没有线程组也能正常工作,因此,没有必要再使用线程组了。
t1.setUncaughtExceptionHandler(new UncaughtExceptionHandler()
t1.setUncaughtExceptionHandler(new UncaughtExceptionHandler()
{
@Override
@Override
public void uncaughtException(Thread t, Throwable e)
public void uncaughtException(Thread t, Throwable e)
{
System.out.println("exception occured:"+e.getMessage());
System.out.println("发生异常:"+e.getMessage());
}
};
654. What is the ExecutorService interface?
什么是ExecutorService接口?
- 知识点: 操作系统与网络 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4f0d | 官方: 否 | 付费: 否
答案:
ExecutorService interface is basically a sub-interface of Executor interface with some additional methods or features that help in managing and controlling the execution of threads. It enables us to execute tasks asynchronously on threads.
ExecutorService接口基本上是Executor接口的子接口,它提供了一些额外的方法或特性,有助于管理和控制线程的执行。它使我们能够在线程上异步执行任务。
Example:
示例:
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeUnit;
public class TestThread {
public class TestThread {
public static void main(final String[] arguments) throws InterruptedException {
public static void main(final String[] arguments) throws InterruptedException {
ExecutorService e = Executors.newSingleThreadExecutor();
ExecutorService e = Executors.newSingleThreadExecutor();
try {
try {
e.submit(new Thread());
e.submit(new Thread());
System.out.println("Shutdown executor");
System.out.println("关闭执行器");
e.shutdown();
e.shutdown();
e.awaitTermination(5, TimeUnit.SECONDS);
e.awaitTermination(5, TimeUnit.SECONDS);
} catch (InterruptedException ex) {
} catch (InterruptedException ex) {
System.err.println("tasks interrupted");
System.err.println("任务被中断");
} finally {
} finally {
if (!e.isTerminated()) {
if (!e.isTerminated()) {
System.err.println("cancel non-finished tasks");
System.err.println("取消未完成的任务");
}
e.shutdownNow();
e.shutdownNow();
System.out.println("shutdown finished");
System.out.println("关闭完成");
}
}
static class Task implements Runnable {
static class Task implements Runnable {
public void run() {
public void run() {
try {
try {
Long duration = (long) (Math.random() * 20);
Long duration = (long) (Math.random() * 20);
System.out.println("Running Task!");
System.out.println("正在运行任务!");
TimeUnit.SECONDS.sleep(duration);
TimeUnit.SECONDS.sleep(duration);
} catch (InterruptedException ex) {
} catch (InterruptedException ex) {
ex.printStackTrace();
ex.printStackTrace();
}
}
}
}
Output:
输出:
Shutdown executor
关闭执行器
shutdown finished
关闭完成
655. What will happen if we don’t override the thread class run() method?
如果我们不重写线程类的run()方法,会发生什么?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4f10 | 官方: 否 | 付费: 否
答案:
Nothing will happen as such if we don’t override the run() method. The compiler will not show any error. It will execute the run() method of thread class and we will just don’t get any output because the run() method is with an empty implementation. Example:
如果我们不重写run()方法,什么都不会发生。编译器不会显示任何错误。它将执行线程类的run()方法,但因为我们不会得到任何输出,因为run()方法是一个空实现。示例:
class MyThread extends Thread {
class MyThread extends Thread {
//don't override run() method
//不重写run()方法
}
public class DontOverrideRun {
public class DontOverrideRun {
public static void main(String[] args) {
public static void main(String[] args) {
System.out.println("Started Main.");
System.out.println("启动主线程。");
MyThread thread1=new MyThread();
MyThread thread1=new MyThread();
thread1.start();
thread1.start();
System.out.println("Ended Main.");
System.out.println("主线程结束。");
}
}
Output:
输出:
Started Main.
启动主线程。
Ended Main.
主线程结束。
656. What is the lock interface? Why is it better to use a lock interface rather than a synchronized block.?
什么是锁接口?为什么使用锁接口比使用同步块更好?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4f13 | 官方: 否 | 付费: 否
答案:
Lock interface was introduced in Java 1.5 and is generally used as a synchronization mechanism to provide important operations for blocking. Advantages of using Lock interface over Synchronization block: - Methods of Lock interface i.e., Lock() and Unlock() can be called in different methods. It is the main advantage of a lock interface over a synchronized block because the synchronized block is fully contained in a single method.
锁接口是在Java 1.5中引入的,通常用作同步机制,以提供重要的阻塞操作。使用锁接口相对于同步块的优势:- 锁接口的方法,即Lock()和Unlock(),可以在不同方法中调用。这是锁接口相对于同步块的主要优势,因为同步块完全包含在单个方法中。
- Lock interface is more flexible and makes sure that the longest waiting thread gets a fair chance for execution, unlike the synchronization block.
657. Is it possible to call the run() method directly to start a new thread?
是否可以直接调用run()方法来启动新线程?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4f17 | 官方: 否 | 付费: 否
答案:
No, it's not possible at all. You need to call the start method to create a new thread otherwise run method won't create a new thread. Instead, it will execute in the current thread.
不,完全不可能。你需要调用start方法来创建新线程,否则run方法不会创建新线程。相反,它会在当前线程中执行。
658. Is it possible that each thread can have its stack in multithreaded programming?
在多线程编程中,每个线程是否可能拥有自己的栈?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: hard | 子类型: coding
- 分类: fullstack
- id: 69b37bd858d557c902bb4f1d | 官方: 否 | 付费: 否
答案:
Of course, it is possible. In multithreaded programming, each thread maintains its own separate stack area in memory because of which every thread is independent of each other rather than dependent.
当然,这是可能的。在多线程编程中,每个线程在内存中维护自己独立的栈区域,因此每个线程彼此独立,而不是相互依赖。
659. What is the synchronization process? Why use it?
什么是同步过程?为什么使用它?
- 知识点: 操作系统与网络 / 行为与软技能 (主题: multithreading, concurrency;标签: interviewbit, multithreading, topic-specific, concurrency)
- 类型: behavioral | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bd858d557c902bb4f20 | 官方: 否 | 付费: 否
答案:
Synchronization is basically a process in java that enables a simple strategy for avoiding thread interference and memory consistency errors. This process makes sure that resource will be only used one thread at a time when one thread tries to access a shared resource. It can be achieved in three different ways as given below: - By the synchronized method
同步基本上是Java中的一个过程,它提供了一种简单的策略,以避免线程干扰和内存一致性错误。这个过程确保当一个线程尝试访问共享资源时,该资源一次只会被一个线程使用。可以通过以下三种方式实现:- 通过同步方法
- By synchronized block
By static synchronization
Syntax :语法:
synchronized (object)
synchronized (object)
{
//statement to be synchronized
//待同步的语句
}
660. What is the MAC address and how is it related to NIC?
什么是 MAC 地址?它与 NIC 有什么关系?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62d8 | 官方: 否 | 付费: 否
答案:
MAC address is the Media Access Control address. It is a 48-bit or 64-bit unique identifier of devices in the network. It is also called the physical address embedded with Network Interface Card (NIC) used at the Data Link Layer. NIC is a hardware component in the networking device using which a device can connect to the network.
MAC 地址是媒体访问控制地址。它是网络中设备的 48 位或 64 位唯一标识符。它也被称为嵌入网卡(NIC)的物理地址,用于数据链路层。NIC 是网络设备中的硬件组件,设备通过它连接到网络。
661. What happens when you enter google.com in the web browser?
当你在网页浏览器中输入 google.com 时会发生什么?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62db | 官方: 否 | 付费: 否
答案:
Below are the steps that are being followed: - Check the browser cache first if the content is fresh and present in cache display the same.
以下是所遵循的步骤: - 首先检查浏览器缓存,如果内容新鲜且存在于缓存中,则直接显示相同内容。
- If not, the browser checks if the IP of the URL is present in the cache (browser and OS) if not then request the OS to do a DNS lookup using UDP to get the corresponding IP address of the URL from the DNS server to establish a new TCP connection.
- A new TCP connection is set between the browser and the server using three-way handshaking.
- An HTTP request is sent to the server using the TCP connection.
- The web servers running on the Servers handle the incoming HTTP request and send the HTTP response.
- The browser process the HTTP response sent by the server and may close the TCP connection or reuse the same for future requests.
- If the response data is cacheable then browsers cache the same.
Browser decodes the response and renders the content.
Conclusion结论
In today’s world, it is very hard to stay away from the Internet and that is what makes networking one of the most important interview topics. As of 2021 if we check the facts, there is a total of 1.3 million kilometers of submarine optical fiber cables set globally to connect the world to the Internet. These cables are more than enough to revolve around the earth more than 100 times.
在当今世界,很难远离互联网,这也是使网络成为最重要的面试主题之一的原因。截至 2021 年,根据事实统计,全球共有 130 万公里的海底光缆用来连接世界到互联网。这些光缆足以环绕地球 100 多次。
Resources
资源
Learn Coding
学习编程
How To Become Network Engineer
如何成为网络工程师
Network Engineer Salary
网络工程师薪资
Difference Between Hub and Switch
集线器和交换机之间的区别
662. What are Unicasting, Anycasting, Multicasting and Broadcasting?
什么是单播、任意播、组播和广播?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62de | 官方: 否 | 付费: 否
答案:
- Unicasting: If the message is sent to a single node from the source then it is known as unicasting. This is commonly used in networks to establish a new connection.
- Anycasting: If the message is sent to any of the nodes from the source then it is known as anycasting. It is mainly used to get the content from any of the servers in the Content Delivery System.
- Multicasting: If the message is sent to a subset of nodes from the source then it is known as multicasting. Used to send the same data to multiple receivers.
- Broadcasting: If the message is sent to all the nodes in a network from a source then it is known as broadcasting. DHCP and ARP in the local network use broadcasting.
663. What is the firewall?
什么是防火墙?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62e1 | 官方: 否 | 付费: 否
答案:
The firewall is a network security system that is used to monitor the incoming and outgoing traffic and blocks the same based on the firewall security policies. It acts as a wall between the internet (public network) and the networking devices (a private network). It is either a hardware device, software program, or a combination of both. It adds a layer of security to the network.
防火墙是一种网络安全系统,用于监控进出流量,并根据防火墙安全策略阻止相关流量。它充当互联网(公共网络)和网络设备(私有网络)之间的屏障。它可以是硬件设备、软件程序,或两者的组合。它为网络增加了一层安全性。
Firewall
防火墙
664. What is the difference between the ipconfig and the ifconfig?
ipconfig和ifconfig有什么区别?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62e4 | 官方: 否 | 付费: 否
答案:
| ipconfig | ifconfig |
|---|---|
| Internet Protocol Configuration | Interface Configuration |
| Command used in Microsoft operating systems to view and configure network interfaces 用于Microsoft操作系统中查看和配置网络接口的命令 | Command used in MAC, Linux, UNIX operating systems to view and configure network interfaces 用于MAC、Linux、UNIX操作系统中查看和配置网络接口的命令 |
| Used to get the TCP/IP summary and allows to changes the DHCP and DNS settings 用于获取TCP/IP摘要,并允许更改DHCP和DNS设置 |
665. Compare the hub vs switch
比较集线器和交换机
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62e7 | 官方: 否 | 付费: 否
答案:
| Hub | Switch |
|---|---|
| Operates at Physical Layer 在物理层工作 | Operates at Data Link Layer 在数据链路层工作 |
| Half-Duplex transmission mode 半双工传输模式 | Full-Duplex transmission mode 全双工传输模式 |
| Ethernet devices can be connectedsend 可以连接以太网设备 | LAN devices can be connected 可以连接局域网设备 |
| Less complex, less intelligent, and cheaper 不太复杂、不太智能且更便宜 | Intelligent and effective 智能且高效 |
| No software support for the administration 没有用于管理的软件支持 | Administration software support is present 存在管理软件支持 |
| Less speed up to 100 MBPS 速度较低,最高可达100 Mbps | Supports high speed in GBPS 支持千兆级别的高速 |
| Less efficient as there is no way to avoid collisions when more than one nodes sends the packets at the same time 效率较低,因为当多个节点同时发送数据包时无法避免冲突 | More efficient as the collisions can be avoided or reduced as compared to Hub 效率更高,因为与集线器相比,冲突可以避免或减少 |
666. What is a subnet?
什么是子网?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62ea | 官方: 否 | 付费: 否
答案:
A subnet is a network inside a network achieved by the process called subnetting which helps divide a network into subnets. It is used for getting a higher routing efficiency and enhances the security of the network. It reduces the time to extract the host address from the routing table.
子网是网络内部的网络,通过称为子网划分的过程实现,该过程有助于将网络划分为多个子网。它用于获得更高的路由效率并增强网络安全性。它减少了从路由表中提取主机地址的时间。
Subnet
子网
667. Differentiate the MAC address with the IP address
区分MAC地址和IP地址
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62ed | 官方: 否 | 付费: 否
答案:
The difference between MAC address and IP address are as follows:
MAC地址和IP地址的区别如下:
| MAC Address | IP Address |
|---|---|
| Media Access Control Address 媒体访问控制地址 | Internet Protocol Address 互联网协议地址 |
| 6 or 8-byte hexadecimal number 6或8字节的十六进制数 | 4 (IPv4) or 16 (IPv6) Byte address 4(IPv4)或16(IPv6)字节地址 |
| It is embedded with NIC 嵌入在NIC中 | It is obtained from the network 从网络获取 |
| Physical Address 物理地址 | Logical Address 逻辑地址 |
| Operates at Data Link Layer 在数据链路层工作 | Operates at Network Layer. 在网络层工作 |
| Helps to identify the device 有助于识别设备 | Helps to identify the device connectivity on the network. 有助于识别设备在网络上的连接状态 |
668. What is the FTP protocol?
什么是FTP协议?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62f0 | 官方: 否 | 付费: 否
答案:
FTP is a File Transfer Protocol. It is an application layer protocol used to transfer files and data reliably and efficiently between hosts. It can also be used to download files from remote servers to your computer. It uses port 27 by default.
FTP是文件传输协议。它是一种应用层协议,用于在主机之间可靠高效地传输文件和数据。它也可以用于从远程服务器下载文件到你的计算机。它默认使用端口27。
669. What is the ARP protocol?
什么是ARP协议?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62f4 | 官方: 否 | 付费: 否
答案:
ARP is Address Resolution Protocol. It is a network-level protocol used to convert the logical address i.e. IP address to the device's physical address i.e. MAC address. It can also be used to get the MAC address of devices when they are trying to communicate over the local network.
ARP是地址解析协议。它是一种网络层协议,用于将逻辑地址(即IP地址)转换为设备的物理地址(即MAC地址)。当设备尝试在本地网络上通信时,它也可以用于获取设备的MAC地址。
ARP Protocol
ARP协议
670. What do you mean by the DHCP Protocol?
DHCP协议是什么意思?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62fa | 官方: 否 | 付费: 否
答案:
DHCP is the Dynamic Host Configuration Protocol.
DHCP是动态主机配置协议。
It is an application layer protocol used to auto-configure devices on IP networks enabling them to use the TCP and UDP-based protocols. The DHCP servers auto-assign the IPs and other network configurations to the devices individually which enables them to communicate over the IP network. It helps to get the subnet mask, IP address and helps to resolve the DNS. It uses port 67 by default.
它是一种应用层协议,用于在IP网络上自动配置设备,使其能够使用基于TCP和UDP的协议。DHCP服务器自动为每台设备分配IP地址和其他网络配置,使它们能够在IP网络上通信。它有助于获取子网掩码、IP地址,并帮助解析DNS。它默认使用端口67。
671. What is the ICMP protocol?
什么是ICMP协议?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb62fd | 官方: 否 | 付费: 否
答案:
ICMP is the Internet Control Message Protocol. It is a network layer protocol used for error handling. It is mainly used by network devices like routers for diagnosing the network connection issues and crucial for error reporting and testing if the data is reaching the preferred destination in time. It uses port 7 by default.
ICMP是互联网控制报文协议。它是一种用于错误处理的网络层协议。它主要由路由器等网络设备用于诊断网络连接问题,对于错误报告以及测试数据是否及时到达目标地址至关重要。它默认使用端口7。
672. Compare between TCP and UDP
比较TCP和UDP
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6300 | 官方: 否 | 付费: 否
答案:
| TCP/IP | UDP |
|---|---|
| Connection-Oriented Protocol 面向连接的协议 | Connectionless Protocol 无连接协议 |
| More Reliable 更可靠 | Less Reliable 不太可靠 |
| Slower Transmission 传输速度较慢 | Faster Transmission 传输速度较快 |
| Packets order can be preserved or can be rearranged 数据包顺序可以保留或重新排列 | Packets order is not fixed and packets are independent of each other 数据包顺序不固定,且各数据包相互独立 |
| Uses three ways handshake model for connection 使用三次握手模型进行连接 | No handshake for establishing the connection 建立连接无需握手 |
| TCP packets are heavy-weight TCP数据包较重 | UDP packets are light-weight UDP数据包较轻 |
| Offers error checking mechanism 提供错误检查机制 | No error checking mechanism 无错误检查机制 |
| Protocols like HTTP, FTP, Telnet, SMTP, HTTPS, etc use TCP at the transport layer HTTP、FTP、Telnet、SMTP、HTTPS等协议在传输层使用TCP | Protocols like DNS, RIP, SNMP, RTP, BOOTP, TFTP, NIP, etc use UDP at the transport layer DNS、RIP、SNMP、RTP、BOOTP、TFTP、NIP等协议在传输层使用UDP |
TCP VS UDP
TCP对比UDP
673. What is the UDP protocol?
什么是UDP协议?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6303 | 官方: 否 | 付费: 否
答案:
UDP is the User Datagram Protocol and is based on Datagrams. Mainly, it is used for multicasting and broadcasting. Its functionality is almost the same as TCP/IP Protocol except for the three ways of handshaking and error checking. It uses a simple transmission without any hand-shaking which makes it less reliable.
UDP是用户数据报协议,基于数据报。它主要用于组播和广播。其功能几乎与TCP/IP协议相同,但除了三次握手和错误检查之外。它使用无需任何握手的简单传输,这使得它不太可靠。
674. What is the TCP protocol?
什么是TCP协议?
- 知识点: 操作系统与网络 (主题: networking;标签: interviewbit, networking, topic-specific)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37bfb58d557c902bb6306 | 官方: 否 | 付费: 否
答案:
TCP or TCP/IP is the Transmission Control Protocol/Internet Protocol. It is a set of rules that decides how a computer connects to the Internet and how to transmit the data over the network. It creates a virtual network when more than one computer is connected to the network and uses the three ways handshake model to establish the connection which makes it more reliable.
TCP或TCP/IP是传输控制协议/互联网协议。它是一组规则,决定了计算机如何连接到互联网以及如何在网络上传输数据。当多台计算机连接到网络时,它会创建一个虚拟网络,并使用三次握手模型来建立连接,这使其更加可靠。
675. What is Kernel and write its main functions?
什么是内核,并写出其主要功能?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: coding
- 分类: fullstack
- id: 69b37c0658d557c902bb6a08 | 官方: 否 | 付费: 否
答案:
The kernel is basically a computer program usually considered as a central component or module of OS. It is responsible for handling, managing, and controlling all operations of computer systems and hardware. Whenever the system starts, the kernel is loaded first and remains in the main memory. It also acts as an interface between user applications and hardware.
内核基本上是一个计算机程序,通常被认为是操作系统的中央组件或模块。它负责处理、管理和控制计算机系统和硬件的所有操作。每当系统启动时,内核首先被加载并保留在主内存中。它还在用户应用程序和硬件之间充当接口。
Functions of Kernel: - It is responsible for managing all computer resources such as CPU, memory, files, processes, etc.
内核的功能:- 它负责管理所有计算机资源,如CPU、内存、文件、进程等。
- It facilitates or initiates the interaction between components of hardware and software.
- It manages RAM memory so that all running processes and programs can work effectively and efficiently.
- It also controls and manages all primary tasks of the OS as well as manages access and use of various peripherals connected to the computer.
- It schedules the work done by the CPU so that the work of each user is executed as efficiently as possible.
676. What do you mean by Semaphore in OS? Why is it used?
在操作系统中,信号量是什么意思?为什么使用它?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a0b | 官方: 否 | 付费: 否
答案:
Semaphore is a synchronization mechanism that is used to control access to shared resources in multi-threaded or multi-process systems. It maintains a count of available resources and provides two atomic operations: wait() and signal() . It can have a count greater than one, allowing it to control access to a finite pool of resources.
信号量是一种同步机制,用于控制多线程或多进程系统中对共享资源的访问。它维护可用资源的计数,并提供两个原子操作:wait() 和 signal()。它的计数可以大于一,从而允许它控制对有限资源池的访问。
Types of Semaphores
信号量的类型
There are two main types of semaphores: - Binary semaphore: A binary semaphore is a synchronization object that can only have two values: 0 and 1. It is used to signal the availability of a single resource, such as a shared memory location or a file.
信号量主要有两种类型:- 二进制信号量:二进制信号量是一种同步对象,只能有两个值:0和1。它用于表示单个资源的可用性,例如共享内存位置或文件。
Counting semaphore: A counting semaphore is a synchronization object that can have a value greater than 1. It is used to control access to a finite number of resources, such as a pool of database connections or a limited number of threads.
Binary Semaphore
二进制信号量Mutex
互斥锁It allows a process to signal the availability of a shared resource by setting the semaphore value to 1, and blocking other processes until the resource becomes available.
它允许进程通过将信号量值设置为1来表示共享资源的可用性,并阻止其他进程直到资源可用。It allows mutual exclusion by ensuring that only one thread can acquire a lock on the shared resource at a time.
它通过确保同一时间只有一个线程能获取共享资源的锁来实现互斥。Its functions are based on signalling mechanisms.
其功能基于信号机制。Its functions are based upon a locking mechanism.
其功能基于锁定机制。Binary semaphores can be faster than mutex in certain scenarios, such as when multiple processes need to access a shared resource and the semaphore count is greater than one.
在某些场景下,二进制信号量可能比互斥锁更快,例如当多个进程需要访问共享资源且信号量计数大于一时。Mutex can be slower than binary semaphore in certain scenarios, such as when the mutex has heavily contended and there is a high frequency of lock and unlock operations.
在某些场景下,互斥锁可能比二进制信号量慢,例如当互斥锁竞争激烈且锁和解锁操作频率较高时。It is basically an integer variable that can hold either 0 or 1.
它基本上是一个可持有0或1的整数变量。It is basically an object that can hold a lock state and additional information, such as the owner of the lock and the number of threads waiting for the lock.
它基本上是一个可持有锁状态和附加信息的对象,例如锁的所有者和等待锁的线程数。
677. What are different types of Kernel?
内核有哪些不同类型?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a0e | 官方: 否 | 付费: 否
答案:
There are basically five types of Kernels as given below: - Monolithic Kernel
基本上有以下五种内核类型:- 单体内核
- MicroKernel
- Hybrid Kernel
- Nano Kernel
- Exo Kernel
678. Write difference between micro kernel and monolithic kernel?
写出微内核和单体内核之间的区别?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a11 | 官方: 否 | 付费: 否
答案:
MicroKernel : It is a minimal OS that executes only important functions of OS. It only contains a near-minimum number of features and functions that are required to implement OS. Example: QNX, Mac OS X, K42, etc. Monolithic Kernel: It is an OS architecture that supports all basic features of computer components such as resource management, memory, file, etc. Example: Solaris, DOS, OpenVMS, Linux, etc.
微内核:它是一种极简操作系统,只执行操作系统的重要功能。它仅包含实现操作系统所需的最少特性和功能。示例:QNX、Mac OS X、K42等。单体内核:它是一种操作系统架构,支持计算机组件的所有基本功能,如资源管理、内存、文件等。示例:Solaris、DOS、OpenVMS、Linux等。
| MicroKernel 微内核 | Monolithic Kernel 单体内核 |
|---|---|
| In this software or program, kernel services and user services are present in different address spaces. 在此软件或程序中,内核服务用户服务位于不同的地址空间。 | In this software or program, kernel services and user services are usually present in the same address space. 在此软件或程序中,内核服务和用户服务通常位于相同的地址空间。 |
| It is smaller in size as compared to the monolithic kernel. 与单体内核相比,其体积较小。 | It is larger in size as compared to a microkernel. 与微内核相比,其体积较大。 |
| It is easily extendible as compared to a monolithic kernel. 与单体内核相比,它更容易扩展。 | It is hard to as extend as compared to a microkernel. 与微内核相比,它难以扩展。 |
| If a service crashes, it does affect on working of the microkernel. 如果某个服务崩溃,它不会影响微内核的运行。 | If a service crashes, the whole system crashes in a monolithic kernel. 如果某个服务崩溃,整个系统在单体内核中也会崩溃。 |
| It uses message queues to achieve inter-process communication. 它使用消息队列来实现进程间通信。 | It uses signals and sockets to achieve inter-process communication. 它使用信号和套接字来实现进程间通信。 |
679. What is SMP (Symmetric Multiprocessing)?
什么是SMP(对称多处理)?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a14 | 官方: 否 | 付费: 否
答案:
SMP is generally referred to as computer architecture in which the processing of programs is done by multiple processors that share a common OS and memory. SMP is very much required if you want to take advantage of multiprocessor hardware. It simply enables any processor to work on any of the tasks no matter where data or resources for that particular task are located in memory. These systems are more reliable than single-processor systems.
SMP通常指的是计算机架构,其中程序的处理由多个处理器完成,这些处理器共享一个操作系统和内存。如果你想利用多处理器硬件,SMP是非常必要的。它只需让任何处理器处理任何任务,无论该任务的数据或资源在内存中的位置如何。这些系统比单处理器系统更可靠。
680. What is a time-sharing system?
什么是分时系统?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a17 | 官方: 否 | 付费: 否
答案:
It is a system that allows more than one user to access the resources of a particular system in many locations. In simple words, it performs multiple tasks on a single processor or CPU. As the name suggests, it means to share time into multiple slots in several processes. It also allows different users from different locations to use a particular computer system at the same time therefore it is considered one of the important types of OS.
它是一种允许多个用户在许多位置访问特定系统资源的系统。简而言之,它在单个处理器或CPU上执行多个任务。顾名思义,它意味着将时间共享到多个进程的时间片中。它还允许不同位置的不同用户同时使用特定的计算机系统,因此它被认为是操作系统的重要类型之一。
681. What is Context Switching?
什么是上下文切换?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a1b | 官方: 否 | 付费: 否
答案:
Context switching is basically a process of saving the context of one process and loading the context of another process. It is one of the cost-effective and time-saving measures executed by CPU the because it allows multiple processes to share a single CPU. Therefore, it is considered an important part of a modern OS. This technique is used by OS to switch a process from one state to another i.e., from running state to ready state. It also allows a single CPU to handle and control various different processes or threads without even the need for additional resources.
上下文切换基本上是保存一个进程的上下文并加载另一个进程的上下文的过程。它是CPU执行的一种经济且节省时间的措施,因为它允许多个进程共享单个CPU。因此,它被认为是现代操作系统的重要组成部分。操作系统使用此技术将进程从一个状态切换到另一个状态,即从运行状态到就绪状态。它还允许单个CPU处理和控制在不需要额外资源的情况下各种不同的进程或线程。
682. What is difference between Kernel and OS?
内核和操作系统之间有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a1e | 官方: 否 | 付费: 否
答案:
Kernel: Kernel is a system program that controls all programs running on the computer. The kernel is basically a bridge between the software and hardware of the system. Operating System: Operating system is a system program that runs on the computer to provide an interface to the computer user so that they can easily operate on the computer.
内核:内核是一个系统程序,控制计算机上运行的所有程序。内核基本上是系统软件和硬件之间的桥梁。操作系统:操作系统是一个系统程序,在计算机上运行,为计算机用户提供接口,使他们可以轻松操作计算机。
| Kernel 内核 | OS 操作系统 |
|---|---|
| It is considered a central component of OS 它被视为操作系统的核心组件 | It is considered system software. 它被视为系统软件。 |
| It is generally responsible for converting user commands into machine-level commands. 它通常负责将用户命令转换为机器级命令。 | It is generally responsible for managing the resources of system. 它通常负责管理系统资源。 |
| It simply acts as an interface between hardware and applications. 它只是充当硬件和应用之间的接口。 | It simply acts as an interface between hardware and user. 它只是充当硬件和用户之间的接口。 |
| It also performs functions like process management, file management, device management, I/O communication, etc. 它还执行诸如进程管理、文件管理、设备管理、I/O通信等功能。 | It also performs functions like providing security to data and files in the the system, providing access controls to users, maintaining the system privacy, etc. 它还执行诸如保护系统中数据和文件的安全、为用户提供访问控制、维护系统隐私等功能。 |
| Its type includes Microkernel, Monolithic kernel, etc. 其类型包括微内核、单体内核等。 | Its type includes Single and Multiprogramming batch systems, Distributed OS, Real-time OS. 其类型包括单道和多道程序批处理系统、分布式操作系统、实时操作系统。 |
683. What is difference between process and thread?
进程和线程有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 / 行为与软技能 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: behavioral | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a21 | 官方: 否 | 付费: 否
答案:
Process: It is basically a program that is currently under execution by one or more threads. It is a very important part of the modern-day OS. Thread: It is a path of execution that is composed of the program counter, thread id, stack, and set of registers within the process.
进程:基本上是由一个或多个线程当前正在执行的程序。它是现代操作系统非常重要的组成部分。线程:它是进程内的执行路径,由程序计数器、线程ID、栈和一组寄存器组成。
| Process 进程 | Thread 线程 |
|---|---|
| It is a computer program that is under execution. 它是正在执行的计算机程序。 | It is the component or entity of the process that is the smallest execution unit. 它是进程的组成部分或实体,是最小的执行单元。 |
| These are heavy-weight operators. 它们是重量级操作。 | These are lightweight operators. 它们是轻量级操作。 |
| It has its own memory space. 它有自己的内存空间。 | It uses the memory of the process they belong to. 它使用其所属进程的内存。 |
| It is more difficult to create a process as compared to creating a thread. 与创建线程相比,创建进程更困难。 | It is easier to create a thread as compared to creating a process. 与创建进程相比,创建线程更容易。 |
| It requires more resources as compared to thread. 与线程相比,它需要更多资源。 | It requires fewer resources as compared to processes. 与进程相比,它需要更少资源。 |
| It takes more time to create and terminate a process as compared to a thread. 与线程相比,创建和终止进程需要更多时间。 | It takes less time to create and terminate a thread as compared to a process. 与进程相比,创建和终止线程需要更少时间。 |
| It usually run-in separate memory space. 它通常在独立的内存空间中运行。 | It usually run-in shared memory space. 它通常在共享内存空间中运行。 |
| It does not share data. 它不共享数据。 | It shares data with each other. 它相互共享数据。 |
| It can be divided into multiple threads. 它可以分为多个线程。 | It can’t be further subdivided. 它不能进一步细分。 |
684. What are various sections of the process?
进程的各种部分是什么?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a24 | 官方: 否 | 付费: 否
答案:
There are basically four sections in the process as given below:
进程基本上有四个部分,如下所示:
- Stack: It is used for local variables and returns addresses.
- Heap: It is used for dynamic memory allocation.
- Data: It stores global and static variables.
- Code or text: It comprises compiled program code.
685. What is a deadlock in OS? What are the necessary conditions for a deadlock?
操作系统中的死锁是什么?死锁的必要条件是什么?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a27 | 官方: 否 | 付费: 否
答案:
Deadlock is generally a situation where a set of processes are blocked as each process is holding resources and waits to acquire resources held by another process. In this situation, two or more processes simply try to execute simultaneously and wait for each to finish their execution because they are dependent on each other. We can see a hand problem in our system whenever a deadlock occurs in a program. It is one of the common problems you can see in multiprocessing. Necessary Conditions for Deadlock There are basically four necessary conditions for deadlock as given below: - Mutual Exclusion
死锁通常是一种情况,其中一组进程被阻塞,因为每个进程都持有资源并等待获取由另一个进程持有的资源。在这种情况下,两个或多个进程只是尝试同时执行,并互相等待对方完成执行,因为它们相互依赖。每当程序中出现死锁时,我们可以系统看到手头问题。这是在多处理中常见的常见问题之一。死锁的必要条件本质上如下所示四个必要条件:- 互斥
- Hold and Wait
- No Pre-emption
- Circular Wait or Resource Wait
686. What do you mean by Belady’s Anomaly?
Belady异常是什么意思?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a2a | 官方: 否 | 付费: 否
答案:
In the Operating System, process data is loaded in fixed-sized chunks and each chunk is referred to as a page. The processor loads these pages in the fixed-sized chunks of memory called frames. Belady’s Anomaly is a phenomenon in which if we increase the number of frames in memory, then the number of page faults also increases. It is generally experienced when we use FIFO (First in First out) page replacement algorithm.
在操作系统中,进程数据以固定大小的块加载,并且每个块被称为页面。处理器将这些页面加载到称为帧的固定大小内存块中。Belady异常是一种现象,如果增加内存中的帧数,则页面错误的数量也会增加。这通常在使用FIFO(先进先出)页面替换算法时遇到。
687. What is spooling in OS?
操作系统中的spooling是什么?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a2d | 官方: 否 | 付费: 否
答案:
Spooling simply stands for Simultaneous peripheral operations online. It is referred to as putting data of various I/O jobs in a buffer. Here, buffer means a special area in memory or hard disk that can be accessible to an I/O device. It is used for mediation between a computer application and a slow peripheral. It is very useful and important because devices access or acquire data at different rates. This operation also uses disk as a very large buffer and is capable of overlapping I/O operations for one task with processor operations for another task.
Spooling仅代表同时外围设备在线操作。它指的是将各种I/O作业的数据放入缓冲区。这里,缓冲区指的是内存或硬盘中可以由I/O设备访问的特殊区域。它用于计算机应用程序和慢速外围设备之间的调解。这非常有用和重要,因为设备以不同的速率访问或获取数据。此操作还使用磁盘作为非常大的缓冲区,并且能够将一个任务的I/O操作与另一个任务的处理器操作重叠。
Useful Resource - Free Operating System Certification Course
有用资源 - 免费操作系统认证课程
- Operating System MCQ
- Practice Coding
- InterviewBit Blog
- Components of Operating System
- Features of Operating System
- iOS Developer Interview Questions
688. What happens inside the OS when a process crashes unexpectedly?
当进程意外崩溃时,操作系统内部会发生什么?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a30 | 官方: 否 | 付费: 否
答案:
When a process crashes unexpectedly, the operating system performs a controlled cleanup to protect system stability.
当进程意外崩溃时,操作系统执行受控清理以保护系统稳定性。
Typically, the OS: - Detects the crash due to an illegal operation, such as invalid memory access or division by zero
通常,操作系统:- 检测到由于非法操作(例如无效内存访问或除零)导致的崩溃
- Terminates the process and releases its allocated resources, including memory, file descriptors, and locks
- Update process tables and scheduling structures to remove the process
- May generate logs or a core dump for debugging purposes
689. How does an operating system ensure memory protection between processes?
操作系统如何确保进程之间的内存保护?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a33 | 官方: 否 | 付费: 否
答案:
An operating system ensures memory protection by giving each process its own virtual address space.
操作系统通过为每个进程提供自己的虚拟地址空间来确保内存保护。
Key mechanisms include: - Virtual memory, which prevents processes from accessing each other’s memory directly
关键机制包括:- 虚拟内存,它防止进程直接访问彼此的内存
- Page tables, which map virtual addresses to physical memory with access permissions
- Hardware support (MMU) to enforce read, write, and execute permissions
Kernel mode vs user mode, ensuring only the OS can access protected memory regions
These mechanisms ensure that a process cannot read or modify another process’s memory, improving system stability and security.这些机制确保进程无法读取或修改其他进程的内存,从而提高系统稳定性和安全性。
690. What is the difference between a hard link and a soft link?
硬链接和软链接有什么区别?
- 知识点: 操作系统与网络 / 算法与数据结构 (主题: os, cs-fundamentals;标签: interviewbit, operating-system, topic-specific, os, cs-fundamentals)
- 类型: technical | 难度: hard | 子类型: concept
- 分类: fullstack
- id: 69b37c0658d557c902bb6a36 | 官方: 否 | 付费: 否
答案:
A hard link is another directory entry that points to the same inode as the original file. Both names refer to the same data on disk, and the file exists as long as at least one hard link remains. Hard links cannot span across file systems and usually cannot be created for directories.
硬链接是指向原始文件相同inode的另一个目录条目。两个名称引用磁盘上的相同数据,只要至少一个硬链接存在,文件就存在。硬链接不能跨文件系统,通常也不能为目录创建。
A soft link (symbolic link) is a separate file that contains the path to another file. It has its own inode and can point to files across file systems or to directories. If the original file is deleted, the soft link becomes invalid.
软链接(符号链接)是一个独立文件,包含指向另一个文件的路径。它有自己的inode,可以跨文件系统指向文件或目录。如果原始文件被删除,软链接会失效。
评论