Question
Operating System a. What is the meaning of the term busy waiting? What other kinds of waiting are there in an operating system? Can busy
Operating System a. What is the meaning of the term busy waiting? What other kinds of waiting are there in an operating system? Can busy waiting be avoided altogether? Explain your answers. (5 pts) b. Explain why spinlocks are not appropriate for single-processor systems yet are often used in multiprocessor systems. (5 pts) c. Using the program shown below, explain what the output will be at lines X and Y. Assume that you have a pre-emptive priority system. (10 pts) #include #include #inculde #define SIZE 5 int nums[SIZE] = {0,1,2,3,4}; int main() { int i; pid_t pid; pid = fork(); if (pid ==0) { for (i =0; i < SIZE; i++) { nums[i] *= -i; printf(CHILD: %d ,nums[i]); /*LINE X */ } } else if (pid > 0) { wait (NULL); for (i = 0; i < SIZE; i++) printf(PARENT: %d ,nums[i]); /* LINE Y */ } return 0; } Part2 Consider a system with 3 physical frames of memory that is given the following page memory reference sequence (20 pts): 1, 3, 6, 7, 1, 3, 6, 7, 1, 3, 6, 7 What is the number of page faults that would occur for each of the following page replacement algorithms? a. An optimal page replacement algorithm (7 pts) b. LRU (7 pts) c. Does an optimal page replacement algorithm exist that does not require future knowledge for cyclical memory reference sequences such as shown above? If so, give a general algorithm. If not, explain why. (6 pts) 1) Consider a machine with a physical memory of 8 GB, a page size of 8 KB, and a page table entry size of 4 bytes. How many levels of page tables would be required to map a 46-bit virtual address space if every page table fits into a single page? Be explicit in your explanation. (5 points) 2) List the fields of a Page Table Entry in your scheme. (5 points) 3) Without a cache or TLB, how many memory operations are required to read or write a single 32-bit word? (5 points) 4) How much physical memory is needed for a process with three pages of virtual memory (for example, one code, one data, and one stack page)? (5 points)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started