Midterm CS471
Asymmetric Multiprocessing
"Boss/worker" structure • The kernel runs on a particular processor • Other CPUs execute user programs and OS utilities. • Single Processor for Kernel Data Structures. • More common in Embedded Systems
1.4. On single-processor systems, in a correct solution to the critical section problem: A) A process that does not execute a code-related to the Critical Section should not prevent others from entering the Critical Section B) Processes should enter the Critical Section in First-Come-First-Served fashion C) Some slow processes may starve D) Interrupts have to be disabled when one process is in the Critical Section
A) A process that does not execute a code-related to the Critical Section should not prevent others from entering the Critical Section
1.6. Thread P has a Semaphore S. Which of the following best describes what happens when P executes sem_signal(S)? A) The integer value associated with S will increment and a Thread blocked on S will be moved to the ready state. B) The integer value associated with S will decrement and a Thread blocked on S will be moved to the ready state. C) The integer value associated with S will increment and the calling Thread P will be blocked and added to a queue on S. D) The integer value associated with S will decrement and the calling Thread P will be blocked and added to a queue on S.
A) The integer value associated with S will increment and a Thread blocked on S will be moved to the ready state.
1.5. If a thread T1 executes the sem_wait() operation on a semaphore s: A) it moves to the waiting/sleep state if the integer value associated with s is changed to -1 B) a thread T2 that was previously blocked on s will be moved to the ready state C) T1 gets blocked by s D) T1 sends a signal to let another thread go
A) it moves to the waiting/sleep state if the integer value associated with s is changed to -1
1.4. Which of the following is shared between Processors in a Loosely-Coupled Parallel System? A. Network Connection B. Main Memory C. Registers D. Hardware Clock
A. Network Connection
1.13. Which register tells the instruction to be executed next: A. Program counter B. Stack Pointer C. Base register D. Frame Pointer
A. Program counter
1.15. Compared to five-state process model, what is one of the new states in the seven-state model? A. Ready suspend B. Blocked C. Exit D. None of the above
A. Ready suspend
1.8. In a cooperative mode, if a user program does not give up CPU, how can you re-gain the control of the system? A. Reboot B. Control^C C. Wait till it is done. D. None of the above would work.
A. Reboot
2.1. Each thread needs to have its own private area of the process' stack; This is primarily because we need to keep track of successive function calls for each thread separately. A. True B. False
A. True
2.1. The OS has a responsibility to support the primitive calls to manage directories and files. A. True B. False
A. True
2.10. The Process Control Block (PCB) for each process is stored in its own address space. A. True B. False
A. True
2.3. A race condition would pose problems for a multi-core system; it cannot occur in a singlecore system. A. True B. False
A. True
2.3. The Microkernel design focuses on keeping as many modules as possible in the user space. A. True B. False
A. True
2.6. When a Process calls a system call to use an I/O device, it will be moved into a Waiting (Blocked) Queue. A. True B. False
A. True
2.7. Breaking one of the deadlock conditions can prevent the deadlock from occurring. A. True B. False
A. True
2.7. Context-Switch time is Pure Overhead. A. True B. False
A. True
2.8. Processes may need to be swapped out to disk. A. True B. False
A. True
2.9. After fork(), the parent and the child are running concurrently. A. True B. False
A. True
1.8. Which of the following conditions are violated when starvation is present? A) Mutual Exclusion B) Bounded Waiting C) Progress D) Arbitrary Speed
B) Bounded Waiting
1.5. Why are Cache memories used? A. RAM is not directly accessible by the CPU, only the Cache is B. Cache memories speed up the average (expected) access time C. Cache is farther away from the CPU, so there is less interference than RAM for sensitive data D. Cache slows down modern RAM speeds to allow the CPU to access it more efficiently
B. Cache memories speed up the average (expected) access time
2.2. During the Interrupt Processing, the Interrupt Descriptor Table contains all the code needed to handle Interrupts. A. True B. False
B. False
2.4. Starvation implies that there is a deadlock. A. True B. False
B. False
2.4. When a Process calls fork(), it will share memory with its child Process. A. True B. False
B. False
2.5. When a CV is signaled by a thread, all the waiting processes/threads will receive the signal. A. True B. False
B. False
2.6. Atomicity-violation bugs mean that the intended/desired execution order is violated. A. True B. False
B. False
1.12. During Context Switches, the user registers of the running process are saved by A. OS B. Hardware C. The running process D. None of the above
B. Hardware
1.3. What is the advantage of Multitasking that is not present in Multiprogramming? A. Multitasking allows multiple Jobs in memory at the same time B. Multitasking allows preemptive switching of Jobs periodically C. Multitasking allows switching between Jobs when the running Job needs to wait for I/O D. Multitasking allows scheduling of Jobs on to the CPU
B. Multitasking allows preemptive switching of Jobs periodically
1.10. Which of the following is contained in the Process Control Block? A. Process Stack B. Process ID C. Process Global Data D. Process Shared Libraries
B. Process ID
1.1. Which of the following is saved as part of the Process State before the ISR executes? A. Process Heap B. Program Counter C. Global Declared Variables D. Pending I/O
B. Program Counter
1.3. Which of the following is true in a User-Level Threads model? A) Each Process Creates a Thread through Kernel-Level System Calls B) User Threads Cannot Switch to another Thread on their Own C) When one User Thread Blocks on a System Call, the entire Process is Blocked D) There will be Multiple User Threads Mapped to each Kernel Thread
C) When one User Thread Blocks on a System Call, the entire Process is Blocked
1.7. What is meant by NUMA? A. NUMA is a logical set of CPUs to manage multitasked processes on the same cores. B. NUMA allows processes to directly access RAM instead of going through the OS. C. NUMA allows CPU processors to use local memory closest to them for slightly faster access. D. NUMA is a faster storage that is checked first before going to RAM
C. NUMA allows CPU processors to use local memory closest to them for slightly faster access.
1.9. Which of the following most accurately describes the return value from fork()? A. Parent gets 0, the Child gets the PID of the Parent B. Parent gets the PID of the Child, the Child gets the PID of the Parent C. Parent gets the PID of the Child, the Child gets 0 D. Parent gets -1, the Child gets 0
C. Parent gets the PID of the Child, the Child gets 0
1.11. Which of the following Segments contains the Executable Code in the Process Address Space? A. BSS (.bss) Segment B. Data (.data) Segment C. Text (.text) Segment D. Read-Only Data (.rodata) Segment
C. Text (.text) Segment
1.1. When a user process attempts to execute the yield() syscall: A) This will cause a software interrupt B) The system will switch to kernel mode C) This will trigger a context switch performed by OS D) All of the above
D) All of the above
1.7. If a thread T executes cond_signal() on a condition variable CV: A) The value of CV is decreased by 1 in an atomic fashion B) The value of CV is increased by 1 in an atomic fashion C) T is immediately suspended D) This does not have any effect if there are no waiting threads on CV
D) This does not have any effect if there are no waiting threads on CV
1.2. Which of the following is NOT a motivating factor of the thread abstraction: A) Moore's law is ending B) The multi/many-core architectures are prevailing C) Costly inter-process communication D) Threads solely rely on message passing for inter-thread communication
D) Threads solely rely on message passing for inter-thread communication
1.6. Which of the following best describes the role of Security for the OS? A. Controlling OS processes. B. Escalating privileges for users that use sudo. C. Controlling users that are on the OS. D. Defending the system from internal and external attacks.
D. Defending the system from internal and external attacks
1.2. What can cause an Interrupt of the CPU? A. Local Procedure (Function) calls B. Pushing data to the Process' Stack C. Conditional Jump to an Instruction D. I/O Request Completion
D. I/O Request Completion
1.14. Which of the following file descriptors are opened when a new process is forked? A. stdin B. stdout C. stderr D. all the above
D. all the above
When a thread blocks, the kernel may choose another thread from the same process, or a thread from a different process. Kernel or User level
Kernel
Address Space global variables open files accounting information child processes signals and handlers thread tables
Per process items
Program Counter, Stack, Registers, state
Per thread items
multiple Threads in the same process share
The address space Open files Other resources
Symmetric Multiprocessing (SMP)
• All processors are peers • Kernel routines can execute on different CPUs, in parallel • Tightly-Coupled, running Independently
Program Status Word (PSW)
• Contains the condition code bits and various other control bits.