1 vote
1
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.$
2
Degree of concurrency in threads can be arranged in the manner One-to-one > many-to-one > many-to-many One-to-one > many-to-many > many-to-one Many-to-many > many-to-one > one-to-one None of the above answer given is A but according to me answer is B. Someone please confirm
3
Which two are valid constructions for Thread? Thread(Runnable r, String name) Thread() Thread(int priority) Thread(Runnable r, ThreadGroup g) Thread(Runnable r, int priority) $1$ and $3$ $2$ and $4$ $1$ and $2$ $2$ and $5$
1 vote
4
Operating System maintains the page table for : each process each thread each instruction each address
1 vote
5
One of the disadvantages of user level threads compared to Kernel level thread is If a user level thread of a process executes a system call, all threads in that process are blocked. Scheduling is application dependent. Thread switching doesn’t require kernel mode privileges. The library procedures invoked for thread management in user level threads are local procedures.
6
Consider a system in which it is desired to separate policy and mechanism for the scheduling of kernel threads. Propose a means of achieving this goal.
7
In a system with threads, is there one stack per thread or one stack per process when user-level threads are used? What about when kernel-level threads are used? Explain.
8
If a multithreaded process forks, a problem occurs if the child gets copies of all the parent’s threads. Suppose that one of the original threads was waiting for keyboard input. Now two threads are waiting for keyboard input, one in each process. Does this problem ever occur in single-threaded processes?
9
Assume that you are trying to download a large $2$-GB file from the Internet. The file is available from a set of mirror servers, each of which can deliver a subset of the file’s bytes; assume that a given request specifies the starting and ending bytes of the file. Explain how you might use threads to improve the download time.
10
When an interrupt or a system call transfers control to the operating system, a kernel stack area separate from the stack of the interrupted process is generally used. Why?
11
Consider a system that has two CPUs, each CPU having two threads (hyperthreading). Suppose three programs, $P0, P1,$ and $P2$, are started with run times of $5, 10$ and $20$ msec, respectively. How long will it take to complete the execution of these programs? Assume that all three programs are $100\%$ CPU bound, do not block during execution, and do not change CPUs once assigned.
12
Which of the following are NOT shared by the threads of the same process? Stack Registers Address space Message queue a and d b and c a and b a, b and c
1 vote
13
Given that a computer system has only 3 process.1st process is single threaded, 2nd process is two threaded and 3rd process is 4 threaded.So total how many number of page tables will be managed by the operating system?
14
User level threads doesnot require context switching- This is a true statement (Because OS cannot recognize user level threads) Can somebody elaborate more on it?? This given answer is wrong I think:https://gateoverflow.in/290648/made_easy_test_series Plz check
15
A system provides support for user-level and kernel-level threads. The mapping in this system is one to one (there is a corresponding kernel thread for each user thread). Does a multithreaded process consist of $(a)$ a working set for the entire process or $(b)$ a working set for each thread ? Explain
16
Consider the following code segment: pid t pid; pid = fork(); if (pid == 0) { /* child process */ fork(); thread create( . . .); } fork(); a. How many unique processes are created? b. How many unique threads are created?
17
A system with two dual-core processors has four processors available for scheduling. A CPU-intensive application is running on this system. All input is performed at program start-up, when a single file must be opened. Similarly, all output is performed just before the ... the input and output ? Explain. How many threads will you create for the CPU-intensive portion of the application ? Explain.
18
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.
19
Is it possible to have concurrency but not parallelism ? Explain.
1 vote
20
Can a multithreaded solution using multiple user-level threads achieve better performance on a multiprocessor system than on a single processor system ? Explain.
1 vote
21
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