List two challenges an operating system faces when passing parameters between user and kernel mode (e.g., consider the differences between passing parameters via procedures in the same process versus between processes/applications). Describe how an operating system can overcome them.
A system is said to be in user mode if the operating system is running a user application. If the system is booted and some preserved instructions are executed for operating system then it is said to be in Kernel mode.
Two challenges an operating system can face when passing parameters between user and kernel mode are:
1. The numbers of parameters passed should be limited to six.
2. The size of the parameters should fit within the size of the registers. In other words, size of the parameters should not exceed the size of the registers.
To overcome such challenges, before a system call, the parameters
has to be saved in registers. A system call is basically a program
requested by the kernel. On the other hand, in User mode, the CPU
is allowed to access some portion of memory and also less
peripheral devices. But in Kernel mode, the CPU has privilege to
access the memory as well as peripheral devices (additional
devices). Thus to avoid the parameter passing challenges, the CPU
may shift from User mode to Kernel mode. To switch from User mode
to Kernel mode, a TRAP instruction has to be executed, which will
result the CPU to switch to Kernel mode. Before this switching, the
previous instruction locations have to be saved so that after
completion of the work in Kernel mode, the user's remaining work
can be continued.
Get Answers For Free
Most questions answered within 1 hours.