Assignment 4, due Sept 20
Part of
the homework for 22C:116, fall 2002
|
http://homepage.cs.uiowa.edu/~dwjones/opsys/threads/Under a civilized operating system's process manager, when a process is blocked awaiting completion of an input/output transfer, the system is able to schedule other processes. Unfortunately, under this thread manager, a thread that blocks awaiting keyboard input will block all other threads in the program as well.
The usual way for a C program to read a character from standard input is to call ch=getchar(); for many purposes, this is equivalent to the Unix kernel call read(0,&ch,1). (Under Unix, file descriptor zero is standard input.)
Consider the problems you would face in writing a thread_getchar(), a routine to read a character from standard input under the thread manager. This would have to allow other threads to run until a character was available on standard input.
The Problem: How could you use the select() Unix kernel call in implementing this? How could you use the O_NONBLOCK option for the open() kernel call to implement this. This question asks you to research these and describe their use in this context. Next week, you will have to actually solve the problem with one or the other of these. (See the unix man pages for documentation of these services!)
http://homepage.cs.uiowa.edu/~dwjones/arch/hawk/overview.html#tma
http://homepage.cs.uiowa.edu/~dwjones/arch/hawk/overview.html#mmudata
http://homepage.cs.uiowa.edu/~dwjones/arch/hawk/overview.html#mmu
Part A: What page replacement policies are feasible on this machine. To solve this problem, you will have to figure out what hardware support this MMU offers for page replacement policy and then list the policies (or classes of policies) that remain feasible with this support.
Part B: Hard page faults on this machine would most likely involve transfer of pages between the CPU and disk. What kind or kinds of soft page faults would the page-fault service routine on this machine need to handle.
Part C: What is the format of a page-table entry on this machine, where should the page table be stored, and does the MMU dictate any scheme for segmenting the page table?