0
0
Intro to Computingfundamentals~15 mins

Process management (running programs) in Intro to Computing - Deep Dive

Choose your learning style9 modes available
Overview - Process management (running programs)
What is it?
Process management is how a computer runs programs by creating and controlling processes. A process is like a container that holds a running program and its data. The operating system manages these processes to make sure they run smoothly and share the computer's resources fairly. This helps your computer do many things at once without crashing.
Why it matters
Without process management, computers would struggle to run multiple programs at the same time. Programs could interfere with each other, causing errors or crashes. Process management ensures your apps run safely and efficiently, letting you browse the web, listen to music, and write documents all at once. It makes multitasking possible and keeps your computer stable.
Where it fits
Before learning process management, you should understand what a program is and basic computer hardware like CPU and memory. After this, you can learn about threads, multitasking, and how operating systems schedule tasks. Process management is a foundation for understanding how software and hardware work together.
Mental Model
Core Idea
A process is a running program managed by the operating system to share resources and keep tasks organized.
Think of it like...
Imagine a kitchen where each chef (process) has their own workspace and tools. The kitchen manager (operating system) assigns tasks, ensures chefs don’t use the same tools at once, and keeps the kitchen running smoothly.
┌───────────────┐
│   Operating   │
│    System     │
├───────────────┤
│  Process 1    │
│  (Program A)  │
├───────────────┤
│  Process 2    │
│  (Program B)  │
├───────────────┤
│  Process 3    │
│  (Program C)  │
└───────────────┘

Each process has its own memory and CPU time managed by the OS.
Build-Up - 7 Steps
1
FoundationWhat is a Process?
🤔
Concept: Introduce the idea of a process as a running instance of a program.
A program is a set of instructions saved on your computer, like a recipe. When you open a program, the computer creates a process, which is like a chef following that recipe in the kitchen. This process has its own space in memory and uses the CPU to do work.
Result
You understand that a process is a live, active program running on your computer.
Understanding that a process is more than just a program file helps you see how computers actually run software.
2
FoundationRole of the Operating System
🤔
Concept: Explain how the operating system manages processes.
The operating system (OS) is like the kitchen manager. It creates processes when you start programs, gives them CPU time, and manages their memory. It also stops processes when you close programs or when they finish their tasks.
Result
You see the OS as the controller that keeps all running programs organized and safe.
Knowing the OS manages processes helps you understand why your computer can run many programs at once without confusion.
3
IntermediateProcess States and Transitions
🤔Before reading on: do you think a process runs continuously from start to finish without stopping? Commit to yes or no.
Concept: Processes change states like ready, running, waiting, and terminated.
A process doesn’t just run nonstop. It can be ready (waiting to use CPU), running (actively using CPU), waiting (paused for input or resources), or terminated (finished). The OS switches processes between these states to share the CPU fairly.
Result
You understand that processes move through different states to allow multitasking.
Knowing process states explains how computers handle many tasks seemingly at the same time.
4
IntermediateProcess Control Block (PCB)
🤔Before reading on: do you think the OS remembers everything about a process in one place or scattered everywhere? Commit to one answer.
Concept: The OS keeps all important info about a process in a data structure called the PCB.
The Process Control Block stores details like process ID, state, CPU registers, memory info, and open files. When the OS switches between processes, it saves and loads this info to keep each process running correctly.
Result
You see how the OS tracks and manages each process efficiently.
Understanding the PCB reveals how the OS can pause and resume processes without losing progress.
5
IntermediateProcess Scheduling Basics
🤔Before reading on: do you think the CPU runs one process at a time or multiple simultaneously? Commit to your answer.
Concept: The OS schedules processes to share the CPU using time slices.
Since most CPUs can run only one process at a time, the OS quickly switches between processes, giving each a small time slice. This switching is so fast it looks like processes run at the same time.
Result
You understand how multitasking works through scheduling.
Knowing scheduling explains why your computer feels responsive even with many programs open.
6
AdvancedContext Switching Explained
🤔Before reading on: do you think switching between processes is instant or takes some time? Commit to your answer.
Concept: Context switching saves and restores process states to switch CPU control.
When the OS switches from one process to another, it saves the current process’s CPU state (registers, program counter) in its PCB, then loads the next process’s state. This is called context switching and takes some CPU time.
Result
You see the cost and complexity behind multitasking.
Understanding context switching helps explain why too many processes can slow down a computer.
7
ExpertProcess Management in Modern Systems
🤔Before reading on: do you think all processes are equal in priority and resource needs? Commit to yes or no.
Concept: Modern OS use priorities, process groups, and security to manage processes.
Processes can have different priorities; some get more CPU time. Processes can be grouped for easier control. The OS also isolates processes for security, preventing one from crashing or spying on another. Advanced features include process creation, termination, and inter-process communication.
Result
You understand the sophisticated controls behind process management in real computers.
Knowing these details prepares you for understanding system performance and security.
Under the Hood
The OS kernel maintains a table of all processes, each with a PCB storing its state and resources. The CPU executes instructions from the currently running process. When a timer interrupt occurs, the OS saves the current process state, selects the next process to run based on scheduling algorithms, and loads its state. Memory management units ensure each process accesses only its own memory space, preventing interference.
Why designed this way?
Process management was designed to allow multiple programs to run safely and efficiently on limited hardware. Early computers ran one program at a time, wasting resources. By managing processes with PCBs and scheduling, the OS maximizes CPU use and protects processes from each other. Alternatives like running all code in one space were unsafe and inefficient.
┌─────────────────────────────┐
│        Timer Interrupt       │
└─────────────┬───────────────┘
              │
      ┌───────▼────────┐
      │ Save Current    │
      │ Process State   │
      └───────┬────────┘
              │
      ┌───────▼────────┐
      │ Scheduler      │
      │ Select Next    │
      │ Process        │
      └───────┬────────┘
              │
      ┌───────▼────────┐
      │ Load Next      │
      │ Process State  │
      └───────┬────────┘
              │
      ┌───────▼────────┐
      │ CPU Executes   │
      │ Instructions   │
      └────────────────┘
