Module 2 - OS Processes

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/16

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

17 Terms

1
New cards

Process

  • is a program in execution.

  • program is a passive entity, whereas a process is an active entity.

  • The system consists of operating system processes (executing system code) and user processes (executing user code).

2
New cards

Characteristics of a Process

  • Multiple processes can be associated with the same program but are separate execution sequences.

  • Processes execute concurrently, sharing CPU time.

  • A process cycles between CPU execution (CPU burst) and I/O wait (I/O burst).

  • Execution begins with a CPU burst, followed by alternating I/O and CPU bursts, until termination.

3
New cards

CPU and I/O Burst

  • Processes typically have many short CPU bursts or fewer long CPU bursts.

  • I/O-bound processes have many short CPU bursts.

  • CPU-bound processes have fewer, longer CPU bursts.

4
New cards

Process Components

  • Program Code (instructions to be executed)

  • Process Stack (temporary data such as subroutine parameters, return addresses, local variables)

  • Data Section (global variables)

5
New cards

Process State Transitions

  1. New - Process creation stage.

  2. Running - Instructions are being executed.

  3. Waiting - Process is waiting for an event (e.g., I/O completion).

  4. Ready - Process is waiting for CPU allocation.

  5. Terminated - Process has completed execution.

6
New cards

Process State Diagram

  • Shows transitions between Ready, Running, and Waiting states.

  • Only one process runs at a time; others wait in Ready or Waiting states.

7
New cards

Process Control Block (PCB)

PCB Contents

  1. Process State - New, Ready, Running, Waiting, Terminated.

  2. Program Counter - Address of the next instruction.

  3. CPU Registers - Includes accumulators, stack pointers, etc.

  4. CPU Scheduling Information - Process priority and scheduling queues.

  5. Memory Management Information - Memory limits and page tables.

  6. Accounting Information - CPU time, process ID, resource usage.

  7. I/O Status Information - I/O requests, allocated devices, open files.

8
New cards

Process Control Block (PCB)

Context Switching

  • When CPU switches from one process to another, it saves the state in the PCB and loads the next process's PCB.

9
New cards

Concurrent Processes

Process Creation

  • Processes create new processes via the create-process system call.

  • Parent Process creates Child Processes.

  • Child may inherit or obtain its own resources from the OS.

10
New cards

Concurrent Processes

Parent-Child Relationship

  • Parent may execute concurrently with its children.

  • Parent may wait for child termination before resuming.

11
New cards

Concurrent Processes

Process Termination

  • A process terminates by issuing an exit system call.

  • Parent may terminate a child if:

    1. Child exceeds resource usage limits.

    2. Task assigned to the child is no longer required.

    3. Parent terminates, leading to cascading termination of child processes.

12
New cards

Concurrent Processes

Independent vs. Cooperating Processes

  1. Independent Processes

    • Execution is deterministic (depends only on input state).

    • Execution is reproducible.

    • Can be stopped and restarted without side effects.

  2. Cooperating Processes

    • Execution is nondeterministic (depends on execution sequence of other processes).

    • Requires synchronization and communication mechanisms.

13
New cards

Scheduling Concepts

Goals

  • Maximize CPU utilization by keeping processes running at all times.

  • Increase throughput (work completed per unit time).

14
New cards

Scheduling Concepts

Process Scheduling

  • Job Queue - Holds all processes in the system.

  • Ready Queue - Holds processes in main memory waiting for CPU time.

  • Device Queue - Holds processes waiting for I/O devices.

  • Linked List Representation - Ready queue is implemented as a linked list of PCBs.

15
New cards

Scheduling Concepts

Process Scheduling Diagram

  • Processes transition between Ready, Running, and Waiting states.

  • Scheduling ensures CPU is always occupied.

16
New cards

Scheduling Concepts

Scheduling Events

  1. Process issues an I/O request and moves to the I/O queue.

  2. Process creates a new subprocess and waits for it to terminate.

  3. Process is interrupted and moves back to the Ready queue.

17
New cards

Summary

  • A process is an executing program that undergoes state transitions.

  • Processes are managed using a PCB, which stores execution details.

  • Concurrent execution requires synchronization and resource management.

  • Scheduling ensures CPU efficiency through process queues and transitions.