Protection refers to a mechanism which controls the
access of programs, processes, or users to the resources defined by a computer
system. Need of Protection:
- To prevent the access of unauthorized users and
- To ensure that each active programs or processes in the system uses resources only as the stated policy,
- To improve reliability by detecting latent errors.
Hardware protection is divided into 3 categories: CPU
protection, Memory Protection, and I/O protection. These are explained as
following below.
CPU Protection
OS must prevent the user program from getting stuck in
an infinite loop or not calling system services and never return control to
CPU. For this purpose timer is used which interrupts the CPU after specified
periods to ensure OS maintains control. The timer period may be variable or
fixed. A fixed rate clock and a counter is used to implement a variable timer.
The OS initialzes the counter with some positive number. The counter is
decremented with every clock tick. When counter reaches 0, a timer interrupt is
generated and control is transfer is to next process. Thus timer is used to
prevent the program from running too long.
Memory Protection
The area of a memory where process resides is known as
process address space. OS ensures that a process cannot access memory address
outside its address space. That is, a process is not allowed to access other
process address space. Therefore, there is a need to determine the range of
legal addresses a process can access. Using two registers, OS provide this memory
protection. These register are
- 1 Base Address: holds the smallest legal address
- 2. Limit Register: specifies the size of range
WWhen a process is loaded into the memory, the base address is initialized with starting address of the process address space and limit register is initialized with its size. Memory outside the range is protected by having hardware that compare every address generated in user mode with the register. Any attempt to access the memory outside range treated as a fatal error.
I/O ni h
ReplyDeleteMam disk space management-contiguous or noncontiguous memory allocation
ReplyDeleteStratergy plz describe