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!

android Article's
30 articles in total
Favicon
Three Common Pitfalls in Modern Android Development
Favicon
Using SVGs on Canvas with Compose Multiplatform
Favicon
Kotlin Generics Simplified
Favicon
Understanding Process Management in Operating Systems
Favicon
Introduction to Operating Systems
Favicon
Why Should You Develop a Native Android App Over Flutter?
Favicon
Flutter Development for Low end PCs
Favicon
Day 13 of My Android Adventure: Crafting a Custom WishList App with Sir Denis Panjuta
Favicon
How to Integrate Stack, Bottom Tab, and Drawer Navigator in React Native
Favicon
Flutter Design Pattern Bussines Logic Component (BLOC)
Favicon
🌎 Seamless Multi-Language Support in React Native
Favicon
Morphing Geometric Shapes with SDF in GLSL Fragment Shaders and Visualization in Jetpack Compose
Favicon
FMWhatsApp - Enhanced WhatsApp Experience
Favicon
[Feedback Wanted]Meet Nora: A Desktop Plant Robot Companion 🌱
Favicon
GBWhatsApp - Advanced WhatsApp Alternative
Favicon
Android TreeView(Hierarchy based) with Kotlin
Favicon
The Role of Android in IoT Development
Favicon
PicsArt MOD APK: Unlock the Power of Creativity
Favicon
Getting Started with Android Testing: Building Reliable Apps with Confidence (Part 3/3)
Favicon
How to Integrate Stack and Bottom Tab Navigator in React Native
Favicon
Day 11 Unlocking the Magic of Location Services!
Favicon
Creating M3U Playlists for xPola Player
Favicon
xPola Player: The Advanced Media Player for Android
Favicon
Getting Started with Android Testing: Building Reliable Apps with Confidence (Part 2/3)
Favicon
How I wrote this technical post with Nebo: an Android gamechanger ✍️
Favicon
Understanding Room Database in Android: A Beginner's Guide
Favicon
hiya
Favicon
Android Lock Screen Widgets: Revolutionizing Content Consumption with Glance's Smart Features
Favicon
Top 10 Best Android App Development Companies in India
Favicon
Why Modded APKs Are Gaining Popularity in 2025: Understanding the Risks and Benefits

Featured ones: