Operating Systems Exam

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Determine S{n+1} for S{n}=10, T{n}=12, and a=0.5

0.5 x 12 + 0.5 x 10 = 6 + 5 = 11

The set of all PCBs could be implemented as a _____

1-dimensional array of structures, where the array dimension is the number of available PCB slots.

What is the speedup gain for an application that has 20% serial component running on a computer that has 2 CPUs? Use 2 decimal points.

1.67 (1 / (S + ((1 - S) / N)) = 1/(0.2+(0.8/2)) = 1/0.6 = 1.67)

Process P1 and P2 execute on a system with a single CPU and 2 identical I/O devices. Each process executes a compute-bound phase followed by an I/O-bound phase. P1 starts at time 0. P1's compute time is 30 units and I/O time is 40 units. P2's compute time is 10 units and I/O time is 70 unites. With multiprogramming, what time does the computation terminate?

100

For the following set of processes, when does p1 end assuming Shortest Remaining Time (SRT) scheduling? {p1, 0, 80}, {p2, 50, 20}, {p3, 40, 50}

100 (p1=0>40, p2=40>60, p1=60>[100], p3=100>150)

For the following set of processes, what is the average turnaround time (ATT) under Shortest Job First (SJF) scheduling? {p1, 0, 5}, {p2, 2, 4}, {p3, 3, 2}

6 (p1 runs for 5 (0+5), p3 was supposed to start at 3 but starts at 5 now (+2) and runs for 2 (2+2), terminating at 7, p2 was supposed to start at 2 but starts at 7 now (+5) and runs for 4 (5+4), terminating at 16. 5+4+8=18, 18/3=6)

For the following set of processes, when does P2 start, assuming FIFO scheduling? {p1, 0, 5}, {p2, 4, 1}, {p3, 2, 3}

8

Parent-Child Relationships Among Processes

A _____ process can create ____ processes. ____ processes often inherit resources and privileges from their _____.

Define a Process

A _______ is a program in execution. It is an independent, self-contained unit that runs as a separate entity, has its own memory space, and executes a sequence of instructions.

Context Switch

A ________ is the process of saving the state of one process and loading the state of another. It is necessary for multitasking and involves switching between processes.

Benefits of a Virtual CPU

A _________ allows multiple virtual machines to run on a single physical CPU. It provides isolation, resource allocation, and helps manage virtualized environments efficiently.

Define a Process Control Block (PCB)

A _____________ is a data structure used by the operating system to manage and store information about a process. It contains details such as process state, program counter, CPU registers, and more.

Contents of a Generic Process Control Block (PCB)

A __________contains information such as process state, program counter, CPU registers, scheduling information, and pointers to memory management data.

children

A child process c of process p is a process created by p. Process p is c's parent. The identity of every child process c of p is recorded in the children field.

Describe a monitor and condition variables

A monitor is an abstract data type used for synchronization. It provides a way to group shared data and the procedures (methods) that operate on that data. Condition variables are a part of monitors and are used for thread coordination. They allow threads to wait for a certain condition to become true before proceeding.

State Diagram of a Process

A process can be in different states, including "New," "Ready," "Running," "Blocked," and "Terminated." Transitions occur based on events, such as I/O completion or scheduling decisions.

memory

Describes the area of memory assigned to p. In the simplest case the field would point to a contiguous area of main memory. In systems using virtual memory the field could point to a hierarchy of memory pages or segments.

Comparison: Single-Threaded vs. Multi-Threaded Process

A single-threaded process has one thread of execution, while a multi-threaded process has multiple threads that can run concurrently. Multi-threading can improve performance and responsiveness.

Scheduling Algorithms (FIFO, SJF, SRT)

FIFO (First-In First-Out) schedules processes in the order they arrive. SJF (Shortest Job First) selects the shortest process next. SRT (Shortest Remaining Time) selects the process with the shortest remaining time.

Difference Between Abstraction and Virtualization

Abstraction is the process of simplifying complex systems by breaking them down into smaller, more manageable components. Virtualization, on the other hand, is the creation of a virtual (rather than actual) version of something, such as a virtual machine that emulates a physical computer.

New -> Ready is caused by ____.

