Process related question

Hi all,

Consider the foll. piece of code:

char *p = (1MB) of storage

main()
{

  *p = 200;
  printf(" val = %d", *p)
}

Lets say I get a file a.out which needs to be run.

Please help me understand certain things:
1) how this file would be laid out in memory.
2) Since this would be a file, what filesystem
   related activities would be done (inode ?)
3) Stack allocation and virtual addr. space (conceptual).

In essence I would like to understand the various OS
related actions with reference to a simple program like the above sttored on disk.

Regards,
ASM
arutAsked:
Who is Participating?
 
gheistConnect With a Mentor Commented:
1) any assumptions about memory layout other than using pointers to access various allocations are at least non-portable, just as you cannot assume that all small allocations are one page in size etc.
2) most systems use rtld (runtime loader, in linux - ld.so) which mmap() s files and libraries into memory, but it does not
3) read (1), stack layout depends on processor
0
 
arutAuthor Commented:
Hi All,

I am not making any assumptions, but rather want to understand the concepts. I have a a.out and run it.

What are the actions that the kernel would take?

Regards,
Arut
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
sunnycoderCommented:
Hi Arut,

The link I posted gives all those details. pls check the link
0
 
gheistCommented:
Any actions that execve() system call does.... (man execve to find out more), described in (2) and not in the checkable link
0
 
sunnycoderCommented:
ghiest
execve(2) hardly gives any information about memory layout and internals of memory management.

The link does talk about loading code into memory, different segments and paging
0
All Courses

From novice to tech pro — start learning today.