Process Management in Operating System

Process management means the OS controls these processes and gives them resources like CPU time and memory so they can run properly without disturbing each other.

Process in OS

An operating system (OS) manages all the programs running on a computer. When a program is running, it is called a process.

Resource in OS

A resource is anything required by a process to execute.

  • CPU time
  • Main memory (RAM)
  • Cache memory
  • Secondary storage (HDD, SSD)
  • Input devices (keyboard, mouse, scanner)
  • Output devices (monitor, printer, speakers)

Process Life Cycle

A process has 3 main stages:

1. Creation

A process starts when you open a program. The OS loads it into memory and gives it resources.

Example: When you open MS Word or Chrome, the process starts.

2. Execution

The process is working and doing its job.

Example: Chrome loads websites, plays videos, and responds when you click.

3. Termination

The process ends when you close the program. The OS removes it from memory and frees resources.

Example: When you close Chrome, it stops and memory is cleared.

Full Example (Chrome)

  • Creation: Click Chrome icon โ†’ OS opens it
  • Execution: Browse websites
  • Termination: Close Chrome โ†’ OS stops it

Multitasking and Concurrency

Modern computers are designed to handle multiple tasks at the same time. This helps users work smoothly without waiting for one task to finish before starting another.

Multitasking

Multitasking means using more than one program at the same time.

Examples:

  • Listening to music ๐ŸŽต while browsing the internet ๐ŸŒ
  • Writing a document ๐Ÿ“„ while downloading a file โฌ‡๏ธ
  • Watching a video ๐ŸŽฌ while chatting on WhatsApp ๐Ÿ’ฌ
  • Playing a game ๐ŸŽฎ while music is running in background ๐ŸŽง

All feel like they are running together.

Concurrency

Concurrency means the CPU does not do everything at once. It quickly switches between tasks, so all tasks keep moving forward.

Examples:

Chef Example:

  • cooks rice for a short time
  • then checks curry
  • then prepares salad
  • keeps switching quickly

Computer Example:

  • CPU runs Chrome for a short time
  • then switches to music player
  • then switches to file download
  • keeps rotating very fast

Phone Example:

  • WhatsApp running in background ๐Ÿ’ฌ
  • Music playing ๐ŸŽต
  • Instagram loading posts ๐Ÿ“ฑ
  • System switches between them quickly

So it looks like all tasks are running at the same time.

Process Scheduling Concepts

The CPU cannot run all processes at once, so the OS decides:

  • Which process goes first
  • How long each process runs

This is called scheduling.

FCFS (First Come, First Served)

The first process that arrives is done first. Others wait their turn.

Example:

Like a line in a shop:

  • First person in line is served first
  • Then second, third, and so on

Advantages:

  • Very simple
  • Easy to understand
  • No process is skipped

Disadvantages:

  • Small tasks may wait too long if big tasks are ahead
  • This is called the convoy effect
  • If one process takes too long, overall system performance feels slow

Memory

Memory is where the computer stores data and instructions so the CPU can work fast.

Primary Memory (RAM)

RAM is the main working memory of a computer. It is very fast but temporary. Data is lost when power is off.

Example:

When you open a Word file, it is loaded into RAM so you can work on it quickly.

Virtual Memory

When RAM becomes full, the computer uses storage (HDD/SSD) as extra memory. This is called virtual memory.

But:

  • It is slower than RAM

Simple idea:

Virtual memory = backup space for RAM

Example:

  • You open many apps at once
  • RAM gets full
  • The system moves less used apps to storage
  • This frees RAM for active apps

But those moved apps may become slower when you open them again.

Processes vs Threads

A process is a running program on a computer. Processes are independent, so one process crashing usually does not affect others.

Simple idea:

A process = a separate application running on your computer.

Example:

  • Google Chrome
  • MS Word
  • A game

All of these are separate processes.

Thread

A thread is a small part of a process.

A process can have many threads.

Threads share the same memory.

Each thread does a different job.

Simple idea:

Thread = a small worker inside a program.

Example (Web Browser)

One browser (process) has many threads:

  • One thread loads web pages ๐ŸŒ
  • One thread plays videos ๐ŸŽฅ
  • One thread downloads files โฌ‡๏ธ

So you can do many things at the same time without waiting.

Multithreading

Multithreading means one program uses multiple threads to do many tasks at the same time.

Each thread works independently but shares memory.

Simple idea:

One program โ†’ many small tasks running together.

Benefits of Multithreading

1. โšก Enhanced Performance

