Showing posts with label Operating Systems. Show all posts

Under what circumstances do page fault occur? Describe the action taken by operating system when page fault occurs


  1. .
    A page fault occurs when an access to a page that has not been brought into main memory takes place. The operating system verifies the memory access, aborting the program if it is invalid. If it is valid, a free frame is located and I/O is requested to read the needed page into the free frame. Upon completion of I/O, the process table and page table are updated and the instruction is restarted.
Learn more »

How many bits would be needed to store the free-space list under the following condition if a bitmap were used to implement? a) 500,000 blocks total and 200,000 free blocks. b) 1,000,000 blocks total and 0 free blocks. Also find how much space is required if it needs to be stored in memory.


  1. a) 500,000 blocks total and 200,000 free blocks:
  2. Here, Total blocks = 500,000
    Free blocks = 200,000
    Number of bits = 500,000 bits
    If 500,000 bits needs to be stored in memory it requires (500000) 𝐾𝐡 = 488.28125 𝑀𝐡 
                                                                                                1024

b) 100,000 blocks total and 0 free blocks: Here, Total blocks = 100,000
Free blocks = 0
Number of bits = 100,000 bits
If 100,000 bits needs to be stored in memory it requires (100000) 𝐾𝐡 = 97.65625 𝑀𝐡  
                                                                                                                           1024
    Learn more »

    Which one suited, polling/interrupt, for the following types of system? Give reason. a) A system dedicated to controlling single I/O devices. b) A work station running as heavily used web server.



    A system dedicated to controlling single I/O devices:
    Polling is suited for the system dedicated to controlling single I/O device. The host repeatedly checks the busy bit on the device until it becomes clear. Polling can be very fast and efficient, if both the device and the controller are fast and if there is significant data to transfer. It becomes inefficient, however, if the host must wait a long time in the busy loop waiting for the device, or if frequent checks need to be made for data that is infrequently there.
    A work station running as heavily used web server:
    Interrupt is suited for workstation running as heavily used web server. Interrupts allow devices to notify the CPU when they have data to transfer or when an operation is complete, allowing the CPU to perform other duties when no I/O transfers need its immediate attention. The CPU has an interrupt-request line that is sensed after every instruction. The interrupt handler determines the cause of the interrupt, performs the necessary processing, performs a state restore, and executes a return from interrupt instruction to return control to the CPU.
    Learn more »

    What must user program be prohibited from writing to the memory locations containing the interrupt vector?



    An interrupt vector is the memory address of an interrupt handler, or an index into an array called an interrupt vector table that contains the memory addresses of interrupt handlers. When an interrupt is generated, the Operating System saves its execution state via a context switch, and begins execution of the interrupt handler at the interrupt vector. An interrupt handler, also known as an interrupt service routine (ISR), is a callback subroutine in operating system whose execution is triggered by the reception of an interrupt. Interrupt handlers have a multitude of functions, which vary based on the reason the interrupt was generated and the speed at which the interrupt handler completes its task. 

    An interrupt handler is a low-level counterpart of event handlers. These handlers are initiated by either hardware interrupts or interrupt instructions in software, and are used for servicing hardware devices and transitions between protected modes of operation such as system calls.
    If some program access the memory address used by interrupt vector then some interrupt may be disturbed or missed. So, this is completely unknown to operating system and hence no prevention mechanism is there and system may go into crash.
    Learn more »

    What is critical section problem? Why executive critical section must be exclusive? Explain.



    Sometimes a process have to access shared memory or files, or doing other critical things that can lead to races. That part of the program where the shared memory is accessed is called the critical section or critical region. The critical-section problem is to design a protocol that the processes can cooperate. Each process must request permission to enter its critical section. The section of code implementing this request is called entry section. The critical section may be followed by a section of code known as exit section. The remaining code is known as remainder section.
    In order to solve the critical section problem, executive critical section must be exclusive. That is, if a process P1 is executing in its critical section, then no other processes can be executing in their critical sections.
    Learn more »

    What are the attributes of Files?

    File attributes are settings associated with computer files that grant or deny certain rights to how a user or the operating system can access that file. For example, IBM compatible computers running MS-DOS or Microsoft Windows have capabilities of having read, archive, system, and hidden attributes.
    • Read - Only allows a file to be read, but nothing can be written to the file.
    • Archive - Tells Windows Backup to backup the file.
    • System - System file.
    • Hidden - File will not be shown when doing a regular dir from DOS.
    Learn more »