add-ch3
add-ch3
• Examples of Processes:
• When you launch a web browser, the system creates a
process to execute the browser's code.
• Running a terminal command (e.g., ls or dir) starts a new
process to execute that command.
• System processes like System Idle Process or explorer.exe in
Windows ensure smooth background operations like
managing file systems or handling user interfaces.
Example:
Features of Processes
Process in OS
1. Scheduling
3. Process State
image
Example fork() in Unix/Linux
image
Type of CPU Register
• Types of CPU Registers*
• Program Counter (PC): The Program Counter keeps track of
the memory address of the next instruction to be fetched
and executed.
• Instruction Register (IR): The Instruction Register holds the
currently fetched instruction being executed.
• Accumulator (ACC): The Accumulator is a general-purpose
register used for arithmetic and logical operations. It stores
intermediate results during calculations.
*Depending on the CPUs architecture and design, the type and number of registers can vary.
Common types of registers found in a CPU may include:
Type of CPU Register
• Types of CPU Registers
• General-Purpose Registers (R0, R1, R2…): These registers are used to store data during calculations
and data manipulation. They can be accessed and utilized by the programmer for various purposes.
• Address Registers (AR): Address Registers store memory addresses for data access or for transferring
data between different memory locations.
• Stack Pointer (SP): The Stack Pointer points to the top of the stack, which is a region of memory used
for temporary storage during function calls and other operations.
• Data Registers (DR): These registers store data fetched from memory or obtained from input/output
operations.
• Status Register/Flags Register (SR): The Status Register or Flags Register contains individual bits that
indicate the outcome of operations, such as carry, overflow, zero result, and others. These flags help in
making decisions and controlling program flow based on the results of previous operations.
• Control Registers (CR): Control Registers manage various control settings and parameters related to
the CPU's operation, such as interrupt handling, memory management, and system configuration.
image
Process Control Block (PCB)
4. CPU Scheduling Information
• This section of the PCB contains data relevant to how
the process is scheduled for execution by the CPU.
• Components:
• Priority: A numerical value indicating the process's
priority level. Higher values may indicate higher priority.
• Scheduling Queue Pointers: Pointers to other PCBs in the
scheduling queues (such as ready, waiting, etc.) that help
the scheduler manage the process's state efficiently.
Process Control Block (PCB)
5. Memory-Management Information
• It holds information related to memory allocation for the process.
• Contents:
• Base Register: Indicates the starting physical address where the
process's memory segment is located.
• Limit Register: Specifies the size of the process's memory segment
to prevent it from accessing memory allocated to other processes.
• Page Tables: If the system uses virtual memory, this information
can include page tables that map virtual addresses to physical
addresses.
Process Control Block (PCB)
6. Accounting Information
• This contains various statistics about the process's resource usage.
• Contents:
• CPU Used: The total CPU time consumed by the process.
• Clock Time Elapsed: The real time that has passed since the process
started.
• Time Limits: Maximum allowed execution time for the process, which
can be enforced by the operating syste
Process Control Block (PCB)
7. I/O Status Information
• This section contains information about I/O devices allocated to the
process and its interactions with files.
• Contents:
• Allocated I/O Devices: A list of devices (e.g., printers, disk drives)
currently assigned to the process.
• List of Open Files: A list of files that the process is currently using,
along with their file descriptors.