Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

191
Views
Determining TASK_SIZE from c Program

TASK_SIZE is a kernel constant that defines the upper limit of the accessible memory for the code working at the lowest privilege level.

Its value is usually set to 0xc0000000 on systems with less than 1GB of physical memory (all examples included in this article refer to this value). The memory above this limit contains the kernel code .

Is there a way to determine the running kernels TASK_SIZE through c program ??

TASK_SIZE

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

After a lot of google search and analysis , i got a logic

Assume net virtual address are 4gb and the it is divided in 1:3 ratio.

Rough assumptions:-

Kernel (upper 1 gb): c0000000 -ffffffff

USer space (below 3gb):0-c0000000

than

   #define GB *1073741824
   unsigned int num;
   unsigned int task_size;
   task_size=(unsigned)&number+ 1 GB / 1 GB * 1GB;

[the process's stack area will be allocated below the kernel space]

so address of num (in stack)= somewhere around in 3 GB range ex:[3214369612]

now adding 1 GB = 1073741824+3214369612=4288111436

dividing by 1GB=3.993614983 that will be 3 (unsigned int)

now multiplying by 1GB = 3 *1073741824 = 3221225472 i.e. (0xC0000000 in hex)

hence i got the kernel starting address (TASK_SIZE)

I tried it assuming (2:6) ratio also and got correct result.

Is this a fair logic ,Please comment ???

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!