solution - Operating System : Process Management (Test 2)

Question : Which data structure stores process attributes in an operating system?

Solution :
391320260309081609 Correct Answer : Process Control Block

Description -

The correct answer is Process Control Block (PCB).

Key Details of a Process Control Block (PCB)

  • Definition: A PCB (also known as a task control block) is a kernel data structure that stores all information and attributes associated with a specific process.
  • Common Attributes Stored:
    • Process State: Tracks whether the process is running, ready, waiting, or terminated.
    • Program Counter: Holds the memory address of the next instruction to execute.
    • CPU Registers: Saves register contents during a context switch so the process can resume later.
    • Memory Management Information: Stores page tables, segment tables, or base and limit registers.
    • Accounting & I/O Information: Records CPU usage limits, process IDs (PIDs), and assigned I/O devices.

Question : Which attribute uniquely identifies a process in the system?

Solution :
290320260309081522 Correct Answer : Process ID

Description -

The correct attribute that uniquely identifies a process in the system is Process ID (PID).

Quick Breakdown:

  • Process ID (PID): A unique numerical identifier assigned by the operating system to every active process. No two processes running at the same time can share the same PID.
  • Program Counter: Stores the address of the next instruction to be executed by the process.
  • Process State: Indicates the current condition of the process (e.g., Ready, Running, Waiting).
  • Priority: Determines the execution order or urgency of the process relative to others.

Question : The program counter stores:

Solution :
657020260309081425 Correct Answer : Address of next instruction

Description -

The program counter stores the Address of next instruction.

Quick Breakdown

  • Program Counter (PC): A dedicated register in the CPU that contains the memory address of the very next instruction waiting to be fetched and executed. Once the current instruction is fetched, the PC automatically increments to point to the following instruction.
  • Process Priority & Process ID: These are part of the Process Control Block (PCB) managed by the operating system, not the hardware program counter.
  • Device Information: This is handled by device drivers and specialized configuration registers.

Question : Which attribute indicates the current condition of a process?

Solution :
342920260309081335 Correct Answer : Process State

Description -

The attribute that indicates the current condition of a process is Process State.

In operating systems, the process state (such as New, Ready, Running, Waiting, or Terminated) defines what the process is currently doing at any given moment.

Question : Which process attribute determines CPU allocation order?

Solution :
882120260309081240 Correct Answer : Priority

Description -

Priority is the process attribute that determines CPU allocation order.

In operating systems, the CPU scheduler uses the priority attribute of a process to decide which process gets allocated the CPU first (especially in priority-based scheduling algorithms), where higher-priority processes are executed before lower-priority ones.

Here is a quick breakdown of what the other components do:

  • Program counter: Tracks the address of the next instruction to be executed.
  • Registers: Store temporary data and processor state for the active process.
  • Files: A list of files opened by the process during its execution.

Question : Which attribute stores temporary data during execution?

Solution :
129820260309081150 Correct Answer : General-purpose registers

Description -

General-purpose registers store temporary data during execution.

Within the CPU, registers are high-speed storage locations used to quickly hold raw data, intermediate calculation results, and memory addresses currently being processed by the execution unit.

Here is a quick look at why the other options are incorrect:

  • Program counter: Stores the address of the next instruction to be executed, not general data.
  • Process ID: A unique numerical identifier assigned by the operating system to distinguish one process from another.
  • Device list: Tracks the hardware devices or I/O resources allocated to the process.

Question : The list of open files in PCB represents:

Solution :
861820260309081057 Correct Answer : Files currently used by the process

Description -

The list of open files in the PCB represents Files currently used by the process.

When a process opens a file, the operating system maintains a record of it in the Process Control Block (PCB). This allows the process to read from, write to, and track its current position within that file during its execution.

Here is why the other options do not fit:

  • Files stored in disk: This refers to the entire file system hierarchy on permanent storage, not just what a specific active process is tracking.
  • Files deleted by OS / Files created by OS: While the OS manages deletion and creation, the specific list in a PCB strictly tracks the active, open files currently allocated to that running process.

Question : Which attribute contains information about devices used by the process?

Solution :
296820260309081001 Correct Answer : Open device list

Description -

Open device list contains information about devices used by the process.

The Open device list (sometimes referred to as the I/O status information or allocated device list) in the Process Control Block (PCB) keeps track of all the hardware devices and I/O resources currently assigned to that specific process.

Here is a quick reminder of what the other options represent:

  • Process ID: The unique numerical identifier for the process.
  • Priority: The attribute used to determine CPU allocation order.
  • Stack: The memory area used to store local variables, function parameters, and return addresses.

Question : Process attributes together are also called:

Solution :
863220260309080713 Correct Answer : Process context

Description -

Process attributes together are also called Process context.

The Process context (often stored within the Process Control Block) encompasses the entire state of a process, including its CPU registers, program counter, memory management information, and open file lists. This context is what the operating system saves and restores during a context switch.

