Operating Systems Quiz
41 Questions
0 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 is the primary goal of multiprogramming?

  • To have multiple processes waiting
  • To ensure some process is always running (correct)
  • To minimize the number of processes
  • To decrease CPU utilization

In which process state is a process immediately after being created?

  • waiting
  • ready
  • running
  • new (correct)

Which component of the Process Control Block (PCB) holds the memory location of the next instruction to be executed?

  • CPU registers
  • Memory-management information
  • I/O status information
  • Program counter (correct)

Within the process control block, which category contains information about the CPU usage time of a process?

<p>Accounting information (C)</p> Signup and view all the answers

A process that is waiting for an I/O operation is in what state?

<p>waiting (A)</p> Signup and view all the answers

What is the main goal of time-sharing systems with respect to CPU usage?

<p>To enable frequent interaction with running programs (A)</p> Signup and view all the answers

Which data in the process control block is directly involved in the context switch operation?

<p>CPU registers and Program counter (C)</p> Signup and view all the answers

In priority scheduling, what does a lower integer value typically indicate?

<p>A higher priority for the process (C)</p> Signup and view all the answers

Which of the following is an example of an internally defined priority?

<p>Amount of RAM a process is using (D)</p> Signup and view all the answers

What is a primary disadvantage of using priority scheduling?

<p>Starvation of low priority processes (B)</p> Signup and view all the answers

What is the purpose of 'aging' in the context of priority scheduling?

<p>To gradually increase the priority of processes that have been waiting for a long time (B)</p> Signup and view all the answers

If a system uses a preemptive priority scheduling algorithm, what happens when a new process enters and has a higher priority than the currently running process?

<p>The running process is interrupted and put back on the ready queue while the new process starts. (C)</p> Signup and view all the answers

What is the primary role of the kthreadd process?

<p>Creating processes that perform tasks on behalf of the kernel. (A)</p> Signup and view all the answers

Which process manages clients that connect to the system using secure shell (SSH)?

<p>sshd process (D)</p> Signup and view all the answers

What does the login process primarily handle?

<p>Managing clients that directly log onto the system. (B)</p> Signup and view all the answers

What resources might a child process require from the operating system?

<p>CPU time, memory, files, and input/output (I/O) devices. (C)</p> Signup and view all the answers

In terms of resource sharing between parent and child processes, which is NOT a typical model?

<p>Children always inherit all parent's resources but cannot create new ones. (C)</p> Signup and view all the answers

What are the two primary possibilities for the execution of a child process?

<p>The parent continues to execute concurrently, or the parent waits for the child to terminate. (C)</p> Signup and view all the answers

In UNIX systems, which system call is used to duplicate a process creating a child process?

<p><code>fork()</code> system call (C)</p> Signup and view all the answers

In UNIX, after a fork(), which system call is typically used to replace the child process' memory space with a new program?

<p><code>exec()</code> system call (C)</p> Signup and view all the answers

What is the purpose of the wait() system call in the context of process creation?

<p>To move the parent process off the ready queue until the child terminates. (B)</p> Signup and view all the answers

What happens to child processes when a parent process terminates without invoking wait()?

<p>The child processes become orphan processes and are adopted by the init process. (A)</p> Signup and view all the answers

Which process in Linux/UNIX is responsible for adopting orphaned processes?

<p>The init process. (D)</p> Signup and view all the answers

What is the main function of the init process regarding orphaned processes?

<p>It periodically invokes <code>wait()</code> to collect the exit status of orphaned processes. (D)</p> Signup and view all the answers

Which scenario describes an 'independent process'?

<p>A process that does not share data with any other running process. (B)</p> Signup and view all the answers

What defines a 'cooperating process'?

<p>A process that can affect or be affected by other processes, often by sharing data. (D)</p> Signup and view all the answers

Which of the following is NOT a reason for providing an environment that supports process cooperation?

<p>To enhance the security of the system using isolation of processes. (A)</p> Signup and view all the answers

What is the main purpose of Inter-Process Communication (IPC)?

<p>To allow processes to share data and information. (A)</p> Signup and view all the answers

Which of the following is NOT a fundamental model of interprocess communication?

<p>Remote procedure calls (RPC). (D)</p> Signup and view all the answers

What is the primary mechanism employed in the shared-memory model of IPC?

<p>A region of memory accessible to multiple cooperating processes. (D)</p> Signup and view all the answers

What is a disadvantage of shared memory model of interprocess communication?

<p>Access to shared memory can result in race conditions if not managed properly. (C)</p> Signup and view all the answers

In a bounded buffer, what condition indicates that the buffer is full?

<p><code>((in + 1) % BUFFER_SIZE) == out</code> (A)</p> Signup and view all the answers

What is a critical advantage of message passing systems, especially in distributed environments?

<p>Enabling communication between processes on different computers (B)</p> Signup and view all the answers

In message passing, which operations are fundamental for communication?

<p><code>send(message)</code> and <code>receive(message)</code> (A)</p> Signup and view all the answers

What is a characteristic of direct communication in message passing?

<p>Processes must explicitly name the sender and recipient (C)</p> Signup and view all the answers

In direct communication, how is a communication link established?

<p>Automatically between each pair of processes that wish to communicate (B)</p> Signup and view all the answers

What is the implication of symmetry in addressing in direct communication?

<p>Both the sender and receiver must name each other to communicate. (A)</p> Signup and view all the answers

What is the main difference between symmetric and asymmetric addressing in the send primitive?

<p>In symmetric addressing, the <code>send()</code> primitive must explicitly name the recipient of the message, just like asymmetric. (C)</p> Signup and view all the answers

How does asymmetric addressing differ from symmetric addressing during message reception?

<p>Asymmetric addressing allows the receiver to receive a message from any process without knowing their identity. (A)</p> Signup and view all the answers

What is the purpose of the 'id' parameter in the receive(id, message) primitive, under asymmetric addressing?

<p>To store the name of the process the message is received from (A)</p> Signup and view all the answers

Under direct communication, how many links can exist between exactly two process pairs?

<p>One (B)</p> Signup and view all the answers

Flashcards

New Process State

A process is in the "new" state when it is being created and not yet ready to be executed.

Running Process State

A process is in the "running" state when its instructions are being executed by the CPU.

Waiting Process State

A process is in the "waiting" state when it is paused and waiting for an event to occur, such as I/O completion or resource availability.

Ready Process State

A process is in the "ready" state when it is waiting to be assigned to a processor to execute its instructions.

Signup and view all the flashcards

Terminated Process State

A process is in the "terminated" state when it has finished executing and is no longer active.

Signup and view all the flashcards

Process Control Block (PCB)

A Process Control Block (PCB) holds information about a process that's being managed by the Operating System (OS).

Signup and view all the flashcards

CPU Scheduling

CPU Scheduling is the process of selecting which process to run next on the CPU, aiming to maximize CPU utilization.

Signup and view all the flashcards

Orphan Process

A process that is no longer associated with its original parent process. This often happens when a parent process terminates before its child process has finished.

Signup and view all the flashcards

Init Process

The 'init' process in Linux/UNIX systems that takes responsibility for orphaned processes. It periodically checks for orphaned processes and collects their exit status.

Signup and view all the flashcards

Independent Processes

Processes that run independently and do not share data with other processes.

Signup and view all the flashcards

Cooperating Processes

Processes that can affect or be influenced by other processes. They share data and resources.

Signup and view all the flashcards

Interprocess Communication (IPC)

The mechanism used by cooperating processes to share data and information. This can be done through shared memory or message passing.

Signup and view all the flashcards

Shared Memory

A method of IPC where cooperating processes share a specific region of memory. All processes have direct access to this shared memory for data exchange.

Signup and view all the flashcards

Message Passing

A method of IPC where processes communicate by exchanging messages. Data is sent in a specific format, like packets.

Signup and view all the flashcards

Priority Scheduling

A scheduling algorithm where processes are assigned a priority level. The CPU is allocated to the process with the highest priority (smallest integer value).

Signup and view all the flashcards

Preemptive Priority Scheduling

In priority scheduling, if a new process arrives with a higher priority than the currently running process, the CPU is immediately switched to the new process.

Signup and view all the flashcards

Non-preemptive Priority Scheduling

In priority scheduling, the new process with higher priority is placed at the front of the ready queue, but the current process continues to run until it completes its current CPU burst.

Signup and view all the flashcards

Starvation in Priority Scheduling

A situation where low-priority processes may never get a chance to execute because higher-priority processes constantly preempt them.

Signup and view all the flashcards

Aging in Priority Scheduling

A technique used in priority scheduling to prevent starvation by gradually increasing the priority of processes that have been waiting in the ready queue for a long time.

Signup and view all the flashcards

What is the kthreadd process?

kthreadd is a crucial process in the Linux Kernel that creates other processes like khelper and pdflush. These processes carry out tasks on behalf of the kernel, ultimately contributing to the overall functionality of the system.

Signup and view all the flashcards

What is the sshd process?

sshd manages incoming connections using the Secure Shell (SSH) protocol, allowing users to access the system remotely.

Signup and view all the flashcards

What is the login process?

login is responsible for handling user logins directly to the system.

Signup and view all the flashcards

What are the resource sharing options for parent and child processes?

Resource sharing options allow parent and child processes to share resources in various ways. In 'share all', they utilize the same resources. In 'share subset', the child inherits a portion of the parent's resources. Finally, 'no share' means they have entirely independent resources.

Signup and view all the flashcards

What are the two execution possibilities when a parent process creates a child?

When a process creates a child, the parent has two primary execution options. It can either continue running concurrently with its children or wait until some or all children finish before proceeding.

Signup and view all the flashcards

What are the two address-space possibilities for a child process?

The child process can either be a clone of the parent, having the same program and data, or it can load a new program entirely.

Signup and view all the flashcards

What are the fork() and exec() system calls used for?

fork is a system call that creates a new process, which is essentially a copy of the parent process, while exec replaces the existing memory space of the process with a new program.

Signup and view all the flashcards

What is the wait() system call used for?

wait() is used by the parent process to pause its execution until a child process terminates.

Signup and view all the flashcards

How many times will the provided program print 'yes'?

The given program will print 'yes' 4 times. Each call to fork() creates a new process, so the code is executed in 4 different processes, resulting in 4 separate 'yes' prints.

Signup and view all the flashcards

Bounded Buffer

Bounded Buffer is a technique used in concurrency to manage shared memory by limiting the number of items a producer can add to or a consumer can remove from a shared buffer. It prevents the producer from adding items to a full buffer and the consumer from removing items from an empty buffer.

Signup and view all the flashcards

Empty Buffer

In a bounded buffer, a buffer is considered "empty" when the number of items added ('in') equals the number of items removed ('out').

Signup and view all the flashcards

Full Buffer

In a bounded buffer, the buffer is considered "full" when the number of items added ('in') is one less than the number of items removed ('out') after applying a modulo operation by the buffer size.

Signup and view all the flashcards

Send/Receive operations

Message passing uses operations that allow processes to send and receive messages, enabling them to communicate and synchronize.

Signup and view all the flashcards

Direct Communication

Under direct communication, each process explicitly names the recipient or sender of the message. Senders must specify the target process, and receivers must specify the sender.

Signup and view all the flashcards

send(P, message)

In direct communication, the send() operation sends a message to a specific process named 'P'.

Signup and view all the flashcards

receive(Q, message)

In direct communication, the receive() operation receives a message from a specific process named 'Q'.

Signup and view all the flashcards

Asymmetric Communication