Multithreading improves system performance by running multiple threads at the same time, which reduces the time needed to complete tasks.

Example:

A video editing software processes audio and video at the same time, making the final output faster.

2. ๐ŸŽฏ Improved Responsiveness

Definition: It keeps applications responsive by running background tasks without stopping the main program.

Example:

In a web browser, you can scroll and use websites while a file is downloading in the background.

3. ๐Ÿ”„ Support for Concurrent/Parallel Operations

Definition: Multithreading allows multiple tasks to run at the same time within a program.

Example:

  • Video plays ๐ŸŽฅ
  • Comments load ๐Ÿ’ฌ
  • Recommendations update ๐Ÿ”„

4. โš™๏ธ Efficient Use of Resources

Definition: Multithreading uses CPU and memory in a better way by sharing resources between threads.

Example:

In a music app, you can play a song ๐ŸŽต and browse songs at the same time without opening two separate apps.

System Calls

A system call is a request made by a program to the operating system to perform a task that the program cannot directly do itself.

Simple idea:

A program asks the OS for help when it needs to use hardware.

Example:

When you save a file, the application uses a system call to ask the OS to write data to the hard drive or SSD.

Types of System Calls

1. open

Used to open a file for reading or writing.

Example: Opening a music file to play it ๐ŸŽต

2. read

Used to read data from a file or input device.

Example: Opening and reading a text document ๐Ÿ“„

3. write

Used to write or save data into a file or output device.

Example: Saving a photo or document on the computer ๐Ÿ–ผ๏ธ

4. fork

Used to create a new process by cloning an existing one.

Example: When you duplicate a browser tab, the system uses a fork to instantly copy the exact state of your current tab into a new process. ๐ŸŒ

File System Structure and Management

The operating system not only runs programs but also manages how data is stored and organized on storage devices.

A file system provides a proper structure so that files can be stored, located, and managed easily. It ensures data remains organized even when there are thousands of files.

Files

A file is a collection of related data stored on a computer. It is the basic unit of storage.

Files can contain:

  • text documents
  • images
  • audio
  • video
  • program instructions

Example:

A PDF document, a photo, or a song are all files.

Folders

A folder (or directory) is used to organize files in a structured way.

It helps users group related files together so they are easier to find and manage.

Example:

A โ€œSchool Workโ€ folder may contain assignments, notes, and projects.

Metadata

Metadata is information about a file or folder. It does not contain the actual content, but describes the file.

It includes:

  • file name
  • file size
  • file type
  • creation date
  • last modified date

Example:

A photo file might show: Name: img.jpg, Size: 3 MB, Created: 1 June

File Systems

A file system is a method used by an operating system to store, organize, and manage files on storage devices such as HDD, SSD, or USB drives.

It decides where each file is stored and keeps track of its location so the file can be easily accessed when needed.

๐Ÿ’พ Common File Systems (with full forms)

FAT32 โ†’ File Allocation Table (32-bit)

Used in USB flash drives and memory cards due to its wide compatibility.

NTFS โ†’ New Technology File System

Used in Windows operating systems for better performance, security, and support for large files.

APFS โ†’ Apple File System

Used in modern macOS devices for fast and efficient storage, especially on SSDs.

EXT4 โ†’ Fourth Extended File System

Commonly used in Linux systems for its stability and performance.

Types of Operating Systems

Operating systems are designed based on the type of device and its purpose. Each type is optimized for specific tasks.

Real-Time Operating System (RTOS)

A Real-Time Operating System is designed to respond immediately to inputs within a strict time limit (deadline). Even a small delay can cause serious problems in such systems.

Key Feature: Very fast response with no delay in processing important tasks.

Used In:

  • Air traffic control systems โœˆ๏ธ
  • Heart monitoring devices โค๏ธ
  • Industrial robots ๐Ÿค–

Embedded Operating System (EOS)

An Embedded OS is a small operating system designed for a specific device or function. It is not for general use but is optimized for one main task.

Key Feature: Uses very low memory, power, and resources.

Used In:

  • Washing machines
  • Microwaves
  • Smart TVs
  • Printers
  • ATMs

Network Operating System (NOS)

A Network Operating System is used to manage multiple computers connected in a network. It allows users to share resources like files, printers, and internet connections.

Key Feature: Focuses on communication and sharing between computers.

Example: In a school computer lab, all computers are connected, students can save files on one central server, and all can use the same printer.

Mobile Operating System

A Mobile Operating System is designed for smartphones and tablets. It is optimized for touch screens, mobile apps, battery saving, and wireless communication.

