UNIT 2 – CT2 Notes
1. Process Concept
A process is a program in execution. It has a program counter, stack, data section, and resources.
Represented by PCB (Process Control Block) which stores process ID, state, registers, scheduling
info.
States: New, Ready, Running, Waiting, Terminated.
2. Process Scheduling
Scheduling decides execution order of processes.
- Long-term: Controls multiprogramming level.
- Medium-term: Suspends/resumes processes.
- Short-term: Chooses process for CPU.
Algorithms: FCFS, SJF, Priority, Round Robin.
3. Operations on Processes
Process creation using fork() or CreateProcess(), termination when process finishes or is killed.
Parent-child relationships; parent can wait for child.
4. Interprocess Communication (IPC)
Exchange of data between processes.
- Message Passing: send() and receive()
- Shared Memory: Processes share memory for communication.
5. Communication in Client–Server Systems
Client requests services, server responds. Uses sockets, RPC, pipes.
6. Threads
Thread is a lightweight process; shares memory but has its own stack.
Improves concurrency and responsiveness.
7. Multicore Programming
Programs use multiple CPU cores for parallelism. Needs synchronization.
8. Multithreading Models
- Many-to-One: Many user threads → one kernel thread.
- One-to-One: Each user thread → one kernel thread.
- Many-to-Many: Many user threads → many kernel threads.
9. Thread Libraries
APIs for thread creation & management. Examples: Pthreads, Java Threads, Windows Threads.
10. Implicit Threading
Threads managed by compiler/runtime. Examples: Thread Pools, OpenMP, Fork-Join.
11. Threading Issues
Thread cancellation, signal handling, fork/join issues.
12. Process Synchronization
Controls access to shared data; avoids race conditions.
13. Critical-Section Problem
Critical section is where shared resources accessed.
Solution must ensure mutual exclusion, progress, bounded waiting.
14. Peterson’s Solution
Software algorithm for 2 processes using flag[] and turn variables. Avoids busy waiting.
15. Synchronization Hardware
Hardware instructions Test-and-Set, Swap provide atomic operations.
16. Mutex Locks
A mutex is a lock for mutual exclusion. acquire() and release() functions.