Skip to content

AEiE0705 Operating System and process management

Evolution and types of OS

  • Operating system manages hardware resources and provides services to programs and users.
  • Historical styles include batch systems, multiprogramming systems, time-sharing systems, real-time systems, distributed systems, and embedded systems.

Components, structure, and services

Aspect Examples
Components Process manager, memory manager, file system, I/O manager, security manager
Structures Monolithic, layered, microkernel, modular
Services Program execution, I/O, file access, communication, protection, error detection

Process concepts

  • A process is a program in execution.
  • Process description includes program counter, registers, state, address space, and allocated resources.
  • PCB stores process control information.

Process states and control

Common states:

  • New.
  • Ready.
  • Running.
  • Waiting or blocked.
  • Terminated.

Scheduler moves processes among states; dispatcher hands CPU to selected ready process.

Process control includes creation, termination, blocking, wake-up, suspension/resumption, and context switching. A context switch saves one process's CPU state in its PCB and restores another's state.

Threads

  • A thread is a lightweight execution unit within a process.
  • Threads of one process share code, data, and resources, but each thread has its own program counter, registers, and stack.

Mandatory distinction:

  • Process is a resource-owning execution environment.
  • Thread is a schedulable execution path inside a process.

User-to-kernel thread mappings:

Model Mapping
Many-to-one many user threads share one kernel thread
One-to-one each user thread maps to a kernel thread
Many-to-many many user threads are multiplexed over a smaller or equal number of kernel threads

Scheduling types

Type Cue
Long-term scheduling Selects jobs for system admission
Short-term scheduling Selects next ready process for CPU
Medium-term scheduling Swapping-related suspension decisions

Common policies:

  • FCFS.
  • SJF.
  • Priority scheduling.
  • Round robin.

Round-robin cue:

  • Time quantum is the distinguishing feature.

Principles of concurrency

  • Concurrency means multiple execution flows overlap in time.
  • A critical region or critical section is code accessing shared data that must not be concurrently entered unsafely.
  • Race condition occurs when outcome depends on uncontrolled execution order.
  • Mutual exclusion ensures only one execution flow enters a critical section at a time.

Synchronization tools and cues

  • Locks or mutexes provide mutual exclusion.
  • Semaphores can count resource availability or act as binary synchronization primitives.
  • Monitors combine mutual exclusion with condition synchronization in higher-level abstraction.

Process-and-concurrency examples

  1. If two threads increment a shared variable without protection, a race condition can occur.
  2. If many tasks share one CPU with time slicing, round robin is a common scheduling idea.
  3. If execution unit shares process memory but has its own stack, it is a thread.

AEiE0705 revision box

  • Process owns resources; thread is lighter execution path inside process.
  • PCB holds process management state.
  • Ready is not running; blocked is waiting for event.
  • Round robin is identified by time quantum.
  • Critical section, race condition, and mutual exclusion must be distinguished exactly.