Logo

dev-resources.site

for different kinds of informations.

Understanding Process Management in Operating Systems

Published at
1/14/2025
Categories
ios
android
operatingsystem
core
Author
arjun98k
Categories
4 categories in total
ios
open
android
open
operatingsystem
open
core
open
Author
8 person written this
arjun98k
open
Understanding Process Management in Operating Systems

Day 2: Understanding Process Management in Operating Systems

Date: January 14, 2025

Process management is a core function of operating systems, ensuring that multiple tasks can execute efficiently and effectively on a system. Whether you're learning for academic purposes, professional development, or interview preparation, mastering this concept is essential.


Goals for the Day

  1. Understand what a process is and its lifecycle.
  2. Learn how the OS manages processes.
  3. Explore concepts like scheduling, inter-process communication (IPC), and threads.

Topics to Cover

What is a Process?

A process is a program in execution. It includes the program code, its current activity, and the resources it uses (CPU, memory, files, etc.).

  • Examples of processes:
    • A browser running multiple tabs.
    • A text editor opened for document editing.
    • Background system tasks like indexing.

Process Lifecycle

A process goes through multiple states during its lifetime. These states include:

  1. New: The process is being created.
  2. Ready: The process is prepared to execute but is waiting for CPU allocation.
  3. Running: The process is currently being executed.
  4. Blocked: The process is waiting for an event (e.g., I/O completion).
  5. Terminated: The process has completed execution.

Diagram of Process Lifecycle:

New β†’ Ready β†’ Running β†’ Terminated  
       ↓        β†˜  
     Blocked ← β†–
Enter fullscreen mode Exit fullscreen mode

Process Scheduling

Scheduling determines the order in which processes are executed by the CPU.

Types of Scheduling:

  1. Long-term scheduling: Decides which processes are admitted into the system for processing.
  2. Medium-term scheduling: Temporarily removes processes from memory to manage the system load (swapping).
  3. Short-term scheduling: Determines which process gets CPU time next.

CPU Scheduling Algorithms:

  1. First-Come, First-Served (FCFS): Executes processes in the order they arrive.
  2. Shortest Job Next (SJN): Executes the shortest process first.
  3. Round-Robin (RR): Each process gets a fixed time slice in a cyclic order.
  4. Priority Scheduling: Executes processes based on their priority.

Inter-Process Communication (IPC)

Processes often need to communicate with one another. IPC mechanisms enable this interaction.

Common IPC Mechanisms:

  1. Pipes: Unidirectional communication between two processes.
  2. Message Queues: Message-based communication.
  3. Shared Memory: Processes share a portion of memory for faster communication.
  4. Sockets: Used for communication between processes over a network.

Threads

A thread is the smallest unit of execution within a process. A single process can have multiple threads running concurrently, sharing the same memory space.

Advantages of Threads:

  1. Faster context switching compared to processes.
  2. Better resource utilization.
  3. Enables multitasking within a single application (e.g., a browser downloading files while rendering web pages).

Multithreading Models:

  1. User-level Threads: Managed by user-space libraries.
  2. Kernel-level Threads: Managed directly by the operating system.

Activities

1. Read/Watch

  • Read about process management in textbooks like Operating System Concepts by Silberschatz or Modern Operating Systems by Tanenbaum.
  • Watch videos on YouTube explaining CPU scheduling and process states.

2. Hands-On Practice

  • On Linux, use the following commands to explore process management:

    • ps: Displays currently running processes.
    • top or htop: Monitors system resource usage and active processes.
    • kill: Terminates a process by its ID.
    • nice/renice: Adjusts process priorities.
  • Practical Task:

    • Write a simple multithreaded program in Java or Python to understand how threads work.

Interview Preparation

Common Questions:

  1. What is the difference between a process and a thread?

    • A process is an independent executing program, while a thread is a lightweight subprocess within a process.
  2. Explain different CPU scheduling algorithms.

    • Describe FCFS, SJN, Round-Robin, and Priority Scheduling with examples.
  3. What is context switching?

    • It is the process of saving and restoring the state of a CPU to switch between processes or threads.

Outcome

By the end of Day 2, you should:

  • Understand how the OS manages processes and their lifecycle.
  • Be familiar with scheduling algorithms and their use cases.
  • Have practical experience with basic process and thread management commands or programs.

This knowledge sets the stage for Day 3, where we'll dive into memory management, another critical aspect of operating systems. Let me know if you want additional resources or examples!

core Article's
30 articles in total
Favicon
Understanding Process Management in Operating Systems
Favicon
Introduction to Operating Systems
Favicon
What is SignalR? A Real-Time Communication Framework for .NET
Favicon
[KOSD] Change of FromQuery Model Binding from .NET 6 to .NET8
Favicon
JDK, JVM, and JRE: The Three Musketeers of Java Development πŸ‡
Favicon
Optimizing Your Development Machine: How Many Cores and Threads Do You Need for Programming?
Favicon
ASP .NET Core Best Practices
Favicon
Build Scalable Blazor CRUD Apps in 30 Minutes with Azure SQL
Favicon
The Benefits of Having More Threads than Cores: Unlocking the Power of Multi-threading in Modern Computing
Favicon
Deep Dive ASP.NET Core Middleware : Part 1
Favicon
The Purpose of Computer Processors (CPUs) and How Multiple Cores Improve Speed and Performance
Favicon
Primitive Data Types in Java
Favicon
How I Build a Scratch Proxy Server Using Node.js
Favicon
Javascript Working Mechanism
Favicon
A Journey Into the World of Programming with First Core Java Program
Favicon
[KOSD] Learning from Issues: Troubleshooting Containerisation for .NET Worker Service
Favicon
CORE WEB VITAL ISSUE
Favicon
Migrate to TLS 1.2 for Azure Blob Storage
Favicon
Keyboard input in Node.js
Favicon
Criando sua primeira aplicação console em .net
Favicon
Enabling CORS in a .NET Core Server-Side Application
Favicon
Digital Image Processing Notes
Favicon
Top Benefits of Using Core App Dashboard
Favicon
Understanding JavaScript Execution Context β€” The Key to Efficient Code
Favicon
5 Interesting Things About Strings in Java
Favicon
πŸ”’ Introducing Serial Log and Metro Log: Simplifying Your Logging Experience In .NET MAUI! πŸ“πŸš‡
Favicon
Understanding Core.js and Zone.js: Key to JavaScript Libraries
Favicon
Apitable.com Net6 Rest Api
Favicon
Custom resolve handler in Microsoft's ServiceProvider (enabling property injection)
Favicon
ASP.NET CORE REACT APP: System.InvalidOperationException: SPA default page middleware failed to return default page /index.html

Featured ones: