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!

ios Article's
30 articles in total
Favicon
Get More Exposure in App Store with In-App Events: A Guide for Expo and React Native
Favicon
How to Fetch URL Content, Set It into a Dictionary, and Extract Specific Keys in iOS Shortcuts
Favicon
Using SVGs on Canvas with Compose Multiplatform
Favicon
Understanding Process Management in Operating Systems
Favicon
Introduction to Operating Systems
Favicon
Building a Beautiful Login Screen in Flutter: A Complete Guide
Favicon
How to Integrate Stack, Bottom Tab, and Drawer Navigator in React Native
Favicon
🌎 Seamless Multi-Language Support in React Native
Favicon
How to Post Articles to Dev.to Using iOS Shortcuts
Favicon
Skip: Build Native iOS and Android Apps with a Single SwiftUI Codebase
Favicon
Understanding Passkeys: The Behind-the-Scenes Magic of Passwordless Authentication
Favicon
Handling PathAccessException in iOS for File Download
Favicon
[Feedback Wanted]Meet Nora: A Desktop Plant Robot Companion 🌱
Favicon
What Do All iOS Engineers Keep Forgetting?
Favicon
Mastering 4 way Infinite Scroll in SwiftUI!
Favicon
Unlock the Power of Cross-Platform Swift Development with Visual Studio Code
Favicon
How to Integrate Stack and Bottom Tab Navigator in React Native
Favicon
How to Save and Open PDFs in Files App with Shortcuts: Specify Path and Filename for Better Access
Favicon
Why iOS 18 is Perfect for Building Custom Business Apps in 2025?
Favicon
Kobiton vs.TestGrid: Real Device Testing Showdown
Favicon
iOS Background Modes: A Quick Guide
Favicon
Top Mobile App Development Company in Bangalore | Hyena IT
Favicon
Debugging in Xcode: Tips to Save Your Time 🛠️
Favicon
We are in Top 5 Flutter Of The Year Apps List
Favicon
Optimizing iOS App Performance
Favicon
iOS implements basic operations for slow playback of videos
Favicon
Functional Testing of a Loyalty-Based Crop Nutrition Mobile Application (iOS & Android)
Favicon
Parental Control Solutions: iOS VPNs for Family Safety
Favicon
Building Your First Flutter App in 10 Minutes
Favicon
The Ultimate Guide to iOS Development: Enum (Part 8)

Featured ones: