 |
Making
a segment known to a process
 |
When
a process first refers a segment with pathname, new segment number
is allocated by the kernel. Then the mapping (pathname, segment
number) gets recorded to the KST[segment number] of the process |
 |
Each
KST entry KST[i] contains--note that i = segment number allocated by
the kernel:
 |
pointer
to the segment descriptor
 |
actually
the segment descriptor is tagged as missing segment |
 |
later
access to this segment will trap "missing segment
fault" and segment fault handler will handle it |
|
 |
pointer
to the directory entry (= branch) |
|
 |
Now
on the process can access the segment by segment number |
|
 |
Process
refers a word by (segment number, offset in words). If DS[segment number]
has "missing segment" tag on, a trap will be issued and segment
fault handler will be called. Procedure:
 |
index
into KST[segment number] |
 |
follow
the pointer to directory entry |
 |
populate
the DS[segment number] with the values of the directory entry
 |
if
page table has not been made for the segment
 |
create
a new page table |
 |
register
[segment, page table] entry to active segment table
 |
inode
also copied to the active entry |
 |
the
size of active segment table is fixed and maybe an
existing entry should be kicked out of the table
to make a room for the new segment being activated
 |
segment
which has had no pages in main memory for
the longest time is the victim |
|
|
 |
update
directory entry so that it points the [segment, page table]
entry |
|
 |
DS[segment
number].page_table = pointer to the page table |
|
 |
=>
every information for page fault handler is in main memory |
|
 |
Note
that each process has its own DS and KST, but active segment table and
page table are shared by all processes |