Key Features:

  • Supports apps
  • Uses touch interface
  • Manages battery efficiently
  • Supports camera, GPS, and sensors

Used In:

  • Smartphones ๐Ÿ“ฑ
  • Tablets
  • Smartwatches โŒš

Multiple Choice Questions (MCQs) on Operating System

1. What is a process in an operating system?
a. A hardware device
b. A running program
c. A storage device
d. A file system
Answer: b. A running program
2. What does process management do?
a. Deletes programs automatically
b. Controls processes and allocates resources
c. Creates hardware devices
d. Formats storage drives
Answer: b. Controls processes and allocates resources
3. Which of the following is a resource in an OS?
a. CPU time
b. RAM
c. Keyboard
d. All of the above
Answer: d. All of the above
4. Which stage occurs when a program is first opened?
a. Termination
b. Execution
c. Creation
d. Scheduling
Answer: c. Creation
5. During execution, a process is:
a. Being deleted
b. Waiting forever
c. Performing its task
d. Stored permanently
Answer: c. Performing its task
6. What happens during process termination?
a. More memory is allocated
b. Process is loaded into RAM
c. Resources are freed
d. CPU speed increases
Answer: c. Resources are freed
7. Multitasking means:
a. Running one program only
b. Using multiple programs at the same time
c. Installing software
d. Formatting disks
Answer: b. Using multiple programs at the same time
8. Concurrency means:
a. CPU executes all tasks simultaneously
b. CPU quickly switches between tasks
c. Programs never share CPU time
d. Only one process exists
Answer: b. CPU quickly switches between tasks
9. Scheduling is used to decide:
a. File names
b. Network speed
c. Which process gets CPU time
d. Screen resolution
Answer: c. Which process gets CPU time
10. FCFS stands for:
a. First Come, First Served
b. Fast CPU First System
c. First CPU First Schedule
d. File Control First Service
Answer: a. First Come, First Served
11. A major advantage of FCFS is:
a. Complex implementation
b. Very simple scheduling
c. Highest performance always
d. No waiting time
Answer: b. Very simple scheduling
12. What is the convoy effect?
a. Memory corruption
b. Small processes wait behind long processes
c. Fast process execution
d. File deletion
Answer: b. Small processes wait behind long processes
13. RAM is:
a. Permanent memory
b. Main working memory
c. Secondary storage
d. Output device
Answer: b. Main working memory
14. Data in RAM is lost when:
a. Browser opens
b. Printer starts
c. Power is turned off
d. File is saved
Answer: c. Power is turned off
15. Virtual memory is:
a. Cache memory
b. Backup space for RAM using storage
c. CPU memory
d. BIOS memory
Answer: b. Backup space for RAM using storage
16. Virtual memory is generally:
a. Faster than RAM
b. Equal to RAM
c. Slower than RAM
d. Not used
Answer: c. Slower than RAM
17. A process is:
a. A running application
b. A folder
c. A keyboard
d. A file system
Answer: a. A running application
18. A thread is:
a. A storage device
b. A small unit inside a process
c. A file type
d. An operating system
Answer: b. A small unit inside a process
19. Threads within the same process:
a. Have separate memory always
b. Share memory
c. Cannot communicate
d. Use different CPUs only
Answer: b. Share memory
20. Multithreading means:
a. Multiple programs running
b. Multiple threads in one process
c. Multiple operating systems
d. Multiple hard drives
Answer: b. Multiple threads in one process
21. Which is a benefit of multithreading?
a. Reduced performance
b. Improved responsiveness
c. More hardware failures
d. Less resource sharing
Answer: b. Improved responsiveness
22. A system call is:
a. A hardware component
b. A request to the OS for services
c. A file format
d. A virus
Answer: b. A request to the OS for services
23. Which system call opens a file?
a. read
b. write
c. open
d. fork
Answer: c. open
24. Which system call reads data?
a. fork
b. open
c. read
d. create
Answer: c. read
25. Which system call saves data to a file?
a. write
b. read
c. fork
d. close
Answer: a. write
26. The fork system call is used to:
a. Delete files
b. Create a new process
c. Read memory
d. Shut down the system
Answer: b. Create a new process
27. A file is:
a. A collection of related data
b. A CPU component
c. An input device
d. A network cable
Answer: a. A collection of related data
28. A folder is used to:
a. Increase CPU speed
b. Organize files
c. Format RAM
d. Control hardware
Answer: b. Organize files
29. Metadata includes:
a. File name and size
b. CPU instructions
c. Screen brightness
d. Internet speed
Answer: a. File name and size
30. A file system is used to:
a. Manage and organize files
b. Create processors
c. Design monitors
d. Control power supply
Answer: a. Manage and organize files
31. FAT32 stands for:
a. Fast Access Table
b. File Allocation Table (32-bit)
c. File Access Technology
d. Fixed Allocation Table
Answer: b. File Allocation Table (32-bit)
32. NTFS stands for:
a. New Technology File System
b. Network Transfer File Service
c. New Transfer Format Standard
d. None of these
Answer: a. New Technology File System
33. APFS is mainly used in:
a. Linux
b. Windows
c. macOS
d. Android
Answer: c. macOS
34. EXT4 is commonly used in:
a. Linux
b. Windows
c. iOS
d. Printers
Answer: a. Linux
35. An RTOS is designed for:
a. Gaming only
b. Fast response within deadlines
c. Storing files
d. Social networking
Answer: b. Fast response within deadlines
36. Which device commonly uses an Embedded OS?
a. Washing machine
b. Server farm
c. Supercomputer only
d. Network switch only
Answer: a. Washing machine
37. A Network Operating System focuses on:
a. Gaming graphics
b. File and resource sharing
c. Video editing
d. Music playback
Answer: b. File and resource sharing
38. A Mobile Operating System is designed for:
a. Mainframes only
b. Smartphones and tablets
c. Industrial robots only
d. Servers only
Answer: b. Smartphones and tablets
39. Which feature is important in a mobile OS?
a. Touch interface
b. Battery management
c. App support
d. All of the above
Answer: d. All of the above
40. Which operating system type is used in heart monitoring devices?
a. Mobile OS
b. RTOS
c. NOS
d. APFS
Answer: b. RTOS