A communication method where only the sender names the recipient. The receiver doesn't need to explicitly name the sender.

Signup and view all the flashcards

send(P, message)

In asymmetric communication, the send() operation sends a message to a specific process named 'P'.

Signup and view all the flashcards

receive(id, message)

In asymmetric communication, the receive() operation doesn't require specifying the sender. The 'id' variable holds the name of the process from which the message was received.

Signup and view all the flashcards

Study Notes

Introduction to KTU Notes

  • KTU Notes is a learning companion providing KTU study materials, syllabus, live notifications, and solved question papers.
  • The website address is www.ktunotes.in.

Module II: Processes and Process Scheduling

  • This module covers processes, process control blocks, threads, scheduling, operations on processes, process creation, termination, inter-process communication, shared memory systems, and message passing systems.
  • Basic concepts of process scheduling including scheduling criteria and algorithms are included.
  • Specific algorithms covered include First Come First Served (FCFS), Shortest Job First (SJF), Priority Scheduling, and Round Robin Scheduling.

Processes

  • A process is a program in execution.
  • It includes program counter values, register contents, and variables.
  • Conceptually, each process has its own virtual CPU.
  • In reality, the CPU rapidly switches between processes, a concept called multiprogramming.
  • Batch systems execute jobs, while time-shared systems handle user programs or tasks.
  • A process has a text section (program code), current activity (program counter and processor registers), a stack (for temporary data like function parameters), a data section (for global variables), and a heap (for dynamically allocated memory).

Process Concept (Continued)

  • A program becomes a process when the executable file is loaded into memory.
  • Processes can be created through GUI clicks, command-line entries, or other methods.
  • Multiple instances of a single program can run concurrently as separate processes.
  • The data, heap, and stack sections of a process vary even if the text sections are equivalent.

Process State

  • Processes change states as they execute: new, running, waiting, ready, and terminated.
  • A diagram illustrating process states and transitions is included.

Process Control Block (PCB)

  • Each process is represented by a PCB (also called a task control block).
  • The PCB contains process state, process number, program counter, registers, memory limits, and a list of open files.
  • The PCB also holds CPU-scheduling information (priority, pointers to scheduling queues) and memory-management information (base and limit registers or page tables).
  • Additional information includes I/O status (allocated I/O devices, open files), accounting information (CPU and real time used, job/process numbers), and so on.

Process Control Block (Context Switch)

  • A diagram illustrates the context switch process, where the operating system saves the state of the running process into its PCB and loads the state of the next process to run.

Process Scheduling

  • Multiprogramming aims for maximum CPU utilization.
  • Time-sharing allows multiple users to interact with programs concurrently.
  • The process scheduler selects an available process for CPU execution.
  • Only one process can run at a time on a single-processor system.

Scheduling Queues

  • Processes enter the system into a job queue.
  • Ready processes reside in a ready queue.
  • Other queues exist for different devices (e.g., I/O device queues).
  • A diagram of scheduling queues and their interactions is provided.

Scheduling Queues (Events)

  • A process in execution may issue an I/O request, create a new child process, or be interrupted requiring it to be returned to the ready queue.

Schedulers

  • The operating system uses different schedulers:
    • Long-term scheduler (job scheduler): For batch systems; it selects processes from a pool and loads them into memory.
    • Short-term scheduler (CPU scheduler): Selects processes from the ready queue to run on the CPU.
    • Medium-term scheduler: Adds processes from memory to a swap area and back to memory, a technique called swapping.

Schedulers (Distinction)

  • Short-term schedulers run more frequently than long-term schedulers.
  • The CPU-bound processes may influence I/O-bound processes in a system.

Schedulers (I/O and CPU Bound)

  • A process is either I/O-bound or CPU-bound.
  • I/O-bound processes spend more time waiting for I/O, while CPU-bound processes use more CPU time.
  • An appropriate mix of I/O-bound and CPU-bound processes leads to optimal system performance.

