This document provides information about processes, process scheduling, inter-process communication, and common Linux commands for managing processes.
It discusses key process concepts like the process control block, process states, and context switching. Process scheduling methods and queues are described. Inter-process communication allows cooperating processes to share data through shared memory or message passing.
Common Linux commands for viewing and managing processes are also summarized, including ps, wait, sleep, exit, and kill. These commands allow viewing running processes, waiting for a process to finish, pausing execution, exiting the shell, and terminating processes.
This document provides information about processes, process scheduling, inter-process communication, and common Linux commands for managing processes.
It discusses key process concepts like the process control block, process states, and context switching. Process scheduling methods and queues are described. Inter-process communication allows cooperating processes to share data through shared memory or message passing.
Common Linux commands for viewing and managing processes are also summarized, including ps, wait, sleep, exit, and kill. These commands allow viewing running processes, waiting for a process to finish, pausing execution, exiting the shell, and terminating processes.
A program which is scheduled or running is a Process Scheduling is responsible for selecting
process. a processor process based on a scheduling method as well as removing a processor A program is passive entity until the OS wraps process. it into a Process. Every process once ready is stored into a Main memory & dispatched to the Scheduling Queues processor to execute the instructions.
Process States
Schedulers
Process Control Block
Context Switch
1. PCB is Data structure
2. Stores information about the Process 1. Storing & Restoring State of the 3. Every process has a PCB which is process controlled by the OS 2. Helps to share CPU among the 4. It is stored inside the OS Memory numerous Processes Space. 3. Information that is stored a. Program counter b. Base and limit register value Operating Systems Unit 03
c. Scheduling information ii. Non-Blocking Receive
d. Currently used register 3.4 e. I/O State information f. Changed state Threads g. Accounting information Thread is a basic unit of execution. A process 3.3 can have multiple threads executing at a time. Inter-Process Communication Thread Comprises of Introduction: 1. Thread ID 2. Program Counter A system can have two types of processes i.e. 3. Register Set independent or cooperating. Cooperating 4. Stack processes affect each other and may share data and information among themselves. Shares Interprocess Communication or IPC provides a 1. Code section mechanism to exachange data and information 2. Data section across multiple processes, which might be on 3. Other OS resources single or multiple computers connected by a network. Benefits
1. Shared Memory IPC: 1. Process can perform multiple tasks
a. Shares Memory space at a time between two coordinating 2. Responsiveness: user can interact processes with application even if it’s b. Forms a Buffer inside the working with passive task Share memory 3. Resource Sharing: Threads can c. Processes has to work share memory & other resources concurrently acquired by the parent process. d. Types of Buffers 4. Economy: It’s more economical to i. Bounded Buffers context switch or store thread (Fixed Size buffers) than the process. ii. Unbounded Buffer 5. Utilization of Multiprocessor (No limit) architecture 2. Message Passing IPC: Types of threads a. Send & Receive are two services provided by the 1. User threads: Supported above operating system the kernel & are managed without b. Mailbox is situated into the kernel support. kernel space 2. Kernel Threads: Supported and c. We send message to the managed by the operating system. mailbox which later received Models by the recipient d. There are 2 types of Send: 1. Many to one model: i. Blocking send a. Maps Many users threads ii. Non Blocking Send to one kernel thread e. There are 2 types of receive: b. Efficient to manage in i. Blocking Receive users space Operating Systems Unit 03
c. Entire process blocks if TTY is the type of terminal where current
process makes blocking command is running system call Option Function d. Can not use ps -ef / -aux List currently multiprocessors running process in 2. One to One model full format a. One user thread mapped ps -ax List currently to one kernel thread running process b. Provides more ps -u <username> List process for concurrency that the specific user many to one model ps -C <command> List process for given c. It does not stop the command process even if the ps -p <PID> List process with blocking system call is given PID made by any of the thread. d. Parallelism wait e. Creating user thread requires to create kernel wait is used to wait for a specific process & thread when exits it returns exit status to this process. f. It has overhead to create wait process_id kernel thread so performance is low. sleep: 3. Many to Many model a. Many user threads are Linux sleep command lets the terminal wait by mapped to many kernel the specified amount of time. By default, it thread takes time in seconds. But, we can set the delay b. No. of Kernel threads are time in minutes (m), hours (h), and days (d). It specific to application or helps in pausing the execution of any particular machine. command for a fixed amount of time c. Developers can create as sleep NUMBER[SUFFIX] many as user threads that are necessary without 1. s – second caring about kernel thread 2. m – minute d. When a user thread 3. h – hour performs blocking system 4. d – day call kernel can schedule exit: another thread to run. exit command in linux is used to exit the shell 3.5 where it is currently running. It takes one more Execute Process Commands parameter as [N] and exits the shell with a return of status N. If n is not provided, then it Process Status Command simply returns the status of last command that `ps` is executed.