<![CDATA[Latest posts for the topic "Hỏi về công thức tính max thread trong kernel ?"]]> /hvaonline/posts/list/24.html JForum - http://www.jforum.net Hỏi về công thức tính max thread trong kernel ? Every process under Linux is dynamically allocated a struct task_struct structure. The maximum number of processes which can be created on Linux is limited only by the amount of physical memory present, and is equal to (see kernel/fork.c:fork_init()): /* * The default maximum number of threads is set to a safe * value: the thread structures can take up at most half * of memory. */ max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 2; which, on IA32 architecture, basically means num_physpages/4. As an example, on a 512M machine, you can create 32k threads. This is a considerable improvement over the 4k-epsilon limit for older (2.2 and earlier) kernels.  Nhưng mình chưa hiểu lắm về công thức & vd của nó, từ 512 MB Ram làm sao nó có thể tính ra là 32k threads nhỉ ?]]> /hvaonline/posts/list/8105.html#47170 /hvaonline/posts/list/8105.html#47170 GMT Hỏi về công thức tính max thread trong kernel ? /hvaonline/posts/list/8105.html#47177 /hvaonline/posts/list/8105.html#47177 GMT Hỏi về công thức tính max thread trong kernel ?

Golden Autumn wrote:
Max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 8 In from beginning for the i386, THREAD_SIZE=2*PAGE_SIZE, PAGE_SIZE=2^12 (4KB), mempages= /PAGE_SIZE size of physical memory, 256M of memory machines mempages=256*2^20/2^12=256*2^8 when the largest number of threads 4096. Dành cho kernel 2.4 , Kernel 2.6 mình không biết, chắc tìm tài liệu về Kernel mới khám phá được nó .  
Mình vẫn có 1 số thắc mắc Thứ 1 :
mempages= /PAGE_SIZE size of physical memory 
Đoạn này là sao nhỉ ? bạn ghi chưa rõ lắm Thứ 2 là
256M of memory machines mempages=256*2^20/2^12=256*2^8 when the largest number of threads 4096. 
con số 2^20 ở đâu ra vậy bạn ? với lại cuối cùng tại sao bạn ko /8 theo công thức nhỉ ? ]]>
/hvaonline/posts/list/8105.html#47185 /hvaonline/posts/list/8105.html#47185 GMT
Re: Hỏi về công thức tính max thread trong kernel ? /hvaonline/posts/list/8105.html#47465 /hvaonline/posts/list/8105.html#47465 GMT Hỏi về công thức tính max thread trong kernel ? /hvaonline/posts/list/8105.html#47501 /hvaonline/posts/list/8105.html#47501 GMT