Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

5. (10 pts) We saw in class that after a process executes handlers for pending s

ID: 3890340 • Letter: 5

Question

5. (10 pts) We saw in class that after a process executes handlers for
pending signals (with the operating system's help), it transfers control
to the OS to let the OS carry out some bookkeeping. Following this,
the process resumes its execution from where it had last left o . Why
is this transition to the OS needed and what kind of bookkeeping does
the OS do? We saw in class that traps are synchronous" events while
interrupts may be synchronous?" Make sure you understand what
this means. What about signals - would you consider them synchronous
or asynchronous and why?

Explanation / Answer

Explanations are basically based on a linux operating system.

A transition is needed because in Linux, application processes are preemptive. A process in the user mode can always be preempted at any point in time, but it cannot be arbitrarily preempted when it is in the kernel mode even though Linux 2.6 is a preemptive kernel. In some situations, kernel executions become non-preemptive.' The kernel though can take a preemption decision anytime, but it reschedules the preemption for a later time when the kernel comes out of the non-preemption mode.

For bookkeeping part, When Linux has taken a preemption decision, it executes the CPU scheduler (the schedule kernel function) to choose the next process to run on the current CPU. Linux follows a priority-based multi-level queue with feedback scheduling algorithm. When a process becomes runnable, Linux checks whether the priority of this newly runnable process is greater than that of the running process. If yes, Linux takes a scheduling decision. A process can also be preempted if its present allocation of running time is over. Of course, if a running process completes its execution or blocks itself, the CPU is allocated to another process. Linux supports two schedulers, namely 0(1) scheduler and completely fair scheduler (CFS).

About signals, the signal is the simplest of all asynchronous interprocess communication schemes in Linux. Signals are used to inform occurrences of a priori known events to one or mom user processes. (Kernel processes do not communicate through signals.) The kernel also uses signals to notify user processes occurrence of exceptions. For example, when a process commits an address violation, the kernel sends the process a SIGSEGV signal. Linux supports a limited number of signals; the number varies from platform to platform even though POSIX defines only 20 signals. POSIX also defines real-time signals. Linux supports both normal and real-time signals.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote