- Difference between Process and Thread
- Both are for the fundamental units of execution in computing, but different ways
- Process : instance of program, has its own memory space, OS controls communication between processes, IPC
- Thread : a sub-unit of process. shares memory & resources with process. Needs less resources to operate. (reasons to do multi-thread programming)
- What is context switching?
- A fundamental feature of OS, allowing a single CPU to handle multiple process/thread efficiently by switching between them
- context = state of current process / thread, includes current register values, data, etc.
- saved state is stored in process control block
- It is essential for multitasking, but it comes with overhead.
- What is ‘Thread-safe’?
- multi-threading environment without data corruption or unpredictable behavior such as deadlock, race condition
- usually, occur, because, try, access, same resource at once
- mutexes, semaphores are tools for make thread-safe.
- 교착상태와 기아상태의 해결방법
- Prevent deadlock by controlling the sequence of process & allocating resource
- Starvation : Aging(give the chance to a process that didn’t get chance to be served), Fairness(make fair policies)
- 가상 메모리
- memory management technique
- use storage such as HDD or SSD as a temporary space
- To make space, the system may swap out other pages back and forth.
- benefits : increased app concurrency, increase of attainable memory space