What is Context Switch
- Context Switch : replace PCB inside the memory with other PCB.
- store Process A’s PCB
- load Process B’s PCB to memory from disk
- When system call is occured or interrupt, store Process B’s PCB
- load Process C’s PCB to memoery from disk
What is Shared resource and Critical section
Critical Section’s three features should be satisfied
- mutual exclusion : if process A run CS(Critical Section), other can not go into
- bounded waiting : Process should not wait indefinitely
- progress flexibility, progress : If there is no process in the CS, any process can enter and utilize the resource.
How to satisfy CS features
- Shared Resource : resource(Printer, specific memory location, files, data) that can be shared with other processes, threads.
- Critical Section : Areas that depend on the order of access. To solve with this problems, mutex, semaphore exist.
- mutex : before using critical section, first lock, after use, second release.
- semaphore : can access critical section with multiple users.
What is Deadlock
- Deadlock : A state in which two or more processes are stopped waiting for each other’s resources