Here is what the other terms mean:

  • Process scheduling: The activity of deciding which process gets CPU time and when.
  • Process allocation: The assignment of system resources (like memory or hardware) to a process.
  • Process synchronization: The coordination of simultaneous processes to ensure they don't conflict when accessing shared resources.

Question : Which attribute helps resume process execution after interruption?

Solution :
221520260309080628 Correct Answer : Program counter

Description -

The correct answer is Program counter.

Why the Program Counter is Used

The program counter (PC) is a dedicated register stored within a Process Control Block (PCB). It contains the memory address of the next instruction to be executed in the process's instruction sequence.

When an operating system interrupts a running process (due to a time-slice expiration, I/O request, or hardware interrupt), it performs a context switch. During this switch, the OS saves the exact value of the program counter alongside other CPU registers. When the process is scheduled to run again, the OS reloads this saved address back into the CPU, allowing execution to safely resume exactly where it was interrupted.

Breakdown of Other Options

  • Device list / File list: These tracking attributes keep a record of the hardware resources and open files allocated to the process. They do not track execution progress.
  • Priority: This scheduling parameter determines the order or importance of a process when competing for CPU time, rather than its execution state.

Question : Which of the following is NOT a process attribute?

Solution :
669220260309080432 Correct Answer : Compiler code

Description -

The correct answer is Compiler code.

A process attribute is specific metadata that the operating system tracks and manages inside the Process Control Block (PCB) to control a process during execution.

  • Compiler code is the software logic belonging to the compiler program itself (which translates source code into machine code). While the compiled binary instructions of an application make up the "Text/Code" segment of a process memory, the compiler's own program code is completely external and not an attribute used by the OS kernel to track an active process.

Why the Other Options are Process Attributes

The operating system explicitly stores these attributes in the PCB:

  • Process ID (PID): A unique numeric identifier assigned by the OS to distinguish the process from all others.
  • Program counter: A register pointer containing the memory address of the next instruction the process will execute.
  • Process state: Indicates the current lifecycle stage of the process (such as New, Ready, Running, Waiting, or Terminated).

Question : Which process attribute contains information about CPU registers?

Solution :
807520260309080307 Correct Answer : Register set

Description -

The correct answer is Register set.

The register set (often referred to as the CPU register state or saved registers) is the specific attribute in the Process Control Block (PCB) that stores the architecture-dependent values of all CPU registers.

When a process is running, it heavily utilizes the CPU's hardware registers (such as accumulators, index registers, stack pointers, and general-purpose registers) to store temporary values and execution data. When an interruption or context switch occurs, the operating system must copy the values out of these physical hardware registers and save them into the process's register set in memory. When the process is scheduled to run again, these values are restored back to the CPU so it can continue operating with identical data.

Breakdown of Other Options

  • Process state: Tracks the high-level condition of the process (e.g., Running, Ready, Waiting), not the internal register data.
  • Program counter: While the program counter is technically a specific hardware register, it is tracked as its own distinct attribute in the PCB because it specifically points to the next instruction address. The broad "register set" handles the remaining architecture registers.
  • Device table: Manages information regarding the I/O devices currently assigned to the process.

Question : Which process state means the process is currently executing?

Solution :
178520260309080229 Correct Answer : Running

Description -

The correct answer is Running.

When a process is in the Running state, it means its compiled instructions are currently being loaded and executed by the physical CPU core(s).

Breakdown of the Other States

  • Ready: The process is fully prepared and waiting in memory to be assigned to a CPU by the operating system scheduler.
  • Waiting (or Blocked): The process cannot execute right now because it is waiting for an event to occur (such as user input, a file download, or an I/O operation to finish).
  • New: The process is currently being created or initialized by the operating system, but has not yet been admitted to the executable pool.

Question : Which process state indicates the process is waiting for CPU allocation?

Solution :
257320260309080044 Correct Answer : Ready

Description -

The correct answer is Ready.

When a process is in the Ready state, it has all the necessary resources it needs to run (it is loaded into memory and initialized) and is strictly waiting for the operating system scheduler to allocate CPU time to it.

Breakdown of the Other States

  • Running: The process has already been allocated CPU time and its instructions are actively executing.
  • Waiting (or Blocked): The process cannot use the CPU even if one is free. It is waiting for an external event or I/O operation (like a keystroke or file read) to complete first.
  • Exit (or Terminated): The process has finished executing or has been killed, and the operating system is releasing its resources.

Question : Which process attribute is used for scheduling decisions?

Solution :
349920260309075943 Correct Answer : Priority

Description -

The correct answer is Priority.

The operating system's CPU scheduler uses the priority attribute to decide which process in the Ready queue should get access to the CPU next. Processes with higher priority values are allocated CPU time ahead of lower-priority processes. This priority can be assigned statically (e.g., system tasks vs. user applications) or dynamically adjusted by the OS based on factors like aging or memory usage.

