0% found this document useful (0 votes)
5 views15 pages

OS Presentation

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views15 pages

OS Presentation

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Process Management in

Linux Systems
By-
Suyog Patil, N202
Somshekhar Tripathi, N211
Introduction

 In Linux operating systems, process management plays a critical role in


ensuring efficient system performance and resource allocation.

 This presentation covers key concepts in Linux process management,


including how processes are created using system calls like fork() and
exec(), how Linux handles process identity, environments, and context, and
how resources like memory and file systems are managed.
Process Creation (fork and exec)

• fork(): Creates a new process (child) which is a copy of the parent process.
• exec(): Replaces the current process image with a new program image.
• Fork and exec are separate operations in Linux, providing flexibility.
Process Identity

 • Process ID (PID): Unique identifier for each process.


 • Credentials: User ID and group IDs for resource access.
 • Namespace: Each process has a unique view of the file system.
Process Environment

 The environment of a process includes variables that provide runtime


configurations and instructions for process behavior.

 Argument vector (argv[]): Contains the list of arguments passed to the program,
such as command-line inputs.

 Environment vector (envp[]): Contains key-value pairs of environment


variables.

Important environment variables:


 PATH: Lists directories where executables are searched.
 HOME: Specifies the home directory of the user.
 LANG: Determines the language/locale for the process.
 TERM: Defines the type of terminal in use.
Process Context

 - The process context defines the current state of a running program.


 - It includes the scheduling context, file table, signal-handler table, and virtual
memory context.

 Detailed Components:
 - Scheduling Context: Holds register states, priorities, and signals.
 - File Table: Tracks files open by the process using file descriptors.
 - Signal-handler Table: Defines actions to be taken for specific signals.
 - Virtual Memory Context: Manages memory access, allocation, and separation
between processes.
Scheduling Context

 - The scheduling context includes:


 - Register states: Stores the CPU registers for the current process.
 - Priority: Determines the order in which processes are scheduled.
 - Signals: Tracks signals sent to the process.
 - Also contains the kernel stack, which stores data for system calls
and interrupts.
File Table and File-System
Context

 - File Table: Each process maintains a file table, keeping track of all
open files.
 - Uses file descriptors as references to open files.

 - File-System Context:
 - Defines the root directory for the process.
 - Tracks the current working directory.
 - Contains the namespace, isolating a process's view of the system.
Signal Handling

 - Signals: A form of inter-process communication, allowing processes to


notify or interrupt each other.
 - Processes maintain a signal-handler table to determine how to react to
specific signals (e.g., terminate, ignore, or handle using a custom function).

 - Common signals:
 - SIGINT: Interrupt from the keyboard (Ctrl + C).
 - SIGTERM: Termination signal.
 - SIGKILL: Forces process termination, cannot be ignored.
Virtual Memory Context

 - Each process is assigned its own virtual memory space, which is


managed separately from other processes.

 - Virtual memory:
 - Enables efficient memory use through paging and segmentation.
 - Prevents one process from accessing another's memory, ensuring
security.
Processes and Threads

• Linux uses the clone() system call to create threads.

• Threads share resources like file-system info, memory space, signal


handlers, and file descriptors.

• No strict distinction between processes and threads in Linux.


fork() vs. clone()

 • fork(): Creates a new process with separate resources.


 • clone(): Creates threads that can share resources between parent and child
processes.
Key Advantages of Linux Process Model

 Flexibility in process and thread creation.


 Efficient resource sharing and management through clone().
 Strong isolation with separate process identity and memory contexts.
Conclusion

 Process management in Linux is highly flexible and efficient.


 Supports robust multiprocessing through fork and exec.
 The clone system call enhances the threading capabilities.
THANK YOU!

You might also like