内存问题

  • 主题发起人 主题发起人 DaHan
  • 开始时间 开始时间
最初由 雪连天 发布
请正面回答,系统管理内存的开销?管理1024M和256M开销差异在何处,既然你学过‘操作系统’的话。

内存管理是操作系统的事,跟cpu没关系,而且不是那一代奔腾,386就已经是32位地址总线,支持至4g内存;

我的看法,大容量内存带来的好处正是对应用程序而言,内存调用更加高效,相信在vista之后的支持下更加明显。所谓的‘开销’改成是收益还差不多。

地址总线扩展寻址,那个和直接寻址的效率差太多,当年dos 640k以下还都是扩展寻址的呢,现在的windows就只支持4g内存,和微软程序员的水平没关系,觉得不是拿出例子。

xp如果缺省设置下不做优化,256M勉强够用,再来个大程序就听你的硬盘响吧。photoshop随便开个图片不占百兆以上?
好哇, 等我有时间我给你把LINUX的源码拿出来,让你看看,有什么区别,好不好!这不是书本的知识.
我说的地址总线扩展是说,已经是36位了,不是说32位,请看看INTEL的白皮书,PowerPC也有类似情况,所以才有所谓的16G, 首先是CPU支持,才是操作系统.
 
这就是linux kernel source code and comment, please try by yourself to count what is the difference,
just like what it said "we have no way to track which tasks are using a page", if we add double link list to
track the page, we need more!!
if we used 64 bits, that means one pointer is 64 bits(8 bytes), in double link list we use at least 2 pointers,
that means we add 16 bytes in one page structure, could you tell me how many memory we used?

/*
* Each physical page in the system has a struct page associated with
* it to keep track of whatever it is we are using the page for at the
* moment. Note that we have no way to track which tasks are using
* a page.
*/
struct page {
page_flags_t flags; /* Atomic flags, some possibly
* updated asynchronously */
atomic_t _count; /* Usage count, see below. */
atomic_t _mapcount; /* Count of ptes mapped in mms,
* to show when page is mapped
* & limit reverse map searches.
*/
unsigned long private; /* Mapping-private opaque data:
* usually used for buffer_heads
* if PagePrivate set; used for
* swp_entry_t if PageSwapCache
* When page is free, this indicates
* order in the buddy system.
*/
struct address_space *mapping; /* If low bit clear, points to
* inode address_space, or NULL.
* If page mapped as anonymous
* memory, low bit is set, and
* it points to anon_vma object:
* see PAGE_MAPPING_ANON below.
*/
pgoff_t index; /* Our offset within mapping. */
struct list_head lru; /* Pageout list, eg. active_list
* protected by zone->lru_lock !
*/
/*
* On machines where all RAM is mapped into kernel address space,
* we can simply calculate the virtual address. On machines with
* highmem some memory is mapped into kernel virtual memory
* dynamically, so we need a place to store that address.
* Note that this field could be 16 bits on x86 ... ;)
*
* Architectures with slow multiplication can define
* WANT_PAGE_VIRTUAL in asm/page.h
*/
#if defined(WANT_PAGE_VIRTUAL)
void *virtual; /* Kernel virtual address (NULL if
not kmapped, ie. highmem) */
#endif /* WANT_PAGE_VIRTUAL */
};
 
后退
顶部