Test Yourself: Interactive MCQs (Operating System)

1. What is a process in an operating system?
2. What does process management do?
3. Which of the following is a resource in an OS?
4. Which stage occurs when a program is first opened?
5. During execution, a process is:
6. What happens during process termination?
7. Multitasking means:
8. Concurrency means:
9. Scheduling is used to decide:
10. FCFS stands for:
11. A major advantage of FCFS is:
12. What is the convoy effect?
13. RAM is:
14. Data in RAM is lost when:
15. Virtual memory is:
16. Virtual memory is generally:
17. A process is:
18. A thread is:
19. Threads within the same process:
20. Multithreading means:
21. Which is a benefit of multithreading?
22. A system call is:
23. Which system call opens a file?
24. Which system call reads data?
25. Which system call saves data to a file?
26. The fork system call is used to:
27. A file is:
28. A folder is used to:
29. Metadata includes:
30. A file system is used to:
31. FAT32 stands for:
32. NTFS stands for:
33. APFS is mainly used in:
34. EXT4 is commonly used in:
35. An RTOS is designed for:
36. Which device commonly uses an Embedded OS?
37. A Network Operating System focuses on:
38. A Mobile Operating System is designed for:
39. Which feature is important in a mobile OS?
40. Which operating system type is used in heart monitoring devices?

Lectures

FAQs

An Operating System is system software that manages computer hardware, software applications, and provides a user interface.

A process is a program that is currently running and using system resources like CPU and memory.

Process management is the function of the OS that handles creation, scheduling, and termination of processes.

Resources include CPU time, memory (RAM), storage, and input/output devices used by processes.

The stages are creation, execution, and termination.

The OS loads the program into memory and assigns required resources to it.

The process performs its tasks using CPU and memory.

The process ends and the OS frees all allocated resources.

Multitasking is the ability of an OS to run multiple programs at the same time.

Concurrency means the CPU switches rapidly between tasks so they appear to run simultaneously.

Process scheduling is the OS technique to decide which process gets CPU time and for how long.

FCFS (First Come, First Served) is a scheduling method where processes are executed in the order they arrive.

RAM is the main memory used by the computer to store data temporarily while programs are running.

Virtual memory is a part of storage used as extra RAM when the actual RAM is full.

A process is a running program, while a thread is a small unit of a process that performs specific tasks.

Multithreading is when a single process uses multiple threads to perform tasks simultaneously.

A system call is a request made by a program to the operating system to perform a specific task.

A file system is a method used by the OS to store, organize, and manage files on storage devices.

Metadata is information about a file such as name, size, type, and creation date.

An embedded operating system is designed for specific devices like washing machines and ATMs with limited resources.

Download Notes

Download PDF