Activate

Advances in Hardware Technologies Impacting OS

Advances such as increased processing power, memory capacity, and I/O capabilities have driven changes in operating systems, allowing for more features, better performance, and increased scalability.

Different Application Environments

Application environments vary from desktop applications to web-based, mobile, and cloud applications, each with its own unique requirements and constraints.

Meaning of Bits, Bytes, Words, Kilobytes, etc.

Bits are the smallest units of data (0 or 1). Bytes consist of 8 bits. A word is a group of bits processed as a unit by the CPU. Kilobytes (KB) represent 1,024 bytes.

scheduling_information

Contains information used by the scheduler to decide when p should run. The information typically records p's CPU time, the real time in the system, the priority, and any possible deadlines.

resource_description

Contains the description of r's properties and capabilities.

What is the term for transferring control of the CPU from one process to another called?

Context Switch

A context switch for a currently running process p may be caused by some other process q.

False

The parent PCB field will change while a process is in the running state.

False

Performance of Real-time Scheduling

Feasible schedules ensure all real-time processes meet their deadlines. CPU utilization must be maximized while meeting these constraints.

What function changes a process state from ready to running?

OS scheduler

Ready -> Running and Running -> Ready is caused by ____.

OS scheduling

With a multi-threaded process, a context switch between threads is performed by the OS kernel.

Only with kernel-level threads

Definition of Open-Source Software and Operating Systems

Open-source software refers to software with source code that is openly available and can be modified and redistributed. Open-source operating systems are built on the same principles, allowing users to inspect, modify, and distribute the code freely.

The earliest deadline first (EDF) algorithm schedules processes according to the shortest remaining time until the process ____.

deadline

FIFO (first in, first out)

if p1's arrival time is 0 and total CPU time is 5, it will terminate at 5. if p3's arrival time is 3 and total CPU time is 4, it will terminate at 9. if p2's arrival time is 4 and total CPU time is 1, it will terminate at 10.

SRT (Shortest Remaining Time)

if p1's arrival time is 0 and total CPU time is 6, it will terminate at 1. if p2's arrival time is 1 and total CPU time is 3, it will terminate at 4. if p3's arrival time is 3 and total CPU time is 2, it will terminate at 6. p1 will resume its CPU time for 5 and terminate at 11.

SJF (Shortest Job First)

if p1's arrival time is 0 and total CPU time is 6, it will terminate at 6. if p2's arrival is 5 and total CPU time is 2, it will terminate at 8. if p3's arrival time is 3 and total CPU is 6, it will terminate at 14.

A process consisting of n user-level threads is to be mapped onto a set of m kernel-level threads. Which combination would not fully use available resources?

m=4 and n=3 (m needs to be < than n)

Round Robin Scheduling (RR)

moves like going downstairs. 1 second at a time until they're all complete.

These PCB fields may change while a process is in the running state.

open_files, children

When a process p is moved from the current state to the suspended state, then upon reactivation, _______

p is moved to either the ready state or blocked state. (If the suspension occurred in the running or ready state then p must go to the ready state)

______ and ______ can take advantage of multiple CPUs.

processes, threads

Which of the following is not an advantage of cloud computing?

Considerable service provider interaction is required

Identify a race condition

A race condition occurs in a program when the behavior of the program depends on the relative timing of events, such as the order in which threads are scheduled to run. It can lead to unpredictable and unintended results if not properly managed. Race conditions typically involve shared resources, like variables, where multiple threads may try to access or modify the resource simultaneously.

Differentiate between a semaphore and a monitor semaphore

A semaphore is a synchronization primitive used to control access to resources. A monitor semaphore is a variant of the semaphore concept, specifically designed for use within monitors. It provides a way to handle synchronization within monitor-based systems.

These PCB fields may change during a process's lifetime.

CPU_state, process_state, memory, open_files, children

Estimated Total CPU Time

Calculating estimated total CPU time is essential for predicting process execution. Exponential averaging involves updating the estimate based on recent history.

Analyze a solution to a classic synchronization problem

Classic synchronization problems include the bounded buffer problem, readers-writers problem, dining philosophers problem, and elevator problem. Analyzing a solution means understanding how synchronization mechanisms are used to solve these problems, ensuring that they work correctly, and evaluating their performance.

