Recent questions tagged operating-system

operating-system cpu-scheduling . someone please guide me how to approach this problem.
Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes: /* P1 */ while (true) { wants1 = true; while (wants2 == true); /* Critical Section */ wants1 = false; } /* ... IT IS WRITTEN PROGRESS IS THERE? In the case when both wants1 and wants2 are true it will indefinitely be postponed then why progress is there?
Suppose our computer requires 2048x16 bytes of RAM and 512x16 bytes of ROM. Design the necessary hardware using 512x16 byte RAM and 256x16 byte ROM chips
1 vote
Which of the following statement(s) is/are correct in the context of $\text{CPU}$ scheduling? Turnaround time includes waiting time The goal is to only maximize $\text{CPU}$ utilization and minimize throughput Round-robin policy can be used even when the $\text{CPU}$ time required by each of the processes is not known apriori Implementing preemptive scheduling needs hardware support
A data file consisting of $1,50,000$ student-records is stored on a hard disk with block size of $4096$ bytes. The data file is sorted on the primary key $\textrm{RollNo}$. The size of a record pointer for this disk is $7$ bytes. Each student-record has ... disk. Assume that the records of data file and index file are not split across disk blocks. The number of blocks in the index file is ________
1 vote
Consider the following multi-threaded code segment (in a mix of C and pseudo-code), invoked by two processes $P_1$ and $P_2$, and each of the processes spawns two threads $T_1$ and $T_2$: int x = 0; // global Lock L1; // global main () { create a thread to execute foo() ... will print the value of $y$ as $2.$ Both $T_1$ and $T_2$, in both the processes, will print the value of $y$ as $1.$
Consider a computer system with multiple shared resource types, with one instance per resource type. Each instance can be owned by only one process at a time. Owning and freeing of resources are done by holding a global lock $(L)$. The following scheme ... deadlocks will not occur The scheme may lead to live-lock The scheme may lead to starvation The scheme violates the mutual exclusion property
Consider a three-level page table to translate a $39-$bit virtual address to a physical address as shown below: The page size is $\text{4 KB} \;(1\text{KB}=2^{10}$ bytes$)$ and page table entry size at every level is $8$ bytes. A process $P$ is currently ... $2\text{GB}$ of physical memory. The minimum amount of memory required for the page table of $P$ across all levels is _________ $\text{KB}$.
In the context of operating systems, which of the following statements is/are correct with respect to paging? Paging helps solve the issue of external fragmentation Page size has no impact on internal fragmentation Paging incurs memory overheads Multi-level paging is necessary to support pages of different sizes
Which of the following standard $C$ library functions will always invoke a system call when executed from a single-threaded process in a $\text{UNIX/Linux}$ operating system? $\textsf{exit}$ $\textsf{malloc}$ $\textsf{sleep}$ $\textsf{strlen}$
1 vote
Consider a linear list based directory implementation in a file system. Each directory is a list of nodes, where each node contains the file name along with the file metadata, such as the list of pointers to the data blocks. Consider a given directory $\textsf{foo}$. Which of ... file from $\textsf{foo}$ Renaming of an existing file in $\textsf{foo}$ Opening of an existing file in $\textsf{foo}$
Three processes arrive at time zero with $\text{CPU}$ bursts of $16,\;20$ and $10$ milliseconds. If the scheduler has prior knowledge about the length of the $\text{CPU}$ bursts, the minimum achievable average waiting time for these three processes in a non-preemptive scheduler (rounded to nearest integer) is _____________ milliseconds.
Consider the following pseudocode, where $\textsf{S}$ is a semaphore initialized to $5$ in line $\#2$ and $\textsf{counter}$ is a shared variable initialized to $0$ in line $\#1$. Assume that the increment operation in line $\#7$ is $\textit{not}$ ... $0$ after all the threads successfully complete the execution of $\textsf{parop}$ There is a deadlock involving all the threads
I think the answer should be B). S1 is incorrect. This is because TLB needs to be saved on a context switch. TLB stores frame numbers of frequently referred pages and therefore it has to be updated on a context switch between the process. We cannot simply flush it for a process going out. Please clarify. Thanks!
I think the answer should be 22 MB. We get Page Table Entry size = (22/8) B Page table size = 2^23 * 22/8 B = 22 MB. Why have they rounded 22/8 as 3B? Answer should be 22 MB and not 24 MB. Please clarify. Thanks!
1 vote
as per my knowledge of information in multicore systems we use spinlocks so that while one thread is busy waiting on while loop other thread can work on Critical section. my question is in gate question when busy waiting is being used using while loop do we always ... while one process is busy waiting no other process can work on CS. like in this qsn https://gateoverflow.in/1839/gate2006-61
How is the answer LIFO? If I take the following example: Process Arrival Time Burst Time Priority P0 0 3 1 P1 0 5 1 P2 3 3 1 P3 6 4 1 Now we know that the priority is dynamic and so if we draw the Gantt chart: P0 P1 P0 P1 P0 .. 0-1 1-2 2- ... P0 has completed first (first out) but it is the first to arrive. LIFO is clearly not being followed. Can someone clairify how the answer is LIFO? Thanks!
I think the answer should be 65%. They say 8 processes arrive in 60 seconds. That means the first process will arrive at the time instant t = 7.5s. Now at the time t = 60s, 8th process will be arriving. However till this mark, 7 processes are finished. So this means, idle time = 60 - ... = 60 - 21 = 39s % of time CPU is idle = (39/60) * 100 = 65% Please clarify once if I am correct or not. Thanks!
Hello, I have following doubts: Can User Level Threads run in parallel in multiprocessor system? What problem will we be facing if we access I/O devices in user mode? Can anyone please explain? Thank you!
How is the option C) satisfy bounded waiting? I mean, there can be a case where the process Q keeps on executing the while loop while process P doesn’t even get the chance. Bounded waiting is the number of times/bounds after which a process gets the chance to enter the critical section. The above code clearly does not support bounded wait, even with option C. Can anyone explain? Thanks!
Is there any good resources for Virtual Memory because i’m not able to do the question based on calculating effective memory access time in case of page fault,tlb miss and cache miss ?
this code does not provide ME Progress Bounded Waiting it is a correct synchronization problem given answer is (d) but how it is free from starvation
with a multilevel feedback scheduler,high priority jobs are placed at top level queue and low priority at bottom level queue is this statement True/False?
My answer is 2^53 bytes but it says the answer is 2^34;
Options are a = (6,1) b=(10,4,5) a=(1,5,6) b=(1,5,4,10) a= (5,6) b=(10,4,5) a=(6,1) b=(10,4,5,1)
Is random page replacement a stack algorithm? Is belady’s anomaly applicable here?
#OS Memory Management Question on Paging and Translation Look-aside Buffer (TLB)
#OS Memory Management question of Cache access time
Standard book is saying peteson's solution satisfies all the properties (M.E, progress, bounded waiting..) Let's say solution for two processes are: bool flag[2] = {false, false}; int turn; P0: flag[0] = true; P0_gate: turn = 1; while (flag[1] == ... not having any process in critical section; In the end both end up in infinite loop then how it is an valid solution to critical section? Thanks.
Can Peterson’s solution to the mutual-exclusion problem works for non-preemptive scheduling?
Highest Response Ratio Next CPU Scheduling Algorithm behaves like Shortest Process Next When _____________. Burst Time of all Process is same Burst Time of all Process are different Arrival time of all Process is same Arrival time of all Process are different
What is difference between bounded waiting and busy waiting?
What are minm number of resources req for no dead lock if 3 user process ask for 2 unit of resource? I got ans as 6 but ans given 4. Why?
Consider a simple system running a single process. The size of physical frames and logical pages is 16 bytes. The RAM can hold 3 physical frames. The virtual addresses of the process are 6 bits in size. The program generates the following 20 virtual address ... achievable in this example, assuming an optimal page replacement algorithm were to be used? Repeat (2) above for the optimal algorithm.
A computer system has a page size of 1,024 bytes and maintains the page table for each process in main memory. The overhead required for doing a lookup in the page table is 500 ns. To recude this overhead, the comnputer has a TLB that caches 32 ... physical frame mappings. A TLB lookup requires 100ns. What TLB hit-rate is required to ensure an average virtual address translation time of 200ns?