10장 연습문제

Free-Frame List

To resolve page faults, most operating systems maintain a free-frame list, a pool of free frames for satisfying such requests. (free-frame pool의 구현 결과가 free-frame list이다.)

Operating systems typically allocate free frames using a technique known as zero-fill-on-demand.

free-frame list에 있는 frame을 page에 할당하기 전에 초기화(모든 값을 0으로 덮어쓰기)하여 잠재적인 문제를 방지

Zero-fill-on-demand frames are “zeroed-out” before being allocated, thus erasing their previous contents. (Consider the potential security implications of not clearing out the contents of a frame before reassigning it.)

Steps in Handling Page Fault

  1. We check an internal table (usually kept with the process control block) for this process to determine whether the reference was a valid or an invalid memory access.
  2. If the reference was invalid, we terminate the process. If it was valid but we have not yet brought in that page, we now page it in.
  3. We find a free frame (by taking one from the free-frame list, for example).
  4. We schedule a secondary storage operation to read the desired page into the newly allocated frame.
  5. When the storage read is complete, we modify the internal table kept with the process and the page table to indicate that the page is now in memory.
  6. We restart the instruction that was interrupted by the trap. The process can now access the page as though it had always been in memory.

Vfork()

With vfork(), the parent process is suspended, and the child process uses the address space of the parent. Because vfork() does not use copy-on-write, if the child process changes any pages of the parent’s address space, the altered pages will be visible to the parent once it resumes. Therefore, vfork() must be used with caution to ensure that the child process does not modify the address space of the parent.

(사용 경우)

vfork() is intended to be used when the child process calls exec() immediately after creation. Because no copying of pages takes place, vfork() is an extremely efficient method of process creation and is sometimes used to implement UNIX command-line shell interfaces.

exec() provides a new address space for the new program; it doesn’t modify the parent address space.