Medium-Term Scheduler

  • The medium-term scheduler temporarily removes processes from memory (swapping).
  • This creates space and allows other processes to run.

Context Switch

  • When an interrupt occurs, the current process's context is saved, allowing the system to resume the process at a later time.
  • The context includes CPU registers, process state, and memory-management information.
  • Context switching is purely overhead.

Operations on Processes

  • The operating system supports process creation and termination.

Process Creation

  • A parent process creates child processes.
  • A process tree illustrates the hierarchical relationship between processes.
  • Each process has a unique process identifier (PID).
  • Processes might share or not share resources (memory, files, etc.).

Process Termination

  • A process ends by completing its final statement and using the exit() system call.
  • The parent process can be notified of the child's exit status.
  • The operating system deallocates the child's resources.

Process Termination-Cascading Termination

  • Some systems require a child process to terminate when the parent terminates.

Process Termination-Zombie Process

  • A terminated process whose parent hasn't yet received its exit status remains in the process table as a zombie process.

Process Termination-Orphans

  • Orphans are child processes whose parent terminates without calling wait.
  • The init process adopts orphans in Linux/UNIX systems.

Interprocess Communication

  • Processes may be independent or cooperate.
  • Independent processes are unaffected by each other; cooperating processes might share data.
  • Mechanisms for cooperating processes include shared memory and message passing.

Shared-Memory Systems

  • Shared memory allows processes to communicate by reading/writing to a common area of memory.
  • The producer-consumer problem highlights the need for synchronization when multiple processes access shared resources.
  • Two types of buffers for shared memory are unbounded and bounded.

Message-Passing Systems

  • In message passing, processes communicate by exchanging messages.
  • Two fundamental models for message passing: - direct and indirect.
  • Message passing can be blocking or non-blocking, and buffering methods are used for communication.

CPU Scheduling

  • The CPU scheduler selects a waiting process when the CPU is idle. This scheduler uses different scheduling algorithms.
  • Common criteria include increasing CPU utilization, throughput, turnaround time, waiting time, and response time.

CPU Scheduling: Preemptive vs. Non-preemptive

  • Preemptive scheduling allows interruption of running processes.
  • Non-preemptive scheduling requires the process to release the CPU voluntarily.
  • The dispatcher gives the CPU to the selected process. Specific scheduling algorithms exist for prioritizing processes, such as based on arrival time and burst time.

Scheduling Algorithms (FCFS)

  • First-Come, First-Served (FCFS): Processes are executed in the order they arrive.
  • FCFS can lead to the convoy effect if one long-running process blocks many shorter processes.

Scheduling Algorithms (SJF)

  • Shortest Job First (SJF): The process with the shortest burst time is selected next.
  • SJF can be either preemptive or non-preemptive.

Scheduling Algorithms (SRTF)

  • Shortest Remaining Time First (SRTF) is a preemptive version of SJF.
  • It prioritizes processes with the shortest remaining time.

Scheduling Algorithms (Priority)

  • Priority scheduling gives higher priority to specific processes based on an assigned priority.
  • Priority scheduling might lead to starvation of low-priority processes if they are consistently interrupted.

Scheduling Algorithms (Round Robin)

  • Round Robin (RR): A time-slicing approach; each process gets a fixed time quantum.
  • If a process's burst time is longer than q, it's moved to the end of the ready queue.

Threads

  • A thread is a lightweight unit of execution within a process.
  • Multiple threads within the same process share common resources (e.g., code, data, open files).
    • Context switching between threads is faster than between processes.

Studying That Suits You

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

Quiz Team

Related Documents

Description

Test your knowledge on key concepts of operating systems, focusing on multiprogramming, process control blocks, and scheduling algorithms. This quiz covers essential topics that are fundamental for understanding OS behavior and performance. Challenge yourself with questions about process states, CPU usage, and prioritization in scheduling.

More Like This

Use Quizgecko on...
Browser
Browser