Breakdown of Other Options

  • Program counter: Tracks the execution progress by holding the address of the next instruction.
  • Register: Stores the CPU state during context switching.
  • File list: Tracks the files opened by the process.

Question : The process attributes stored in PCB are used by:

Solution :
506720260309075848 Correct Answer : Operating System

Description -

The correct answer is Operating System.

The Process Control Block (PCB) is a core data structure created, maintained, and managed exclusively by the Operating System (OS) kernel.

The OS uses these attributes to perform vital system tasks, including:

  • Context Switching: Saving and restoring the execution state of processes when pausing or resuming them.
  • CPU Scheduling: Reading the Priority and Process State attributes to decide which application gets to run next.
  • Resource Management: Tracking memory allocations, open files, and I/O devices assigned to each process to maintain security and system stability.

Why the Other Options are Incorrect

  • User program: A user program runs in an isolated user space and is completely blocked from accessing or altering the PCB directly for security reasons.
  • Compiler: The compiler is only responsible for translating source code into machine code before the program ever runs.
  • Loader: The loader sets up the initial memory space for a program to launch, but it does not manage the process attributes during active execution.

Question : When a process is suspended, the address of its last executed instruction is saved in:

Solution :
694520260309075806 Correct Answer : Program counter

Description -

The correct answer is Program counter.

The program counter (PC) is the specific register inside the Process Control Block (PCB) designed to track the location of execution.

When a process is suspended or interrupted, the CPU hardware automatically updates the program counter to hold the memory address of the next instruction to be executed (or the last attempted one, depending on the architecture). The operating system then saves this exact value into the process's PCB memory space. When the process is eventually resumed, this saved address is loaded back into the physical CPU register so that execution continues seamlessly from that exact location.

Breakdown of Other Options

  • Register: While the program counter is technically a specific type of register, the broad "Register set" or general registers store data variables, stack pointers, and arithmetic results rather than the instruction sequence address itself.
  • File list / Device list: These track external system resources allocated to the process, such as open files or hardware peripherals.

Question : Which attribute indicates the lifecycle stage of a process?

Solution :
428820260309075657 Correct Answer : Process state

Description -

The correct answer is Process state.

The process state attribute tracks exactly where a process currently stands in its execution lifecycle. As a process moves from creation to completion, the operating system kernel continuously updates this attribute to reflect its current disposition:

  • New: The process is in the initial creation stage.
  • Ready: The process has been loaded into memory and is waiting for CPU time.
  • Running: The process instructions are actively executing on a CPU core.
  • Waiting / Blocked: The process is paused, waiting for an external event (like I/O completion).
  • Terminated / Exit: The process has finished running and its resources are being cleaned up.

Breakdown of Other Options

  • Process ID (PID): A static numerical label used to identify the process; it does not change based on what the process is currently doing.
  • Registers: Data storage areas that hold temporary values and execution states during active processing.
  • Priority: A scheduling value used to determine which process gets CPU access first.

Question : Open device list in PCB helps the OS to:

Solution :
207220260309075539 Correct Answer : Track devices used by process

Description -

The correct answer is Track devices used by process.

The open device list (also called the I/O status information) inside the Process Control Block (PCB) keeps a detailed inventory of all hardware peripherals—such as printers, network interfaces, disk drives, or audio devices—allocated to that specific process.

The operating system uses this attribute to:

  • Ensure that no two processes conflict over a single-use hardware resource.
  • Properly release and deallocate those hardware devices back to the system pool when the process terminates.

Breakdown of Other Options

  • Manage CPU scheduling: This is handled using the process Priority and Process State
  • Manage memory: This is managed using memory management attributes like page tables, segment tables, and base/limit registers.
  • Manage threads: Thread management involves tracking thread IDs, thread states, and separate thread execution contexts, rather than hardware device assignments.

Question : Which of the following is a correct attribute combination of a process?

Solution :
288920260309075256 Correct Answer : PID, Program Counter, Priority

Description -

The correct answer is PID, Program Counter, Priority.

A process attribute is specific metadata tracked by the operating system kernel inside the Process Control Block (PCB) to manage a program in execution.

  • PID (Process ID): The unique identifier given to each process.
  • Program Counter: The tracking pointer that holds the memory address of the next instruction.
  • Priority: The numerical ranking value used by the CPU scheduler to handle scheduling decisions.

All three items in this set are genuine process management properties stored together within the PCB.

Breakdown of Incorrect Options

  • File System, Compiler, Loader: These are external system software tools and structures. The compiler translates high-level text to code, and the loader moves code into memory, but they are not operational state attributes of a single running process.
  • Cache, Register, Bus: These are physical hardware architectural components belonging to the computer's CPU and motherboard, not process-level metadata records.
  • Disk, Network, Printer: These are external hardware resources and Input/Output devices. While a process may reference a list of allocated devices, the physical devices themselves are not attributes.