Q6➡| TRUE/FALSE (a) Can two processes be concurrently executing the same program executable? (b) Can two running processes share the complete process image in physical memory (not just parts of it)?
Answer –
(a) TRUE, two processes can run the same program. (b) FALSE, in general. (Only time this is possible is with copy-on-write during fork, and before anywrites have been made.)
Q7➡| Consider a parent process P that has forked a child process C. Now, P terminates while C is still running. Answer yes/no, and provide a brief explanation. (a) Will C immediately become a zombie? (b) Will P immediately become a zombie, until reaped by its parent?
i ➥ (a) True
ii ➥ (a) False
iii ➥ (b)True
iv ➥ ii,iii
Answer – IV (a) No, it will be adopted by init. (b) Yes.
Q8➡| Which of the following C library functions do NOT directly correspond to (similarly named) system calls? That is, the implementations of which of these C library functions are NOT straightforward invocations of the underlying system call? (a) system, which executes a bash shell command. (b) fork, which creates a new child process. (c) exit, which terminates the current process. (d) strlen, which returns the length of a string.
Q9➡| Which of the following actions by a running process will always result in a context switch of the running process, even in a non-preemptive kernel design? (a) Servicing a disk interrupt, that results in another blocked process being marked as ready/runnable. (b) A blocking system call. (c) The system call exit, to terminate the current process. (d) Servicing a timer interrupt.
Q10➡| Consider a process P that needs to save its CPU execution context (values of some CPU registers) on some stack when it makes a function call or system call. Which of the following statements is/are true? (a) During a system call, when transitioning from user mode to kernel mode, the context of the process is saved on its kernel stack. (b) During a function call in user mode, the context of the process is saved on its user stack. (c) During a function call in kernel mode, the context of the process is saved on its user stack. (d) During a function call in kernel mode, the context of the process is saved on its kernel stack.
Q11➡| Which of the following statements is/are true about a context switch? (a) A context switch from one process to another will happen every time a process moves from user mode to kernel mode (b) For preemptive schedulers, a trap of any kind always leads to a context switch (c) A context switch will always occur when a process has made a blocking system call, irrespective of whether the scheduler is preemptive or not (d) For non-preemptive schedulers, a process that is ready/willing to run will not be context switched out
Q16➡| Which one of the following is FALSE? (a) User level threads are not scheduled by the kernel (b) When a user level thread is blocked, all other threads of its process are blocked (c) Context switching between user level threads is faster than context switching between kernel level threads. (d) Kernel level threads cannot share the code segment
i ➥ Saving the state of one process and restoring the state of another process so that the CPU moves from running one process to running the other.
ii ➥ Any change in state of a process as it executes.
iii ➥ The change which occurs on the stack of a running process as it makes a function call, including the allocation of memory for any parameters and the local variables.
iv ➥ The switch between a process running in user mode to running in kernel mode. This can happen as the result of a system call or an exception.
Q20➡| Given three processes A, B, and C with corresponding burst times 20, 5, and 2, what is the average waiting time with a first come first served (FCFS) scheduler? All processes are ready to run at the same time but they arrived in the order A, B, then C.
i ➥ 3
ii ➥ 15
iii ➥ 25
iv ➥ 9
Answer – II The Gantt chart for the given schedule is;
Q27➡| Assume three jobs arrive at approximately the same time, but Job A arrives slightly before Job B, and Job B arrives slightly before job C. Job A requires 2 sec of CPU, Job B is 8 secs, and Job C is 7 secs. Assume a time-slice of 1 sec. Given a FIFO scheduler, what is the turnaround time of job B?
Q29➡| Which of the following C library functions do NOT directly correspond to (similarly named) system calls? That is, the implentations of which of these C library functions are NOT straightforward invocations of the underlying system call? (a) system (b) fork (c) exit (d) strlen
i ➥ Only (a)
ii ➥ Only (d)
iii ➥ Only (a), (d)
iv ➥ Only (b),(d)
Answer – III
(a) system, which executes a bash shell command. (b) fork, which creates a new child process. (c) exit, which terminates the current process. (d) strlen, which returns the length of a string. Ans: (a), (d)