Operating System

Explain how memory protection is achieved by operating system ?

Memory protection is a hardware mechanism that an operating system uses to control access rights to a computer’s memory. It prevents processes from accessing memory that hasn’t been allocated to them, which protects the system from bugs and malware. Memory protection can be achieved using hardware or software techniques, including: Base and limit registers, Access control bits, Memory management unit (MMU), and Virtual memory. 

Memory protection separates different parts of memory and ensures that each process can only access its own memory space. For example, a word processing program can only use or alter data that is located in its designated segment. If a program tries to access RAM outside of its segment, the OS terminates the implementation to stop unauthorized access to additional segments. 

An attempt to access unauthorized memory results in a hardware fault, such as a segmentation fault or storage violation exception, which generally causes abnormal termination of the offending process. 

Here are some examples of memory protection:

  • Contiguous memory allocation: Each process is allocated a contiguous block of memory
  • Fixed partitions: A technique used to allocate memory to processes as they request it
  • Variable partitions: A technique used to allocate memory to processes as they request it
  • Paging: A technique used to allocate memory to processes as they request it
  • The principle of least privilege: All users should work without administrator rights
  • Protection systems: Deploy on all physical and virtual computers

Leave a Reply

Your email address will not be published. Required fields are marked *