Answered You can hire a professional tutor to get the answer.

QUESTION

Operating System Questions Q.1 a) Why need system calls?

b) Explain how a system call utilizes interrupts, user and monitor modes, and privileged instructions. What is achieved in return? Explain your understanding.

------------------------------------------------

Q.2 Consider a preemptive operating system where processes have priorities and a running process gets preempted (i.e., forced to leave the CPU) as soon as a higher priority process is ready to run. The life cycle of a process, other than the very first process, begins with a "spawn" by another process and ends with either a regular "exit" by the process or a "terminate (process_id)" command by another process of equal or higher priority.

Each process is assigned an initial priority at spawn time and this priority remains unchanged during the entire life cycle. There are system resources, both hardware and software, for which a process can block if the resource is not free. A process can also be suspended by another process of equal or higher priority through the call "suspend (process_id)''. A suspended process is resumed by the call "resume (process_id)''. Note that a process can be in any state (i.e., running, blocked or ready) when suspended.

Processes communicate with one another via "send'' and "receive'' message passing primitives. "Receive'' is always blocking, i.e., the calling process blocks if the message is not available. "Send'' is always non-blocking. Illustrate the complete life-cycle of a process with the help of a process state transition diagram.

------------------------------------------------

Q.3. When there is a context switch from one process to another, the OS kernel invokes the function ContextSwitch which saves the context of the currently executing process into its PCB and then inserts the process to an appropriate queue (i.e., ready queue or a blocked queue). It is necessary that ContextSwitch is atomic (i.e., unbreakable: either done or not-done; nothing in between). Explain the following:

a) Why must ContextSwitch be atomic?

b) Give an example scenario of what can go wrong if ContextSwitch is not atomic.

c) How can it be made atomic in practice?

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question