Myth Busters - 4 Common Misconceptions
Quick: Does a process always run on the CPU continuously until it finishes? Commit to yes or no.
Common Belief:A process runs nonstop on the CPU until it finishes its task.
Tap to reveal reality
Reality:Processes run in time slices and often wait for input or resources, so they are paused and resumed many times.
Why it matters:Believing processes run nonstop can confuse learners about multitasking and why computers switch tasks rapidly.
Quick: Do all processes share the same memory space? Commit to yes or no.
Common Belief:All processes share the same memory, so they can easily access each other's data.
Tap to reveal reality
Reality:Each process has its own separate memory space to prevent interference and increase security.
Why it matters:Thinking memory is shared can lead to misunderstanding security and stability in operating systems.
Quick: Is context switching free and instant? Commit to yes or no.
Common Belief:Switching between processes happens instantly without any cost.
Tap to reveal reality
Reality:Context switching takes time and CPU resources, which can slow down the system if done too often.
Why it matters:Ignoring the cost of context switching can lead to inefficient program design and poor system performance.
Quick: Can a process directly control the CPU without the OS? Commit to yes or no.
Common Belief:A process can directly control the CPU whenever it wants.
Tap to reveal reality
Reality:Only the OS controls the CPU; processes must request CPU time through the OS scheduler.
Why it matters:Believing processes control the CPU directly ignores the OS’s role and can confuse how multitasking works.
Expert Zone
1
Some processes are 'zombie' processes that have finished but still hold system resources until the parent process cleans them up.
2
Real-time operating systems use different scheduling algorithms to guarantee timing, unlike general-purpose OS which focus on fairness.
3
Process priorities can be dynamically adjusted by the OS based on behavior, such as increasing priority for interactive processes.
When NOT to use
Process management concepts apply to multitasking OS environments. In embedded systems with single dedicated tasks, simpler task management or bare-metal programming without full process management is used.
Production Patterns
In production, process management includes monitoring process health, restarting crashed processes automatically, isolating critical services in containers, and using process groups for coordinated control and resource limits.
Connections
Thread management
Builds-on
Understanding processes helps grasp threads, which are smaller units of execution within a process sharing memory but managed separately.
Project management
Analogous pattern
Just like process management schedules and allocates resources to tasks, project management schedules work and resources among team members to meet deadlines.
Traffic control systems
Similar control mechanism
Process scheduling is like traffic lights controlling cars at intersections to avoid collisions and keep traffic flowing smoothly.
Common Pitfalls
#1Assuming processes share memory freely and trying to access another process’s data directly.
Wrong approach:Process A tries to read variables directly from Process B's memory space.
Correct approach:Use inter-process communication methods like pipes or sockets to exchange data safely.
Root cause:Misunderstanding that each process has isolated memory for security and stability.
#2Creating too many processes without limits, causing system slowdown.
Wrong approach:Starting hundreds of processes simultaneously without managing resource use.
Correct approach:Limit the number of concurrent processes and use process pools or queues.
Root cause:Not realizing context switching and resource allocation have costs that affect performance.
#3Ignoring process states and assuming a process is always running once started.
Wrong approach:Writing code that expects a process to complete immediately without waiting or checking status.
Correct approach:Check process states and handle waiting or termination properly in code.
Root cause:Lack of understanding of process lifecycle and OS scheduling.
Key Takeaways
A process is a running program instance managed by the operating system to share CPU and memory safely.
The OS uses process states and scheduling to allow multitasking, making many programs appear to run simultaneously.
Process Control Blocks store all important information about processes, enabling the OS to pause and resume them efficiently.
Context switching is the mechanism that switches CPU control between processes but comes with a performance cost.
Modern process management includes priorities, security isolation, and grouping to handle complex real-world computing needs.