Looking for 2025W Operating Systems (CS-3520-01) test answers and solutions? Browse our comprehensive collection of verified answers for 2025W Operating Systems (CS-3520-01) at moodle31.upei.ca.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Consider a system that has a 16KB address space and 64 byte pages in a two-level page table. How many pages are required to store the page directory (assuming each page directory entry (PDE) is 4 bytes)?
Suppose there are two processes P1 and P2 whose 1KB address spaces are allocated in physical memory with base relocation (only base, no bounds). Suppose P1 has a base equal to 1024 and P2 has base equal to 4096. Which of the following virtual memory addresses can P1 use that will give it access P2's memory?
The following C code was our first attempt to make a lock using a flag to indicate if the lock was acquired.
typedef struct __lock_t { int flag; } lock_t;void init(lock_t *mutex) {
mutex->flag = 0;
}
void lock(lock_t *mutex) {
while (mutex->flag == 1) // TEST the flag
; // spin-wait (do nothing)
mutex->flag = 1; // now SET it !
}
void unlock(lock_t *mutex) {
mutex->flag = 0;
}
How will this code perform in terms of correctness and efficiency?