From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 30 13:36:26 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5241E1065677 for ; Wed, 30 Jul 2008 13:36:26 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.174]) by mx1.freebsd.org (Postfix) with ESMTP id E00C38FC28 for ; Wed, 30 Jul 2008 13:36:25 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-064-179-170.pools.arcor-ip.net [88.64.179.170]) by mrelayeu.kundenserver.de (node=mrelayeu3) with ESMTP (Nemesis) id 0MKxQS-1KOBqp48bc-0001qu; Wed, 30 Jul 2008 15:36:24 +0200 Received: (qmail 25450 invoked from network); 30 Jul 2008 13:36:23 -0000 Received: from fbsd8.laiers.local (192.168.4.151) by router.laiers.local with SMTP; 30 Jul 2008 13:36:23 -0000 From: Max Laier Organization: FreeBSD To: freebsd-hackers@freebsd.org Date: Wed, 30 Jul 2008 15:36:22 +0200 User-Agent: KMail/1.9.52 (FreeBSD/8.0-CURRENT; KDE/4.0.83; i386; ; ) References: <591f70e00807300459j74aac11eob0bea7cdf4b4dcd4@mail.gmail.com> In-Reply-To: <591f70e00807300459j74aac11eob0bea7cdf4b4dcd4@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200807301536.23274.max@love2party.net> X-Provags-ID: V01U2FsdGVkX19y5j+W0mioxmOB6dSWctC5/bSSlUFOa0veF3J BmCXCBIZb5tKCH90GF7NHBDtH3unTqEd1pcVx2aCa1g676LYs1 XI2fxUJlW/JMNUCl4YBOg== Cc: FreeBSD Hackers Subject: Re: General questions about virtual memory X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2008 13:36:26 -0000 Hi, On Wednesday 30 July 2008 13:59:53 FreeBSD Hackers wrote: > Examples of some specific questions that I have include: > > WRT translation of virtual addresses to physical addresses, where does the > hardware stop and the software begin? Explanation: who determines the > format of the page tables (CPU or OS)? Who populates and maintains the > page tables? Where does the translation lookaside buffer reside? Who > maintains the TLB? it depends ... different architectures use different models. In i386 most of the above is done by hardware aided by software (i.e. the software has to flush the hardware TLB when it knows that the entries are no longer up to date ...) > Also WRT page tables, how does the OS and the MMU adjust for different > sizes of physical RAM? Wouldn't the page tables for a system with 512 MB > of RAM will be fewer than the page tables for a system with 2 GB of RAM? > How does the CPU know how many page table entries there are? This suggest that you don't understand virtual memory at all. Go back to the start of the chapter and re-read. The page directories and page tables describe a *virtual* address space. For a given architecture the *virtual* address space has a fixed size (4GB for i386), so the page table structure is always the same size (though it might be sparsely populated). Inside the page table you store *physical* addresses, the size of which is defined by the hardware. Also note that the physical addresses of your RAM might not necessarily start at zero and go for XX MB ... you need additional bookkeeping to track that (see core map, free lists, ...). The size of the PTE is defined by hardware and doesn't change at runtime. > I have a few more questions, but for starters this is the kind of > information I'm seeking. I'm just not getting a clear enough picture from > the textbook I'm reading now. (It makes me wish I was still in college so > I could dump my questions on my college professor. :) > > If anyone is willing to help me understand this, I would greatly appreciate > it. I would also value your input if there are other resources (people, > mailing lists, books, web pages, etc.) that you want to recommend instead > of taking some time to help teach me. google, wikipedia, the FreeBSD articles, ... all there at your fingertips. -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News