cs 450 exam but questions
What is process hierarchy?
an overview of the relationship between a group of maps, showing both higher and lower levels.
Which of the following components of program state are shared across threads in a multithreaded process? a. Register values b. Heap memory c. Global variables d. Stack memory
c. Global variables b. Heap memory
What is the purpose of system programs?
can be thought of as bundles of useful system calls. They provide based functionality to users so that users do not need to write their own programs to solve common problems.
How can buffering and double buffering can improve I/O performance?
can improve I/O performance by reducing the overhead associated with I/O operations and allowing for asynchronous processing of data. By temporarily storing data in a buffer, the CPU can perform other tasks while the I/O operation is in progress, improving overall system efficiency. Double buffering takes this a step further by allowing for asynchronous processing of both input and output data, further reducing the overhead associated with I/O operations.
Determine if the following problems exhibit task or data parallelism: 1. Using a separate thread to generate a thumbnail for each photo in a collection. 2. Transposing a matrix in parallel 3. A networked application where one thread reads from the network and another writes to the network 4. The fork-join array summation application described in Section 4.5.2 5. The Grand Central Dispatch system
1. Data parallelism: using a separate thread to generate a thumbnail for each photo in a collection. 2. Data parallelism: transposing a matrix in parallel. 3. Task Parallelism: a networked application where one thread reads from the network and another writes to the network. 4. Data parallelism: the fork-join array summation application described in Section 4.5.2. 5. Task parallelism: the Grand Central Dispatch system
What are the three main purposes of an operating system?
1. To provide an environment for a computer user to execute programs on computer hardware in a convenient and efficient manner. 2. To allocate the separate resources of the computer as needed to solve the problem given. The allocation process should be as fair and efficient as possible. 3. As a control program it serves two major functions: (1) supervision of the execution of user programs to prevent errors and improper use of the computer, and (2) management of the operation and control of I/O devices.
Rank the following storage systems from slowest to fastest: a. Hard-disk drives b. Registers c. Optical disk d. Main memory e. Nonvolatile memory f. Magnetic tapes g. Cache
1. f. Magnetic tapes 2. c. Optical disk 3. a. Hard-disk drives 4. e. Nonvolatile memory 5. d. Main memory 6. g. Cache 7. b. Registers
What are the primary responsibilities of an OS supporting convenient use and controlling sharing of resources?
A fundamental responsibility is to allocate resources to programs, such as CPU, memory, I/O devices, and storage. Supporting convenient use and controlling sharing of resources.
Explain peterson's solution and what issues does the solution present.
A historically interesting algorithm for implementing critical sections. Leads to busy waiting, lack of fairness, limited two only two processes and compiler optimization issues
What is a mutex lock and why is it also called a spin lock?
A mutual exclusion lock; the simplest software tool for assuring mutual exclusion. Called a spinlock because it requires "busy waiting".
Timers could be used to compute the current time. Provide a short description of how this could be accomplished:
A program could use the following approach to compute the current time using timer interrupts. The program could set a timer for some time in the future and go to sleep. When it is awakened by the interrupt, it could update its local state, which it is using to keep track of the number of interrupts it has received thus far. It could then repeat this process of continually setting timer interrupts and updating its local state when the interrupts are actually raised.
Explain a scenario where a thread will NOT block during I/O.
A scenario where a thread will not block during I/O is when asynchronous I/O operations are used.
What is a process state?
Current state of the activity: New, Running, Waiting, Ready
What is multiprogramming?
A technique that increases CPU utilization by organizing jobs (code and data) so that the CPU always has a job to execute.
What is Distributed Operating systems?
Allows the management and use of resources located across multiple computer systems conveniently and efficiently. Primary focus is to facilitate resource sharing across systems.
Using Amdahl's Law, calculate the speedup gain for the following applications: · 40 percent parallel with (a) eight processing cores and (b) sixteen processing cores · 67 percent parallel with (a) two processing cores and (b) four processing cores · 90 percent parallel with (a) four processing cores and (b) eight processing cores
Amdahl's law: speedup = 1 / ((1-p) + p/s ) where, p = fraction of code that can be parallelized, s = number of cores Q-> 1: 40% parallel a) 8 processing cores p = 0.4 1-p = 1 - 0.4 = 0.6 s = 8 speedup = 1 / (0.6 + 0.4/8) = 1.53 b) 16 processing cores p = 0.4 1-p = 1 - 0.4 = 0.6 s = 16 speedup = 1 / (0.6 + 0.4/16) = 1.6 Q-> 1: 67% parallel a) 2 processing cores p = 0.67 1-p = 1 - 0.67 = 0.33 s = 2 speedup = 1 / (0.33 + 0.67/2) = 1.503 b) 4 processing cores p = 0.67 1-p = 1 - 0.67 = 0.33 s = 4 speedup = 1 / (0.33 + 0.67/4) = 2.01 Q-> 1: 90% parallel a) 4 processing cores p = 0.9 1-p = 1 - 0.9 = 0.1 s = 4 speedup = 1 / (0.1 + 0.9/4) = 3.076 b) 8 processing cores p = 0.9 1-p = 1 - 0.9 = 0.1 s = 8 speedup = 1 / (0.1 + 0.9/8) = 4.70
What is SCAN scheduling?
An HDD I/O scheduling algorithm in which the disk head moves from one end of the disk to the other performing I/O as the head passes the desired cylinders; the head then reverses direction and repeats
What is SSTF (Shortest Seek Time First) scheduling?
An HDD I/O scheduling algorithm that sorts requests by the amount of seek time required to accomplish the request; the shortest time has the highest priority
What is the difference between character devices and block devices?
An I/O device that has a character (byte) as its smallest I/O unit An I/O device that is randomly accessible, with block-size chunks being the smallest I/O unit.
How did the introduction of interrupts help to facilitate the concept of multiprogramming?
An interrupt facility allows the I/O devices to signal the system only when service of some type is required, freeing the CPU for other work.
What is spooling?
Another technique used by batch multiprogramming OS's to compensate further for the mismatch between CPU speed and slower I/O devices
What is the main advantage of the layered approach to system design? What are the disadvantages of the layered approach?
As in all cases of modular design, designing an operating system in a modular way has several advantages. The system is easier to debug and modify because changes affect only limited sections of the system, rather than touching all sections of the system. Information is kept only where it is needed and is accessible only within a defined and restricted area, so any bugs affecting that data must be limited to a specific module or layer It is difficult to exactly assign of functionalities to the correct and appropriate layer. Because of having too many layers, performance of the system is degraded. The main disadvantage is that the OS tends to be less efficient than other implementations.
What is the difference between batch serial, batch multiprogramming, multitasking and multiprocessing?
Batch Serial: Runs one job at a time Batch Multiprogramming: Multiple processes in memory simultaneously via interleaved execution Multi-tasking: Supports multiple users interacting with the OS or programs while they are executed to decrease response time Multiprocessing: Supports the management of multiple CPU's to execute user processes
What is the difficulty of implementing the shortest time remaining next algorithm?
Because we will not know the length of the next CPU burst that a process will perform.
Why is memory stall a problem?
Cause the CPU is waiting for the information to be fetched.
Explain the difference between concurrency and parallelism.
Concurrency: Supports more than one tasking by allowing all the tasks to progress in no specific order Parallelism: Supports multiple tasks to be progressed simultaneously
Describe the actions taken by a kernel to context-switch between processes:
Context switching between kernel threads typically requires saving the value of the CPU registers from the thread being switched out and restoring the CPU registers of the new thread being scheduled.
A _____________________________ is hardware that transfers data between the computer system and a specific device, and communicates with the device driver via a set of device registers
Device Controller
What are the 3 principal problems involved in supporting a virtual memory system?
Efficient management of page fetching and replacement is crucial for optimizing memory usage, minimizing page faults, and maintaining overall system performance. Various algorithms, policies, and techniques have been developed to address these issues and enhance the efficiency of memory management in operating systems.
Why do some systems store the operating system in firmware, while others store it on disk?
For certain devices, such as handheld PDAs and cell phones, a disk with a file system may not be available for the device. In this situation, the operating system must be stored in firmware.
What is the difference between and I/O bound process and a CPU bound process and why do we care?
I/O: are processes characterized by long periods of performing I/O (waiting) interspersed with short periods of executing CPU: are processes characterized by long periods of calculations (using the CPU) interspersed with short periods of i/O (waiting)
What system calls have to be executed by a command interpreter or shell in order to start a new process on a UNIX system?
In Unix systems, a fork system call followed by an exec system call need to be performed to start a new process. The fork call clones the currently executing process, while the exec call overlays a new process based on a different executable over the calling process.
How is a real time processes different than and interactive or batch process?
In batch processing processor only needs to busy when work is assigned to it. In real time processing processor needs to very responsive and active all the time
What is the difference between paging and segmentation?
Paging divides the virtual address space and physical memory into fixed-size pages, while segmentation divides the virtual address space of a process into logical segments of variable sizes.
What is the context of a process?
Information that must be preserved in a process. If not correctly preserved, the "paused" process can never resume execution
What is the role of the I/O scheduler?
It assesses the status of each device. to manage and optimize the order in which input/output (I/O) requests are serviced by a computer's storage subsystem, typically involving hard drives or solid-state drives (SSDs).
How does paging help to reduce/eliminate internal and external fragmentation?
Paging eliminates external fragmentation by allowing the system to allocate memory in a non-contiguous manner. Memory is divided into fixed-size pages, and processes are allocated pages wherever there are available free pages.
How is paging used to support a virtual memory system?
Paging is a fundamental technique used to support virtual memory systems. Virtual memory allows a computer system to allocate more memory to processes than what is physically available in the main memory (RAM). Paging facilitates this by dividing the logical address space of a process into fixed-size blocks called pages, which are mapped to physical memory.
How is a semaphore different from a mutex lock?
a semaphore allows multiple threads to access a resource up to a certain limit, while a mutex lock ensures exclusive access to a resource, allowing only one thread at a time.
What are the 3 requirements a solution to the critical section problem must satisfy?
Mutual Exclusion, Progress, and Bounded Waiting
How did operating systems evolve?
Operating systems evolved by increasing the number of processes and users that are able to be ran simultaneously across multiple systems.
Why did operating systems evolve?
Operating systems evolved to accommodate rapid technological advancements in computing.
What is a preemptive algorithm vs a non-preemptive algorithm?
Preemptive scheduling is when a process transitions from a running state to a ready state or from a waiting state to a ready state. Non-preemptive scheduling is employed when a process terminates or transitions from running to waiting state.
What is Batch Multiprogramming Operating Systems?
Primary concern was productivity, and resource utilization. Multiple processes in memory simultaneously, sharing the CPU via interleaved execution.
What is the difference between priority inversion and priority inheritance?
Priority inversion is the scheduling problem when low-priority process holds a lock needed by a higher-priority process, while priority inheritance solves this problem.
Some computer systems provide multiple register sets. Describe what happens when a context switch occurs if the new context is already loaded into one of the register sets. What happens if the new context is in memory rather than in a register set and all the register sets are in use?
The CPU current-register-set pointer is changed to point to the set containing the new context, which takes very little time. If the context is in memory, one of the contexts in a register set must be chosen and be moved to memory, and the new context must be loaded from memory into the set. This process takes a little more time than on systems with one set of registers, depending on how a replacement victim is selected.
What is controlled sharing?
Resources should be allocated under the direction of the OS in a way that is considered fair to all processes
What is Batch Serial Operating System?
Runs one job at a time. Primary focus was decreasing CPU idle time.
Which of the scheduling algorithms that we have discussed favors short processes?
Shortest Job Next
What facilities must the OS provide to support convenient use?
Standardized interfaces Standardized system calls common device drivers
What is an operating system?
a software that manages a computer's hardware. Provides a basis for application programs and acts as an intermediary between the computer user & the computer hardware.
Which of our algorithms are subject to starvation?
Static Priority, Dynamic Priority Scheduling, Shortest Job Next, and Round Robin.
How is the base register used and how can it participate in both protection and relocation?
The base register, also known as the relocation register or segment base register, is a hardware register used in memory management. It holds the base address or starting address of a memory segment. The base register participates in both protection and relocation by allowing the operating system to enforce memory protection by controlling access to memory segments and by facilitating the relocation of programs or data by adjusting the base register to point to different memory locations.
How is the scheduling of real time processes different from regular user processes?
The scheduling of real-time processes differs from regular user processes in that real-time processes have strict timing constraints and deadlines that must be met, while regular user processes do not have such stringent requirements. Real-time processes are often scheduled using priority-based algorithms to ensure timely execution, while regular user processes are typically scheduled based on fairness or other factors.
In what ways are real time processes different from interactive or batch processes?
The scheduling of real-time processes differs from regular user processes primarily due to the strict timing requirements and guarantees associated with real-time systems. Real-time processes have specific deadlines that must be met, and they are typically scheduled based on priorities to ensure timely execution. In contrast, regular user processes are typically scheduled based on factors such as fairness, response time, or throughput, without strict timing constraints.
What is FCFS scheduling?
The simplest scheduling algorithm. The thread that requests a core first is allocated the core first.
What is a context switch?
The switching of the CPU from one process or thread to another; requires performing a state save of the current process or thread and a state restore of the other.
How does the use of a paging cache help to decrease the # of memory accesses in a paging environment?
The use of a paging cache, also known as a Translation Lookaside Buffer (TLB), helps decrease the number of memory accesses in a paging environment by storing recently accessed page table entries. When a virtual-to-physical address translation is required, the TLB is checked first, allowing for faster retrieval of the corresponding physical address and reducing the need to access the page table in main memory.
What is the role of the PCB?
To store all the information about a process into a data structure used by computer operating systems
Know the importance of the "resident loader" (resident monitor).
Used JCL (job control language) to know how to execute the program contained in a job.
What is the purpose of system calls?
allow user-level processes to request services of the operating system.
How can deadlock occur?
When two or more processes are waiting indefinitely for an event that can be triggered by one of the waiting processes
Can either the rate monotonic or earliest deadline first scheduling algorithm starve real time processes?
Yes, but if implemented correctly they should not
Is it possible to have concurrency but not parallelism? Explain.
Yes, we can have concurrency processes or threads but at the same time, they are not parallel. Concurrency shows that more than one process or thread is progressing at the same time. However, it does not indicate that the processes are running at the same time.
What is the purpose of a volume descriptor?
a component of a file system that serves as a metadata structure used to describe and organize the contents of a storage volume or device. The primary purpose of a volume descriptor is to provide information about the volume's characteristics and organization, allowing the operating system or file system to locate and access the files stored on that volume.
What is the role of the process control block (PCB)?
a data structure used by computer operating systems to store all the information about a process.
What is multitasking?
a logical extension of multiprogramming. the CPU executes multiple processes by switching among them, but the switches occur frequently, providing the user with a fast response time.
What is a child process?
a process created by a parent process in operating system using a fork() system call
How are threads and child processes different?
a process takes place in different memory spaces, whereas a thread executes in the same memory space.
List five services provided by an operating system and explain how each creates convenience for users. In which cases would it be impossible for user-level programs to provide these services? Explain your answer.
a. Program execution. The operating system loads the contents (or sections) of a file into memory and begins its execution. A user level program could not be trusted to properly allocate CPU time.\ b. b. I/O operations. Disks, tapes, serial lines, and other devices must be communicated with at a very low level. The user need only specify the device and the operation to perform on it, while the system converts that request into device- or controller-specific commands. User-level programs cannot be trusted to access only devices they should have access to and to access them only when they are otherwise unused. c. File-system manipulation. There are many details in file creation, deletion, allocation, and naming that users should not have to perform. Blocks of disk space are used by files and must be tracked. Deleting a file requires removing the name file information and freeing the allocated blocks. Protections must also be checked to assure proper file access. User programs could neither ensure adherence to protection methods nor be trusted to allocate only free blocks and deallocate blocks on file deletion. d. Communications. Message passing between systems requires messages to be turned into packets of information, sent to the network controller, transmitted across a communications medium, and reassembled by the destination system. Packet ordering and data correction must take place. Again, user programs might not coordinate access to the network device, or they might receive packets destined for other processes. e. Error detection. Error detection occurs at both the hardware and software levels. At the hardware level, all data transfers must be inspected to ensure that data have not been corrupted in transit. All data on media must be checked to be sure they have not changed since they were written to the media. At the software level, media must be checked for data consistency; for instance, whether the number of allocated and unallocated blocks of storage match the total number on the device. There, errors are frequently process-independent (for instance, the corruption of data on a disk), so there must be a global program (the operating system) that handles all types of errors. Also, by having errors processed by the operating system, processes need not contain code to catch and correct all the errors possible on a system.
Using Amdahl's Law, calculate the speedup gain of an application that has a 60 percent parallel component for (a) two processing cores and (b) four processing cores.
a. With two processing cores we get a speedup of 1.42 times. b. With four processing cores, we get a speedup of 1.82 times.
What is the role of a device driver in performing I/O?
acts as a bridge between the operating system and a hardware device, enabling the system to communicate with and control the device. It handles tasks such as device initialization, providing a standardized interface for the operating system to interact with the device, managing device resources, and configuring device settings. plays a critical role in facilitating input/output operations and ensuring proper integration and functionality of hardware devices within the operating system environment.
What is the purpose of a Device Control Block (DCB)?
data structure used by an operating system to manage and control communication with a specific device or peripheral
What would cause a process to progress from state to state?
depends on the state the process is going to and from
What is the difference between dynamic relocation and static relocation?
dynamic relocation involves adjusting memory addresses or resolving symbols at runtime, while static relocation (static linking) combines all necessary code into an executable file during the compilation or linking process, eliminating the need for dynamic relocation at runtime.
What issues are involved with fetching a page from secondary storage, or selecting a page for replacement?
efficient page fetching and replacement strategies, considering the characteristics of the storage system and access patterns, are essential to maintain an optimal balance between memory utilization and system performance in a virtual memory environment.
What is Real Time Operating systems?
embedded, executing processes subject to strict timing constrains to support external events.
How is processor affinity important?
enables applications to bind or unbind a process or a thread to a specific core or to a range of cores or CPUs
What is Multi-tasking Operating Systems?
interactive. Supports multiple users interacting with the OS or programs while they execute. Primary focus is decreasing response time. Responding to individual commands or requests as quickly as possible. Multiple processes in memory simultaneously taking turns using the cpu, subject to a strict time limit.
How is interrupt drive I/O different from polling?
interrupt-driven I/O relies on hardware interrupts to notify the CPU of device readiness or completion, allowing the CPU to perform other tasks. Polling, on the other hand, involves the CPU constantly checking the device's status, which can be less efficient and result in higher CPU utilization. Interrupt-driven I/O is generally considered more efficient and responsive compared to polling, as it minimizes CPU overhead and allows for asynchronous handling of I/O operations.
What is LOOK scheduling?
nscheduling algorithm is different it doesn't move the arm the full width of the disk with each pass. is implemented such that the arm stops with the final request in each direction and then immediately reverses direction without going all the way to the end of the disk.
How is a virtual address translated into a page# and offset?
o translate a virtual address into a page number and offset, the virtual address is divided into two parts: the higher-order bits represent the page number, which is used as an index into the page table, while the lower-order bits represent the offset within the page, indicating the specific location within the page that is being accessed.
What is a source of overhead in the scheduling process?
occurs whenever the OS is executing instead of a process.
What is the purpose of the command interpreter? Why is it usually separate from the kernel?
reads the command from the user or from a file of commands and executes them, usually by turning them into one or more system calls. It is usually not a part of the kernel service since the command interpreter is subject to changes.
What is CSAN scheduling?
scheduling algorithm provides a more uniform waiting time by scanning from the beginning of the disk to the end servicing requests as it goes, and them immediately returns to the beginning of the disk without servicing any requests, and begins again.
What are segments, and how segmentation allows the physical address space of a process to be non-contiguous.
segments refer to logical divisions of a process's address space that represent different parts of the program or data. Segmentation allows the physical address space of a process to be non-contiguous by mapping each segment to a different physical memory location, allowing flexibility in memory allocation and facilitating the use of variable-sized data structures.
Why is FCFS not always the best scheduling algorithm for a set of pending disk operations?
servicing these set of requests in order involves many arm movements.
What is the difference between static and dynamic allocation?
static allocation assigns memory to a program before execution, while dynamic allocation acquires and releases memory during program execution based on runtime needs. Dynamic allocation provides more flexibility but requires appropriate memory management to avoid issues such as memory leaks or fragmentation.
what is a batch operating system?
systems that executed jobs, followed by the emergence of time-shared systems that ran user programs, or tasks.
What happens during polling?
the CPU continuously checks the status of a device or register associated with it. It initializes the I/O operation, enters a polling loop, and checks the device's status in each iteration. If the device is ready or a specific event has occurred, the CPU performs the data transfer or operation. The process continues until the desired condition is met.
What is meant by batch computing?
the method computers use to periodically complete high-volume, repetitive data jobs
What is the purpose of a device/event flag?
to communicate with the I/O scheduler serves as a signaling mechanism between different parts of a program or between different threads/processes.
Scheduling algorithms for real time processes must be preemptive. Why?
to ensure timely and predictable execution of critical tasks. Preemptive scheduling allows the operating system to interrupt lower-priority processes and allocate CPU time to higher-priority tasks when necessary.
How does the kernel transfer control to the correct interrupt handler?
transfers control to the correct interrupt handler through a mechanism called interrupt vectoring
Why would a process ever become blocked?
when it is waiting for some event, such as a resource becoming available or the completion of an I/O operation.
What is a race condition and why is it an issue?
when multiple processes access, modify, or manipulate the same data structure simultaneously. The issue with race conditions is that they can lead to unexpected and incorrect results. When multiple parts of a program are racing to access and modify shared data without proper coordination, the order in which these actions occur can become unpredictable