OS 面试题

2017-09-27  本文已影响147人  Zihowe

Operating System

进程和线程有什么区别
Both processes and threads are independent sequences of execution. The typical difference is that threads (of the same process) run in a shared memory space, while processes run in separate memory spaces.

A process has a virtual address space, executable code and at least one thread of execution. Each process is started with a single thread, often called the primary thread, but can create additional threads from any of its threads.

A thread is an entity within a process that can be scheduled for execution. All threads of a process share its virtual address space and system resources

什么是锁mutex

MUTEX 互斥锁 mutual exclusion
是一个mechanism,防止出现race-condition。
在多线程编程中, 我们防止两条线程对同一个资源进行modify的机制。

Threads within a given process share the same memory space. It enables threads to share data, which can be valuable. However, it also creates the opportunity for issues when two thread modifies a resource at the same time.

我们要求一个critical section只能有一个线程进入。

Deadlock

a deadlock is a situation where a thread is waiting for an object lock that another thread holds, and this second thread is waiting for an object lock that the first thread holds. Since each thread is waiting for the other thread to relinquish a lock, the both remain waiting forever.
The threads are said to be deadlocked.

Most deadlock prevention algorithms focus on avoiding the circular wait.

什么是信号量

什么是栈溢出

不同存储结构的速度量级(磁盘、SSD、内存、L1 cache)

什么是IO

References:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms681917(v=vs.85).aspxea

上一篇 下一篇

猜你喜欢

热点阅读