×

Operating System Tutorial

Operating System Practice

Hardware Protection in Operating System

In this tutorial, we will learn about the hardware protection in operating system, and its categories. By Himanshu Singh Bisht Last updated : May 07, 2023

A computer contains various hardware like processor, RAM, monitor etc. So OS must ensure that these devices remain intact ( not directly accessible by the user).

Categories of Hardware Protection

Hardware protection is divided into three categories. They are:

1. CPU Protection

It means that a process should not hogg (hold) CPU forever otherwise other processes will not get the process. For that purpose, a timer is introduced to prevent such a situation. A process is given a certain time for execution after which a signal is sent to the process which makes the process to leave CPU. Hence process will not hogg the CPU.

2. Memory Protection

There may be multiple processes in the memory so it is possible that one process may try to access other process memory.

To prevent such situation we use two register:

  1. Base Register
  2. Limit Register

Base register store the starting address of the program and Limit Register store the size of the process. So whenever a process wants to access address in memory then it is checked that it can access the memory or not.

3. I/O protection

To ensure CPU protection OS ensure that below case should not occur

  • View I/O of other process
  • Terminate I/O of another process
  • Give priority to a particular process I/O

If an application process wants to access any I/O device then it will be done through system call so that OS will monitor the task.

Like In C language write() and read() is a system call to read and write on file. There are two modes in instruction execute:

  1. User mode
    The system performs a task on behalf of user application this instruction. In this mode, the user cannot directly access hardware and reference memory.
  2. Kernel mode
    Whenever a direct access to hardware is required a system call is used by the application program.



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.