[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [f-cpu] TLB design



On Sun, Jul 14, 2002 at 08:12:19PM +0200, Cedric BAIL wrote:
> > I've been thinking about the TLB before; IMHO, we need at least the
> > following (assuming <n> bits for the page offset):
> > 
> > 	- virtual address (64-<n> bits)
> > 	- physical address (64-<n> bits)
> > 	- address space identifier (ASI; 8 bits was suggested)
> > 	- supervisor access rights (RWX, 3 bits)
> > 	- user access rights (RWX, 3 bits)
> > 	- valid bit (indicating that the entry is valid)
> > 	- present bit (indicating that the page is in memory)
> What did you mean whith this bit ?

If the bit is set, the page is mapped to physical ram. If it is
cleared, a page fault occurs.

> > 	- dirty bit (indicating that the page has been written to)
> Same question.

It's used for memory management inside the OS. If a page is dirty, it
must be written back to permanent storage; if it's not, it can be
simply discarded to make room for something else.

> > 	- used bit (indicating that the page has been accessed)
> Why not a counter ? I currently don't see how the OS can make it's decision
> about how to remove a TLB entry if TLB is full.

A counter would be more expensive (and would take more bits).

The OS will have to scan (and reset) the `used' bits on a regular basis
(e.g. inside a (slow) timer interrupt) and record the entries that have
been used. The entry that has been used least recently can be replaced.

> > The latter can be used to implement an LRU algorithm.
>  
> > That is, we need 128+2*<n>-18 bits. If an entry shall fit into 128 bits,
> > <n> must be at least 9 (i.e. a page must have at least 512 bytes).
> > With 4K pages, we will have 6 bits left. Some (or all) of them may be
> > used to indicate the page size.
> That's a really nice idea in fact. But what did this bit mean, are they
> number of Ko for a page, or predefined size page ?

Anything you like. I'd say: pagesize = 4K << sizebits; but that is my
personal opinion.

-- 
 Michael "Tired" Riepe <Michael.Riepe@stud.uni-hannover.de>
 "All I wanna do is have a little fun before I die"
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/