A page fault occurs when a page that is requested is not loaded into memory by Operating System. This page fault can be handled in 6 steps as mentioned below.1.
Firstly, check the memory address that is requested by the process in order to make sure that the page that is requested is a valid one.2. If the request is valid one then the page is paged in. If it is not valid then the program must be stopped.3. If it is a valid request then follow these steps.
Consider the list that contains free frames to locate a free frame.4. Extract the required page from the disk by scheduling the disk operation (bringing the missing page into memory).5. The page is now in memory. Hence, update the page table of current process with new frame number as soon as the I/O operation completes. Also, change the invalid page reference such that it is a valid reference now.6.
Lastly, when this process gets its turn to execute on the CPU, restart the instruction that caused the page fault from the beginning to execute it properly.2.) What particular information does the invalid bit keep track of?In particular, the invalid bit keeps track of the illegal page addresses i.e., the pages that are not present in the program’s logical address space or memory. Usually all the entries in the page table comes with a valid bit or an invalid bit.
These bits are used to trap the illegal addresses. If the operating system sets the bit to be “invalid”, then it means that the particular page is not permitted to be accessed. When the bit is set as “valid”, then the page is permitted to be accessible.3.) What is the benefit of copy on write?The advantage of Copy on Write is that it reduces copying by just creating the pointers to the data. That is the copy of an object is not necessarily made until it is shared. Using copy on write we can create a number of read-only copies of data/page/object until any one of the processes (including the original process) attempt to write to the data/page/object respectively. Now a days, copy on write is utilized in implementing fork() system call efficiently.
4.) Describe the difference between a hard link and a symbolic link.Hard Link: Hard link contains the inode of a particular document. It is like a pointer to the file. Whenever we make changes in actual document or its hard link, the changes will be reflected in both the files (because hard links contain the actual content of the file). The benefit of hard link is that it allows us to put same document in different places in the system.
The hard links can only refer to a document that is present in its own file system but not in the directory. Symbolic Link: Symbolic link is nothing but the actual link to the original file or document. If the original file is deleted, then the symbolically linked file will also be deleted (because the symbolic link is a path to original file). It acts as a pointer to a specific document present in a folder. Unlike the hard link where we cannot create link to directory, using symbolic links we can create links to directory. In other words these links are also known as shortcuts.Thrashing is the state of Operating System in which there is immoderate overhead. Thrashing also results in intensive degradation in the performance of the CPU.
The reason for this is excessive paging. This means that memory has been used too much to perform unnecessary activities which made it too limited to execute other required processes. During thrashing, the CPU spends more of its time on swapping pages. Thrashing usually occurs when the physical memory becomes ineffective in holding the workload.Emulation and paravirtualization are two types of virtualization techniques. Emulation is also known as hardware virtualization. Emulator has a special software called hypervisor which is used to emulate/simulate the complete hardware for OS in a single server.
This hardware is presented to the guest Virtual Machine. That is the emulated hardware is visible to VM but not the original hypervisor. Emulation makes the VM to run on any hardware. Examples of hardware emulators are VirtualPC for Mac, Bochs etc.Paravirtualization is a technique in which a physical hardware is changed and then presented to the guest VM by hypervisor (which is opposite to that of hardware emulator). When paravirtualization is used, the guest VM will have accessibility to few features of physical hardware. It gives us high performance. Here, hypercalls are trapped and serviced by the hypervisor.
Example of paravirtualization is VMWare, Xen.Buffer overflow attack is the state in which the buffer overflow is misused by the program written by the user. The program writes to some memory address on the stack that is not acceptable to be modified by the user. Such cases usually occur in the programming languages in which array bound checking is not executed efficiently. When a buffer overflow attack occurs, it often results in program crash. It can be misused by writing or modifying the precious values in the call stack of the target machine by the modifier or attacker. This may lead to execution of the attacker’s own code which may be dangerous to the entire system.
He/she might take the control of the system by creating buffer overflow attacks.