OS 面試題

Operating System

進程和線程有什么區(qū)別
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,防止出現(xiàn)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.

什么是信號量

什么是棧溢出

不同存儲結(jié)構(gòu)的速度量級(磁盤、SSD、內(nèi)存、L1 cache)

什么是IO

References:

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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容