بطبط

رجع لباقي المحاضرات
محاضرة 5

Process Management and Deadlock Handling

Dual-Mode Operation, process management, and handling deadlocks.

يلا نشوف الملخص

Lecture 5: OS Operations, Process Management, and Deadlock

1. Dual-Mode Operation

  • Purpose: To protect the system by separating user code from kernel code.
  • Modes:
    • Kernel Mode (Mode Bit = 0): The OS runs here, with full access to hardware and privileged instructions.
    • User Mode (Mode Bit = 1): User applications run here, with limited access for safety.
  • Transition: When a user program makes a System Call (requesting OS service) or an interrupt/trap occurs, the CPU switches from User Mode to Kernel Mode.
  • Timer: Used to prevent a single program from monopolizing the CPU by forcing an interrupt after a specific time slice expires, returning control to the OS.

2. Process Management

  • Process vs. Program: A Program is a passive entity (file on disk). A Process is an active entity (program in execution) that needs resources (CPU, memory, I/O).
  • Threading:
    • Single-threaded: One program counter, executing one instruction sequence at a time.
    • Multi-threaded: Multiple threads (sequences of execution) within the same process, allowing concurrent execution of different parts of the job.
  • Process Management Activities:
    1. Creating and Deleting Processes.
    2. Suspending and Resuming Processes (pausing and continuing).
    3. Process Synchronization (preventing interference on shared resources).
    4. Process Communication (safe data exchange between processes).
    5. Deadlock Handling.

3. Deadlock Handling

  • Deadlock Definition: A situation where two or more processes are stuck waiting indefinitely for resources held by each other.
  • Four Methods to Handle Deadlock:
    1. Deadlock Prevention: Design the system to ensure deadlocks can never occur.
    2. Deadlock Avoidance: Check resource requests ahead of time and only grant them if the system remains in a safe state.
    3. Deadlock Detection: Allow deadlocks to occur, use an algorithm to detect them, and then recover (e.g., terminating a process).
    4. Deadlock Ignorance: Ignore the problem completely (common in small OSs); if one occurs, the system must be restarted.

Audio Summary

0:000:00

في نقطة مش واضحة؟ بطبط موجود!

اسأل بطبط عنها