AKTU OS Unit 2: Concurrent Processes

Interactive Learning Platform

Core Concepts & Definitions

Interactive Flashcards

Card 1 of 12

Concurrency

The ability of an OS to execute multiple processes simultaneously, either through interleaving on a single CPU or in parallel on multiple CPUs.

Process Memory Layout

Stack

Local variables, function parameters

Heap

Dynamic memory allocation

Data Section

Global and static variables

Text Section

Program code (instructions)

Process Control Block (PCB)

  • Process State
  • Process ID (PID)
  • Program Counter
  • CPU Registers
  • CPU Scheduling Info
  • Memory Management Info
  • I/O Status Info

Concurrency Challenges

Race Condition: count++ Example

Process 1
LOAD count (5)
INCREMENT (6)
STORE count
Process 2
LOAD count (5)
INCREMENT (6)
STORE count
Shared Variable: count = 5

Critical Section Problem Simulator

Process Configuration

Violations Detected:

Peterson's Algorithm Visualizer

Process P0

flag[0] = true
turn = 1
while(flag[1] && turn==1)
/* CRITICAL SECTION */
flag[0] = false

Process P1

flag[1] = true
turn = 0
while(flag[0] && turn==0)
/* CRITICAL SECTION */
flag[1] = false

Shared Variables

flag[0]: false
flag[1]: false
turn: 0

Synchronization Algorithm Visualizer

Test-and-Set Lock Simulator

TestAndSet() Operation

boolean TestAndSet(boolean *target) {
    boolean original = *target;
    *target = true;
    return original;
}
                        
Lock: FREE

Performance Analysis

CPU Cycles Wasted (Spinning): 0
Context Switches: 0

Semaphore Operations Interactive Lab

Semaphore Configuration

Semaphore State

Value: 1

Waiting Queue

Process Operations

Operation Log

Classical Problems Interactive Lab

Producer-Consumer Problem

Bounded Buffer

mutex: 1
empty: 3
full: 0
Producer: Ready
Consumer: Ready

Dining Philosophers Problem

P0 P1 P2 P3 P4
P0: THINKING
P1: THINKING
P2: THINKING
P3: THINKING
P4: THINKING
Deadlocks Detected: 0
Avg Eating Time: 0ms

Sleeping Barber Problem

Barber Chair
💤 Sleeping

Waiting Chairs (0/3)

Empty
Empty
Empty
customers: 0
barber: 0
mutex: 1
Customer Arrival Rate:

AKTU Exam Prep Center

Inter-Process Communication Models

Feature Shared Memory Message Passing
Speed Very Fast Slower
Kernel Involvement Minimal High
Synchronization Manual Built-in
Ease of Use Complex Simple

Choose the Best IPC Model

Scenario: High-frequency data exchange between processes on the same machine

AKTU Question Generator

Your Progress

Semaphores
75%
Classical Problems
60%
Critical Section
85%

Smart Revision Notes