Combined Scheduling Approaches (2-Tier)

Combined approaches often use one scheduler to select processes for high-priority execution and another for low-priority background tasks. Floating priorities allow dynamic adjustments based on system conditions.

Running -> Terminated is caused by ____.

End

parent

Every process is created by some other running process. The parent process of a process p is the process that created p. The parent field records the identity of p's parent.

In round-robin scheduling, when the time quantum (Q) is very large, it approaches which of the following scheduling algorithms?

FIFO

Four independent processes are executing on four physical CPUs. What happens to the speed of execution if the number of CPUs is increased to five?

No effect

Time to Complete Computations for Multiple Processes

In multiprogramming and time-sharing, the time to complete computations depends on factors like process scheduling, the type of workloads (compute-bound or I/O-bound), and resource allocation.

Interrupts, Traps, and Interrupt Handlers

Interrupts are signals sent to the CPU to indicate that an event has occurred. Traps are software-generated interrupts. Interrupt handlers are routines that respond to interrupts by saving the current state and executing the necessary code.

Is this series of state transitions valid or invalid? Running > Blocked > Ready > Blocked > Suspended

Invalid

other_resources

Keeps track of any resources, such as printers, that p has requested and successfully acquired.

accounting_information

Keeps track of information necessary for accounting and billing purposes. Ex: The amount of CPU time or memory used.

open_files

Keeps track of the files currently open by p.

Long-term vs. Short-term Scheduling

Long-term scheduling is responsible for selecting processes from the job pool and loading them into memory. Short-term scheduling, also known as CPU scheduling, decides which process to execute next in the CPU.

Moore's Law

Moore's Law is an observation that the number of transistors on a microchip doubles approximately every two years, leading to a rapid increase in computing power and a decrease in cost.

What is the term for the time interval used in the Rate Monotonic (RM) scheduling algoritm for scheduling processes?

Period

Preemptive vs. Non-preemptive Scheduling

Preemptive scheduling allows a higher-priority process to interrupt the execution of a lower-priority process. Non-preemptive scheduling completes the execution of the current process before switching to the next.

Priority for Short-term and Long-term Scheduling

Priority in short-term scheduling is often based on factors like process importance or the time remaining to complete. In long-term scheduling, priority may be determined based on the process's estimated resource requirements.

Describe priority inversion and priority inheritance

Priority inversion is a scenario in which a high-priority task is waiting for a resource that is currently held by a low-priority task. This can lead to priority inversion, where the low-priority task temporarily inherits the priority of the high-priority task to avoid blocking it. Priority inheritance is a mechanism to address this issue by ensuring that the low-priority task inherits the priority of the high-priority task while it holds the required resource.

An application can be structured as a collection of cooperating processes. Which of the following is not an advantage of the approach?

Program size is decreased

Produce pseudocode using semaphores or a mutex lock to solve a given problem

Pseudocode is a way to outline the logic of an algorithm in a human-readable format. To solve synchronization problems, you can use pseudocode to describe how semaphores or mutex locks can be applied to manage access to shared resources and avoid race conditions.

Match pseudo code to the appropriate synchronization hardware

Pseudocode is an informal description of an algorithm, and synchronization hardware typically includes primitives like semaphores, mutexes, and condition variables. Matching pseudocode to synchronization hardware means expressing how a particular algorithm or problem can be solved using these synchronization tools.

Suspended -> Blocked and Suspended -> Ready are caused by ____.

Reactive

Real-time Process Scheduling

Real-time processes have specific deadlines to meet. Rate Monotonic (RM) and Earliest Deadline First (EDF) are common real-time scheduling algorithms.

Blocked -> Ready is caused by ____.

Release resource (other process)

Running -> Blocked is caused by ____.

Request resource (process p itself)

Scheduling Algorithms (Round-Robin, Multilevel, Multilevel Feedback)

Round-Robin allocates each process a fixed time slice. Multilevel scheduling uses multiple priority queues. Multilevel feedback allows processes to move between queues based on their behavior.

Both ___ and ___ can lead to starvation.

SJF, SRT

Comparison: SaaS, PaaS, and IaaS in Cloud Computing

SaaS (Software as a Service) provides software applications over the internet. PaaS (Platform as a Service) offers platforms for developing, running, and managing applications. IaaS (Infrastructure as a Service) delivers virtualized computing resources over the cloud.

What is the concept that determines when a process in the ready state should start competing for the CPU?

Short-term scheduling

Which algorithm schedules processes according to the additional CPU time needed at the time of the scheduling decision?

Shortest Remaining Time (SRT)

state

Shows the current availability of r. If r is a single-unit resource then this field indicates whether r is currently free or allocated to some process. If r has multiple identical untis, such as a pool of identical buffers, then this field keeps track of how many units are currently free and how many are allocated.

What causes a blocked process to transition to the Ready state?

Some other process

Starvation

Starvation occurs when a process is unable to execute due to low priority, and higher-priority processes continually preempt it.

process_state

Stores p's current state. Ex: Running, ready, or blocked.

Ready -> Suspended, Blocked -> Suspended, and Running -> Suspended is caused by ____.

Suspend

Estimating total CPU time

S{n+1}=aT{n}+(1-a)S{n}

Identify the critical section of a problem

The critical section is a part of a program where shared resources are accessed or modified by multiple threads or processes. It's a section that should be executed by only one thread at a time to prevent race conditions and ensure data consistency.

Kernel, Privileged Instructions, Kernel/User Modes, and System Calls

The kernel is the core of an operating system. Privileged instructions are CPU instructions that can only be executed in kernel mode. Kernel/user modes determine the privilege level of code execution. System calls are functions provided by the kernel to interact with the OS.

Advantages of user-level threads over kernel-level threads:

ULTs do not require any cooperation from the kernel, ULTs are much faster to manage and thus many more can be created than KLTs. Applications using ULTs are portable between different OSs without modifications.

Time Quantum and Context Switch Time

The time quantum affects how frequently processes are scheduled in Round-Robin. A shorter time quantum decreases response time but increases context switching overhead.

Solve a synchronization problem using threads and semaphores

This involves applying thread synchronization techniques using semaphores to solve problems that require mutual exclusion or coordination among threads. It's a practical application of synchronization concepts in multithreaded programs.

_____s are faster to create and destroy than processes.

Thread

What is an interrupt caused by an arithmetic overflow called?

Trap

The threads within a single process share the same code and data.

True

Turnaround Time

Turnaround time is the total time taken to execute a process, including waiting and execution time.

Main disadvantages of ULTs over KLTs:

ULTs are not visible to the kernel. When one ULT blocks, the entire process blocks, which decreases concurrency and thus the performance and responsiveness of the application. ULTs cannot take advantage of multiple CPUs because the process is perceived by the kernel as a single thread of execution.

Difference Between User-Level Threads and Kernel-Level Threads

User-level threads are managed by a user-level library, allowing thread management in user space. Kernel-level threads are managed by the operating system kernel, providing more control and efficiency.

waiting_list

When a process requests r and r is currently unavailable then the process's PCB is removed from the ready list and added to r's waiting list. The process is moved back to the ready list when r becomes available and is allocated to the process.

CPU_state

When p is stopped, the current state of the CPU, consisting of various hardware registers and flags, is saved in this field. The save information is copied back to the CPU when p resumes execution.

When does the PCB contain an up-to-date copy of the CPU state of a process p?

When p's state is ready or blocked

Define a Thread

__________ is the smallest unit of a process and represents a single sequence of execution. Threads within a process share the same memory space and resources, enabling concurrent execution.

Define a Resource Control Block (RCB)

____________ is a data structure that represents a resource, such as a device or memory area. It contains information on the resource's status and the processes waiting for it.


संबंधित स्टडी सेट्स

Chapter 49 - Hazardous Materials

View Set

Entrepreneurship Final Exam Study Guide

View Set

Programmering Final Exam fall 2022

View Set

8. THE REFORMATION: ZWINGLI, GREBEL, CALVIN, AND KNOX

View Set

What Am I? Chapter 3 Control Devices

View Set

Retirement and Estate Planning Exam 3 practice questions

View Set