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