4001 test 2 before the dam final
A memory page containing a heavily used variable that was initialized very early and is in constant use is removed, then the page replacement algorithm used is ____________
FIFO
Which of the following page replacement policy - algorithm suffers from Belady's Anomaly?
FIFO
Increasing the RAM of a computer typically improves performance because ____________
Fewer page faults occur
How does the concept of dirty pages (dirty bits=1) can help save time during page replacements?
If a page frame hasn't been modified then there is no need to swap it out. Only swap in is needed.
A process address space has 20 pages, and they are all full. The process then calls malloc() to allocate 1 byte. That 1-byte allocation causes the OS to allocate a whole new page to the process. What is this situation called?
Internal fragmentation
What is paging?
It is a memory management scheme that divides both logical and physical memory into equal-sized regions.
Which one of the following is true for the second-chance (clock) page-replacement algorithm?
It is implemented with a circular list. It uses the reference bit of each page.
What is the optimal page-replacement policy?
It replaces the page that will not be used for the longest period of time.
How the Linux' Completely Fair Scheduler uses a red-black tree to ensure that higher-priority processes are more likely to run than lower-priority processes?
It uses a red-black tree as a priority queue of processes. Here, tree nodes are sorted by the virtual runtime of the processes, with the process that has consumed the least amount of CPU time being the leftmost node in the tree.
A thread is also known as:
Light-weight process
What is demand paging?
Loading a page into memory only on a page-fault.
The CPU generates _____ addresses.
Logical
The modern linux scheduler (i.e. the completely fair scheduler) maintains a "timeline" of future task execution. The timeline is keyed by how much time a task has used the processor. What is the data structure used by this scheduler to implement a "timeline" of future task execution?
Red-Black Tree data structure.
The modern linux scheduler (The completely fair scheduler) maintains a "timeline" of future task execution. The timeline is keyed by how much time a task has used the processor. What is the data structure used by this scheduler to implement a "timeline" of future task execution?
Red-black tree
The modern linux scheduler (i.e., the completely fair scheduler) maintains a "timeline" of future task execution. The timeline is keyed by how much time a task has used the processor. What is the data structure used by this scheduler to implement a "timeline" of future task execution?
Red-black tree
Which of the following operations would most likely need to be inside a critical section?
Reduce the value of a shared variable by 1.
Which is the optimal page-replacement policy?
Replace page not used for longest time in future.
What is the Optimal page - replacement algorithm?
Replace the page that will not be used for a long time
Which of the following scheduling algorithms is the most suitable for interactive systems?
Round Robin
Which of the following process scheduling algorithm may lead to starvation?
Shortest Job First
What is a "dirty bit" in a page-table entry?
Shows its been modified after brought into memory
What is the time complexity of selecting the memory location from a free-frame list?
THETA (1)
For 3 page frames, the following is the reference string:7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1 How many page faults does the LRU page replacement algorithm produce?
10
For 3 page frames, the following is the reference string: 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1 How many page faults does the LRU page replacement algorithm produce?
12
Consider the following pages that are requested by a process under a FIFO page-replacement policy: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6 The main memory has 4 page-frames. What is the number of page faults generated by the above sequence?
14
Applying the LRU page replacement to the following reference string. 1 2 4 5 2 1 2 4 The main memory can accommodate 3 pages and it already has pages 1 and 2. Page 1 came in before page 2. How many page faults will occur?
4
A process refers to 5 pages, A, B, C, D, E in the order : A, B, C, D, A, B, E, A, B, C, D, E. If the page replacement algorithm is FIFO, the number of page transfers with an empty internal store of 3 frames is?
9
The following program consists of 3 concurrent threads and 3 binary semaphores. The semaphores are initialized as S0 = 1, S1 = 0, S2 = 0. Thread T0 while(true) { wait(S0); print '0'; signal(S1); signal(S2); } Thread T1 wait(S1); signal(S0); Thread T2 wait(S2); signal(S0); How many times will P0 print '0'?
>=2
In the context of thread synchronization, an un-interruptible unit (or instruction) is known as :
Atomic
Given a set of processes to run on a single-core computer, why do we expect the Round-Robin scheduler to be slower in general than the FIFO scheduler in terms of overall completion time?
Because of the time required to switch in Round Robin.
A set of processes run on a single-core computer. In this case, why do we expect the Round-Robin scheduler to be slower in general than the FIFO scheduler in terms of overall completion time?
Context switch takes time
A memory-efficient implementation of fork() uses the paging scheme to allow parent and child to share the same page in memory until one modifies the page. What is this technique called?
Copy-on-write
For what types of workloads and quantum lengths does SJF deliver the same response times as RR?
Workloads that are pre-sorted by (increasing) completion time and workloads having the same completion time.
For what types of workloads does SJF scheduler deliver the same turnaround times as FIFO?
Workloads that are pre-sorted by (increasing) completion time and workloads having the same completion time.
To ensure difficulties do not arise in the readers - writers, problem _______ are given exclusive access to the shared object.
Writers
Consider two processes. Is it possible for both processes to have some of their virtual memory addresses refer to the same location in RAM?
Yes, aka shared memory. This happens when the OS uses shared pages in the paging system.
All threads share a semaphore variable mutex, initialized to 1. Each thread must execute wait(mutex) before entering the critical section and signal(mutex) afterward. Suppose a thread executes in the following manner. wait(mutex); ..... critical section ..... wait(mutex);
a deadlock will occur
A page fault occurs when?
a page cannot be accessed due to its absence from memory
When a process begins execution with no pages in memory?
a page fault occurs for every page brought into memory
In multilevel feedback scheduling algorithm:
a process can move to a different classified ready queue
If the kernel is single threaded, then any user level thread performing a blocking system call will :
cause the entire process to block even if the other threads are available to run
Multithreading an interactive program will increase responsiveness to the user by :
continuing to allow the program to run even if a part of it is blocked
The aim of creating page replacement algorithms is to ____________ (....... AND ......)
decrease the page fault rate
Virtual memory is normally implemented by ________ (not cpu)
demand paging
In paging, which of the following fields of the page table indicate that a page has been modified while in memory?
dirty bit
Describe the paging scheme of memory management
divides a process's memory into fixed-size pages and stores them in non-contiguous locations in main memory. The page table maps virtual addresses to physical addresses.
Virtual memory allows ____________
execution of a process that may not be completely in memory
The FIFO algorithm what does it do?: (literally)
first executes the job that came in first in the queue
Which scheduling algorithm allocates the CPU first to the process that requests the CPU first?
first-come, first-served scheduling
Thread synchronization is required because: all threads of a process share the same address space all threads of a process share the same global variables all threads of a process can share the same files all of the mentioned
all of the mentioned
Error handler codes, to handle **unusual** errors are ____________
almost never executed
How can we build a mutex lock using semaphores?
initializing a semaphore with a count of 1
A process is thrashing if ____________
it is spending more time paging than executing
Optimal page - replacement algorithm is difficult to implement, because ...
it requires knowledge of future memory references, which is impossible to predict accurately.
If the semaphore value is negative, we can infer that:
its magnitude is the number of threads waiting on that semaphore
Which algorithm chooses the page that has not been used for the longest period of time whenever the page required to be replaced?
least recently used algorithm
The aim of creating page replacement algorithms is to ...
manage which pages to swap out from memory to maximize system performance.
Many-to-One model of thread management defines:
many user level threads to one kernel level threads. concurrency
The One-to-One threading model allows: ...
mapping of each user-level thread to a kernel-level thread. MORE CONCURRENCY MULTILEVEL PROCESSORs
Process are classified into different groups in:
multilevel queue scheduling algorithm
If a thread is executing in its critical section, them no other thread can be executing in the corresponding critical section. What is this condition called?
mutual exclusion
In the One to One model when a thread makes a blocking system call :
other threads are allowed to run
The register context and stacks of a thread are deallocated when the thread:
terminates
The ability to execute a program that is only partially in memory has benefits like ____________
the amount of physical memory cannot put a constraint on the program
The OS maintains a free-frame list for _________
the entire system (i.e., all processes)
LRU page - replacement algorithm associates with each page the ______
the time of that page's last use
A FIFO replacement algorithm associates with each page the ...
time at which it was brought into memory and replaces the oldest page first when the memory is full.
LRU page - replacement algorithm associates with each page the ...
time at which it was last accessed and replaces the least recently used page first when the memory is full.
A FIFO replacement algorithm associates with each page the _______
time it was brought into memory
With round robin scheduling algorithm in a time shared system,
using very large time slices converts it into First come First served scheduling algorithm
What is thrashing? In detail
when a computer's performance suffers due to excessive paging, which happens when the system spends too much time swapping pages in and out of memory instead of executing instructions.
What is Belady's anomaly?
when giving more page frames to a process can raise its page-fault rate due to a page-replacement algorithm evicting a page that will be needed soon, which goes against optimal page replacement policy.
What situation will certainly reduce a process' performance? Give an example Large I/O Frequent I/O Copy from RAM to Disk Copy from Disk to Ram
when the process is starved of resources, such as CPU time or memory. EX: Frequent I/O.
The following program follows to use a shared binary semaphore T. Thread A int Y; A1: Y = X*2; A2: X = Y; signal(T); Thread B int Z; B1: wait(T); B2: Z = X+1; X = Z; T is set to 0 before either thread begins execution. X is set to 5. Now, how many different values of X are possible after both threads finish executing?
1
Which of the following is true for the second- chance (clock) page-replacement algorithm?
A modification of the FIFO algorithm that provides a second chance to a page before it is replaced. It uses a circular buffer and a reference bit
In a pure demand-paging scheme, all pages of processes are first stored into the hard drive. Pages are brought one by one as needed by the processes. Considering a page table with a dirty bit for each page. How can a clock policy save time during page swapping operations?
By preferentially replacing a page that have dirty bit = 0.
The OS maintains a page table for __________
Each process
Consider the page table of a process. The table contains virtual addresses that map the process' address space. Is the virtual memory listed in the table entirely mapped in RAM?
NO, Some pages may be swapped out to the hard drive if they are not actively being used. some virtual memory may be in disk
The OS swaps the content of an array to the hard drive. Can a process read or update the content of the array without using the RAM?
No, not without RAM. The content must be brought back into the RAM before it can be read or updated.
The OS swaps the content of an array to the hard drive. Can a process read or update the content of the array without using the RAM?
No. Data must be in RAM to be accessed by the process.
What is time quantum
OS scheduling algorithms, process can run for a fixed time before being switched to different process
In FIFO page replacement algorithm, when a page must be replaced, the ...
Oldest page in memory is chosen for replacement. "First-In, First-Out" algorithm.
The instruction being executed, must be in ...
PHYSICAL MEMORY - main memory (RAM) to be executed by the CPU.
When using the paging approach for memory management, the RAM consists of page frames while a page frame is a memory area of the same size as a ....................................
Page
Which option below describes the multi-level feedback-queue scheduling method.
Processes are moved between ready queues, and their priority is changed based on the analysis of their behavior by the scheduler, such as their execution time.
All threads share a semaphore variable mutex, initialized to 1. Each thread must execute wait(mutex) before entering the critical section and signal(mutex) afterward. Suppose a thread executes in the following manner. signal(mutex); ..... critical section ..... wait(mutex); In this situation :
several threads maybe executing in their critical section
Each page-table entry has a bit known as the "present bit". If the present bit is set to one, it means the page is present in physical memory; if it is set to zero, the page is not in memory but rather on disk somewhere. What happens when the process attempts to access a page that has a "present bit" set to 0?
The system will issue a page-fault.
What is the principle of locality?
The tendency of programs to access a small set of memory locations at any given time. It consists of two parts: temporal locality, which is the reuse of recently accessed data, and spatial locality, which is the use of data stored near recently accessed data.
What is the name of the state of the OS described by the following text: A main goal of OS schedulers is to maximize CPU utilization, i.e., if the CPU is detected to be idle, the scheduler will schedule a new process to run. Assume that there are no free pages in main memory. When a process repeatedly asks for non-resident pages, the OS's virtual-memory sub-system will swap pages in and out of main memory. During swapping, the CPU becomes idle and the scheduler initiates another process to run. This new process will need its pages to be loaded into main memory, which causes more page faults. This cycle repeats causing the entire system to slow down significantly.
Thrashing
What is thrashing and how does it happen?
Thrashing takes place when the OS spends more time performing page replacement than actually executing processes.
What are the components of a thread?
Thread Id, Program counter, Register set and Stack.
Where is the mapping between the process' virtual and physical memory stored?
stored in the page table, maintained by operating system.
What is a mutex lock?
synchronization mechanism to ensure that only one thread is accessing a shared resource at any given time. It is used to prevent data inconsistency and race conditions.
When is the dirty bit set?
When a page is modified
Which one of the following is not a valid state of a thread?
parsing
The instruction being executed, must be in ____________
physical memory
Virtual Memory allows ...
programs to use more memory than is physically available by temporarily transferring pages of data from RAM to disk.
The processes that are residing in main memory and are ready and waiting to execute are kept on a list called:
ready queue
Time quantum is defined in this algortihm:
round robin scheduling algorithm
Describe the optimal page-replacement policy in detail
selects the page that won't be used for the longest time in the future, resulting in the lowest page-fault rate for a given memory access pattern.