Why must the operating system be more careful when accessing input to a system call (or producing the result) when the data is in memory instead of registers ?
The operating system may access memory without restriction (as opposed to user mode where memory access is highly regulated by the OS… we hope). When the data is in memory the OS must be careful to ensure that it is only accessing data that it needs to, since carelessness might result in overwriting data pertaining to still-running user mode functions, breaking their operating when the OS shifts scope from kernel mode back to user mode.
Operating System
- asked 9 years ago
- B Butts
2Answer
The operating system needs to verify that the memory being written to / read from is a valid address, owned by the process making the request. It must prevent processes from corrupting other processes, or reading memory owned by other processes.
The operating system much take care with inputs from memory as:
a) The address given by the application as the address of the input or output could be
- an address of an illegal area of memory
- an address of a legal area that is paged to disk
b) or, could change if the application is multithreaded.
Basically, the operating system must ensure that it cannot be corrupted, crashed, or bypassed as a result of accessing memory as directed by the application.
- answered 7 years ago
- Community wiki
When the operating system accesses memory it does so without restriction where as in user land, memory access is tightly controlled. If a system call is pointing to memory rather than using registers operating systems must ensure that the user-land application have the correct permissions to access the specified memory locations. As the user could be maliciously or unwittingly be attempting to access another processes memory or even the memory which holds the kernel, which could cause security breaches,corruption of the kernel or corruption of other processes. All of which will result in an unstable and malfunctioning operating system.
- answered 7 years ago
- Community wiki
Your Answer