Operating Systems - Processes Overview
40 Questions
2 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What type of information must be saved when an interrupt occurs?

  • State information of the CPU (correct)
  • Information about I/O devices only
  • Only the program counter
  • Only the condition-code information
  • Which of these is included in CPU-scheduling information?

  • List of open files
  • Base and limit registers
  • Daily CPU usage time
  • Process priority (correct)
  • What happens to a process that issues an I/O request?

  • It immediately terminates
  • It becomes the highest priority process
  • It is placed in an I/O wait queue (correct)
  • It is removed from the scheduling queue
  • What does accounting information for a process typically include?

    <p>Amount of CPU and real time used</p> Signup and view all the answers

    What is true about a child process in relation to its parent process?

    <p>It is a duplicate of the parent process initially</p> Signup and view all the answers

    Under which condition might a parent process terminate its child process?

    <p>If the child exceeds its allocated resources</p> Signup and view all the answers

    What typically happens when the time slice of a process expires?

    <p>The process is put back into the ready queue</p> Signup and view all the answers

    What is a characteristic of the child process when created?

    <p>It inherits the parent's resources</p> Signup and view all the answers

    What component contains the executable code of a process?

    <p>Text section</p> Signup and view all the answers

    Which state indicates that a process is actively executing instructions?

    <p>Running</p> Signup and view all the answers

    What does the program counter in a process control block indicate?

    <p>The address of the next instruction to execute</p> Signup and view all the answers

    In which section of a process is dynamic memory allocated during runtime?

    <p>Heap section</p> Signup and view all the answers

    Which statement about process states is true?

    <p>The waiting state indicates the process is paused until a certain event occurs.</p> Signup and view all the answers

    Which part of the global data section includes initialized and uninitialized data?

    <p>Data section</p> Signup and view all the answers

    Which of the following is NOT a state of a process?

    <p>Initialized</p> Signup and view all the answers

    What is stored in the stack section of a process?

    <p>Function parameters and local variables</p> Signup and view all the answers

    What happens in a zero capacity queue when a message is sent?

    <p>The sender is blocked until the recipient receives the message.</p> Signup and view all the answers

    In a bounded capacity queue, what occurs if the queue is full when a new message is sent?

    <p>The sender must wait until there is room in the queue.</p> Signup and view all the answers

    Which type of capacity queue allows an infinite number of messages?

    <p>Unbounded capacity.</p> Signup and view all the answers

    What is a necessary feature of the message header in Mach Message Passing?

    <p>It must contain metadata such as source and destination ports.</p> Signup and view all the answers

    What can happen if a sender attempts to send a message to a full queue?

    <p>The sender may temporarily cache a message.</p> Signup and view all the answers

    What is the purpose of a section object in Windows for larger messages?

    <p>To provide a region of shared memory associated with the channel.</p> Signup and view all the answers

    Which of the following statements about pipes is NOT true?

    <p>Pipes do not allow any form of communication.</p> Signup and view all the answers

    What does it mean for a queue to have bounded capacity?

    <p>The queue can hold a finite number of messages.</p> Signup and view all the answers

    What is the primary role of the init (or systemd) process in UNIX and Linux systems regarding process termination?

    <p>It reaps zombie processes and cleans up after terminated processes.</p> Signup and view all the answers

    In a UNIX-like program, how many processes are created by the program if the initial parent process is counted?

    <p>Two processes, the parent and one child.</p> Signup and view all the answers

    When is it more suitable to use ordinary pipes over named pipes?

    <p>When communication between parent and child processes is needed in real-time.</p> Signup and view all the answers

    What is a possible consequence of not enforcing 'at most once' or 'exactly once' semantics in RPC?

    <p>Duplicate execution of operations leading to inconsistency.</p> Signup and view all the answers

    Which method effectively guarantees that a process identifier (pid) is unique for each new process in an operating system?

    <p>Assigning pids sequentially from a fixed range.</p> Signup and view all the answers

    What is a disadvantage of synchronous communication at the system level?

    <p>It can block processes, causing delays in execution.</p> Signup and view all the answers

    In which scenario are named pipes more beneficial than ordinary pipes?

    <p>For establishing long-term connections between unrelated processes.</p> Signup and view all the answers

    Which process state indicates that a child process has completed but has not yet been reaped by its parent?

    <p>Zombie</p> Signup and view all the answers

    What must be unique among active processes in a system?

    <p>Process identifiers (pid)</p> Signup and view all the answers

    What does the function allocate map() return upon unsuccessful execution?

    <p>-1</p> Signup and view all the answers

    In the context of the Collatz conjecture, what happens to the sequence of numbers generated?

    <p>It can be stored in a shared-memory object.</p> Signup and view all the answers

    What is the significance of port 17 when connecting to a server?

    <p>It provides the quote-of-the-day service.</p> Signup and view all the answers

    What is the correct syllable structure of a haiku?

    <p>5-7-5</p> Signup and view all the answers

    What should the haiku server do when a client connects to it?

    <p>Return a haiku to the client.</p> Signup and view all the answers

    How does an echo server operate?

    <p>It sends received data back to clients.</p> Signup and view all the answers

    What function is used to release a pid that is no longer needed?

    <p>release pid(int pid)</p> Signup and view all the answers

    Study Notes

    Processes

    • A process is a program in execution and consists of the following sections:
      • Text section: Contains the executable code
      • Data section: Stores global variables
      • Heap section: Dynamically allocated memory during program runtime
      • Stack section: Used for temporary data storage during function calls
    • A process can be in one of several states:
      • New: The process is being created
      • Running: Instructions are being executed
      • Waiting: Waiting for an event (e.g., I/O completion)
      • Ready: Waiting to be assigned to a processor
      • Terminated: Execution has finished
    • The Process Control Block (PCB) contains information about a process:
      • Process state: New, ready, running, waiting, terminated, etc.
      • Program Counter: The address of the next instruction to be executed
      • CPU Registers: Store values needed for process execution
        • Accumulators, index registers, stack pointers, general-purpose registers
        • These are saved when an interrupt occurs to allow the process to resume correctly
      • CPU Scheduling Information: Priority, scheduling queue pointers, etc.
        • Used for managing when and how a process gets to run on the CPU
      • Memory Management Information: Base and limit registers, page tables, segment tables
        • Details on how the process's memory is organized
      • Accounting Information: CPU time used, real time used, account numbers
        • Used for tracking resource usage
      • I/O Status Information: List of allocated I/O devices, open files, etc.
    • Threads are lightweight processes that share the same address space and resources.
      • Multiple threads within a process can execute concurrently, enhancing performance.

    Process Scheduling

    • Scheduling queues: Processes spend time in different queues:
      • Ready queue: Processes waiting to be assigned to a CPU
      • I/O wait queue: Processes waiting for I/O to complete
      • Wait queue: Processes waiting for an event (e.g., child process termination)
    • CPU Scheduling algorithms: Determine which ready process is assigned to the CPU next.
    • A context switch is the process of saving the state of the currently running process and loading the state of a new process, allowing the CPU to switch between running processes.
    • Context switches involve saving the current process's program counter, CPU registers, and other process state information.

    Operations on Processes

    • Process creation: A new process is created, typically by an existing process (the parent).
      • The parent can choose to execute concurrently with the child or wait for the child to terminate.
      • The child process can be a copy of the parent or have a completely different program loaded.
    • Process termination: A process can be terminated for various reasons:
      • The process completes its assigned task.
      • The parent process terminates.
      • The process exceeds resource limits.
      • The process is abnormally terminated.
    • Inter-process communication (IPC): Allows processes to communicate with each other.
      • Message passing: Processes exchange messages through shared queues.
      • Shared memory: Processes access a shared region of memory to communicate.
      • Semaphores: Used for synchronizing access to shared resources, preventing race conditions.
      • Pipes: Unidirectional or bidirectional connections between processes.
    • Buffering: Messages are buffered to handle different sending and receiving rates:
      • Zero capacity: The sender blocks until the receiver receives the message.
      • Bounded capacity: A finite number of messages can be queued, and the sender blocks if the queue is full.
      • Unbounded capacity: The queue has potentially infinite length, and the sender never blocks.

    Examples of IPC Systems

    • POSIX Shared Memory: Provides a standard way to create and access shared memory segments across different processes.
    • Mach Message Passing: A message-passing system that offers a flexible and powerful IPC mechanism.
      • Messages include:
        • A fixed-size message header with metadata (size, source, destination ports)
        • A variable-sized body containing data.
      • Sending a message to a full queue can be handled in various ways:
        • Wait indefinitely until there is room in the queue.
        • Wait for a specified time (milliseconds).
        • Return immediately without waiting.
        • Temporarily cache the message, notifying the sender when the queue has space.
    • Windows: Uses a combination of message queues, shared memory (sections), and direct memory access for IPC.

    Pipes

    • Pipes: Allow processes to communicate unidirectionally or bidirectionally.
      • Ordinary pipes: A temporary communication channel between related processes.
      • Named pipes: Persistent channels that can be accessed by any process on the system.

    Additional Notes

    • Init (or Systemd) Process: The init process (or systemd) is responsible for starting up and managing system processes on Unix and Linux systems. It also handles process termination, ensuring that orphaned processes are properly terminated.
    • Zombie Processes: A zombie process is a process that has completed execution but its entry in the process table still exists because the parent process hasn't yet called wait() to reclaim its resources.
    • RPC (Remote Procedure Call): A mechanism that allows a process on one computer to call a procedure/function on a process running on another computer. Guaranteeing at-least-once, at-most-once, or exactly-once semantics for RPC calls is crucial for reliable communication.
    • Echo server: A simple server that echoes back any data it receives from a client.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    Explore the intricacies of processes in operating systems with this quiz. Understand the different sections of a process, various process states, and the important role of the Process Control Block (PCB). Test your knowledge on key concepts and terminology in this essential topic.

    More Like This

    Operating Systems Process Management
    14 questions
    Operating Systems Process Management
    16 questions
    Operating Systems: Process Management
    36 questions
    Use Quizgecko on...
    Browser
    Browser